For #26286 improve homeThreeDotMenuItemsTest UI test coverage and other refactoring work
This commit is contained in:
parent
875a339ee7
commit
78c0b7ec3b
|
@ -21,9 +21,20 @@ object MatcherHelper {
|
||||||
fun itemContainingText(itemText: String) =
|
fun itemContainingText(itemText: String) =
|
||||||
mDevice.findObject(UiSelector().textContains(itemText))
|
mDevice.findObject(UiSelector().textContains(itemText))
|
||||||
|
|
||||||
|
fun itemWithDescription(description: String) =
|
||||||
|
mDevice.findObject(UiSelector().descriptionContains(description))
|
||||||
|
|
||||||
fun checkedItemWithResId(resourceId: String, isChecked: Boolean) =
|
fun checkedItemWithResId(resourceId: String, isChecked: Boolean) =
|
||||||
mDevice.findObject(UiSelector().resourceId(resourceId).checked(isChecked))
|
mDevice.findObject(UiSelector().resourceId(resourceId).checked(isChecked))
|
||||||
|
|
||||||
|
fun checkedItemWithResIdAndText(resourceId: String, text: String, isChecked: Boolean) =
|
||||||
|
mDevice.findObject(
|
||||||
|
UiSelector()
|
||||||
|
.resourceId(resourceId)
|
||||||
|
.textContains(text)
|
||||||
|
.checked(isChecked),
|
||||||
|
)
|
||||||
|
|
||||||
fun itemWithResIdAndDescription(resourceId: String, description: String) =
|
fun itemWithResIdAndDescription(resourceId: String, description: String) =
|
||||||
mDevice.findObject(UiSelector().resourceId(resourceId).descriptionContains(description))
|
mDevice.findObject(UiSelector().resourceId(resourceId).descriptionContains(description))
|
||||||
|
|
||||||
|
@ -42,12 +53,24 @@ object MatcherHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun assertItemWithDescriptionExists(vararg appItems: UiObject) {
|
||||||
|
for (appItem in appItems) {
|
||||||
|
assertTrue(appItem.waitForExists(waitingTime))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun assertCheckedItemWithResIdExists(vararg appItems: UiObject) {
|
fun assertCheckedItemWithResIdExists(vararg appItems: UiObject) {
|
||||||
for (appItem in appItems) {
|
for (appItem in appItems) {
|
||||||
assertTrue(appItem.waitForExists(waitingTime))
|
assertTrue(appItem.waitForExists(waitingTime))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun assertCheckedItemWithResIdAndTextExists(vararg appItems: UiObject) {
|
||||||
|
for (appItem in appItems) {
|
||||||
|
assertTrue(appItem.waitForExists(waitingTime))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun assertItemWithResIdAndDescriptionExists(vararg appItems: UiObject) {
|
fun assertItemWithResIdAndDescriptionExists(vararg appItems: UiObject) {
|
||||||
for (appItem in appItems) {
|
for (appItem in appItems) {
|
||||||
assertTrue(appItem.waitForExists(waitingTime))
|
assertTrue(appItem.waitForExists(waitingTime))
|
||||||
|
|
|
@ -65,7 +65,7 @@ class NavigationToolbarTest {
|
||||||
}.enterURLAndEnterToBrowser(nextWebPage.url) {
|
}.enterURLAndEnterToBrowser(nextWebPage.url) {
|
||||||
verifyUrl(nextWebPage.url.toString())
|
verifyUrl(nextWebPage.url.toString())
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.goBack {
|
}.goToPreviousPage {
|
||||||
mDevice.waitForIdle()
|
mDevice.waitForIdle()
|
||||||
verifyUrl(defaultWebPage.url.toString())
|
verifyUrl(defaultWebPage.url.toString())
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ class NavigationToolbarTest {
|
||||||
mDevice.waitForIdle()
|
mDevice.waitForIdle()
|
||||||
verifyUrl(nextWebPage.url.toString())
|
verifyUrl(nextWebPage.url.toString())
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.goBack {
|
}.goToPreviousPage {
|
||||||
mDevice.waitForIdle()
|
mDevice.waitForIdle()
|
||||||
verifyUrl(defaultWebPage.url.toString())
|
verifyUrl(defaultWebPage.url.toString())
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,7 @@ class SmokeTest {
|
||||||
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
||||||
waitForPageToLoad()
|
waitForPageToLoad()
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
verifyPageThreeDotMainMenuItems()
|
verifyPageThreeDotMainMenuItems(isRequestDesktopSiteEnabled = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,50 +44,47 @@ class ThreeDotMenuMainTest {
|
||||||
fun homeThreeDotMenuItemsTest() {
|
fun homeThreeDotMenuItemsTest() {
|
||||||
homeScreen {
|
homeScreen {
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
verifyBookmarksButton()
|
verifyHomeThreeDotMainMenuItems(isRequestDesktopSiteEnabled = false)
|
||||||
verifyHistoryButton()
|
}.openBookmarks {
|
||||||
verifyDownloadsButton()
|
verifyBookmarksMenuView()
|
||||||
verifyAddOnsButton()
|
|
||||||
// Disabled step due to https://github.com/mozilla-mobile/fenix/issues/26788
|
|
||||||
// verifySyncSignInButton()
|
|
||||||
verifyDesktopSite()
|
|
||||||
verifyWhatsNewButton()
|
|
||||||
verifyHelpButton()
|
|
||||||
verifyCustomizeHomeButton()
|
|
||||||
verifySettingsButton()
|
|
||||||
}.openSettings {
|
|
||||||
verifySettingsView()
|
|
||||||
}.goBack {
|
}.goBack {
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
|
}.openHistory {
|
||||||
|
verifyHistoryMenuView()
|
||||||
|
}.goBack {
|
||||||
|
}.openThreeDotMenu {
|
||||||
|
}.openDownloadsManager {
|
||||||
|
verifyEmptyDownloadsList()
|
||||||
|
}.goBack {
|
||||||
|
}.openThreeDotMenu {
|
||||||
|
}.openAddonsManagerMenu {
|
||||||
|
verifyAddonsItems()
|
||||||
|
}.goBack {
|
||||||
|
}.openThreeDotMenu {
|
||||||
|
}.openSyncSignIn {
|
||||||
|
verifyTurnOnSyncMenu()
|
||||||
|
}.goBack {
|
||||||
|
// Desktop toggle
|
||||||
|
}.openThreeDotMenu {
|
||||||
|
}.switchDesktopSiteMode {
|
||||||
|
}
|
||||||
|
homeScreen {
|
||||||
|
}.openThreeDotMenu {
|
||||||
|
verifyDesktopSiteModeEnabled(isRequestDesktopSiteEnabled = true)
|
||||||
|
}.openWhatsNew {
|
||||||
|
verifyWhatsNewURL()
|
||||||
|
}.goToHomescreen {
|
||||||
|
}.openThreeDotMenu {
|
||||||
|
}.openHelp {
|
||||||
|
verifyHelpUrl()
|
||||||
|
}.goToHomescreen {
|
||||||
|
}.openThreeDotMenu {
|
||||||
}.openCustomizeHome {
|
}.openCustomizeHome {
|
||||||
verifyHomePageView()
|
verifyHomePageView()
|
||||||
}.goBack {
|
}.goBack {
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openHelp {
|
}.openSettings {
|
||||||
verifyHelpUrl()
|
verifySettingsView()
|
||||||
}.openTabDrawer {
|
|
||||||
closeTab()
|
|
||||||
}
|
|
||||||
|
|
||||||
homeScreen {
|
|
||||||
}.openThreeDotMenu {
|
|
||||||
}.openWhatsNew {
|
|
||||||
verifyWhatsNewURL()
|
|
||||||
}.openTabDrawer {
|
|
||||||
closeTab()
|
|
||||||
}
|
|
||||||
|
|
||||||
homeScreen {
|
|
||||||
}.openThreeDotMenu {
|
|
||||||
}.openBookmarks {
|
|
||||||
verifyBookmarksMenuView()
|
|
||||||
}.closeMenu {
|
|
||||||
}
|
|
||||||
|
|
||||||
homeScreen {
|
|
||||||
}.openThreeDotMenu {
|
|
||||||
}.openHistory {
|
|
||||||
verifyHistoryMenuView()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ class TopSitesTest {
|
||||||
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
expandMenu()
|
expandMenu()
|
||||||
verifyAddToTopSitesButton()
|
verifyAddToShortcutsButton()
|
||||||
}.addToFirefoxHome {
|
}.addToFirefoxHome {
|
||||||
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
||||||
}.goToHomescreen {
|
}.goToHomescreen {
|
||||||
|
@ -84,7 +84,7 @@ class TopSitesTest {
|
||||||
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
expandMenu()
|
expandMenu()
|
||||||
verifyAddToTopSitesButton()
|
verifyAddToShortcutsButton()
|
||||||
}.addToFirefoxHome {
|
}.addToFirefoxHome {
|
||||||
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
||||||
}.goToHomescreen {
|
}.goToHomescreen {
|
||||||
|
@ -111,7 +111,7 @@ class TopSitesTest {
|
||||||
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
expandMenu()
|
expandMenu()
|
||||||
verifyAddToTopSitesButton()
|
verifyAddToShortcutsButton()
|
||||||
}.addToFirefoxHome {
|
}.addToFirefoxHome {
|
||||||
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
||||||
}.goToHomescreen {
|
}.goToHomescreen {
|
||||||
|
@ -134,7 +134,7 @@ class TopSitesTest {
|
||||||
waitForPageToLoad()
|
waitForPageToLoad()
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
expandMenu()
|
expandMenu()
|
||||||
verifyAddToTopSitesButton()
|
verifyAddToShortcutsButton()
|
||||||
}.addToFirefoxHome {
|
}.addToFirefoxHome {
|
||||||
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
||||||
}.goToHomescreen {
|
}.goToHomescreen {
|
||||||
|
@ -156,7 +156,7 @@ class TopSitesTest {
|
||||||
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
expandMenu()
|
expandMenu()
|
||||||
verifyAddToTopSitesButton()
|
verifyAddToShortcutsButton()
|
||||||
}.addToFirefoxHome {
|
}.addToFirefoxHome {
|
||||||
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
||||||
}.goToHomescreen {
|
}.goToHomescreen {
|
||||||
|
@ -177,7 +177,7 @@ class TopSitesTest {
|
||||||
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
expandMenu()
|
expandMenu()
|
||||||
verifyAddToTopSitesButton()
|
verifyAddToShortcutsButton()
|
||||||
}.addToFirefoxHome {
|
}.addToFirefoxHome {
|
||||||
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
verifySnackBarText(getStringResource(R.string.snackbar_added_to_shortcuts))
|
||||||
}.goToHomescreen {
|
}.goToHomescreen {
|
||||||
|
|
|
@ -258,6 +258,13 @@ class BookmarksRobot {
|
||||||
SettingsTurnOnSyncRobot().interact()
|
SettingsTurnOnSyncRobot().interact()
|
||||||
return SettingsTurnOnSyncRobot.Transition()
|
return SettingsTurnOnSyncRobot.Transition()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun goBack(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
|
||||||
|
goBackButton().click()
|
||||||
|
|
||||||
|
HomeScreenRobot().interact()
|
||||||
|
return HomeScreenRobot.Transition()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,13 @@ class DownloadRobot {
|
||||||
BrowserRobot().interact()
|
BrowserRobot().interact()
|
||||||
return BrowserRobot.Transition()
|
return BrowserRobot.Transition()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun goBack(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
|
||||||
|
goBackButton().click()
|
||||||
|
|
||||||
|
HomeScreenRobot().interact()
|
||||||
|
return HomeScreenRobot.Transition()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,3 +202,5 @@ private fun assertDownloadedFileIcon() =
|
||||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/favicon"))
|
mDevice.findObject(UiSelector().resourceId("$packageName:id/favicon"))
|
||||||
.exists(),
|
.exists(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private fun goBackButton() = onView(withContentDescription("Navigate up"))
|
||||||
|
|
|
@ -53,16 +53,16 @@ import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
import org.mozilla.fenix.helpers.Constants.LISTS_MAXSWIPES
|
import org.mozilla.fenix.helpers.Constants.LISTS_MAXSWIPES
|
||||||
import org.mozilla.fenix.helpers.Constants.LONG_CLICK_DURATION
|
import org.mozilla.fenix.helpers.Constants.LONG_CLICK_DURATION
|
||||||
import org.mozilla.fenix.helpers.MatcherHelper.itemContainingText
|
import org.mozilla.fenix.helpers.MatcherHelper.assertCheckedItemWithResIdExists
|
||||||
|
import org.mozilla.fenix.helpers.MatcherHelper.assertItemContainingTextExists
|
||||||
|
import org.mozilla.fenix.helpers.MatcherHelper.assertItemWithResIdAndDescriptionExists
|
||||||
|
import org.mozilla.fenix.helpers.MatcherHelper.assertItemWithResIdAndTextExists
|
||||||
|
import org.mozilla.fenix.helpers.MatcherHelper.assertItemWithResIdExists
|
||||||
import org.mozilla.fenix.helpers.MatcherHelper.checkedItemWithResId
|
import org.mozilla.fenix.helpers.MatcherHelper.checkedItemWithResId
|
||||||
|
import org.mozilla.fenix.helpers.MatcherHelper.itemContainingText
|
||||||
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResId
|
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResId
|
||||||
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResIdAndDescription
|
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResIdAndDescription
|
||||||
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResIdAndText
|
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResIdAndText
|
||||||
import org.mozilla.fenix.helpers.MatcherHelper.assertItemContainingTextExists
|
|
||||||
import org.mozilla.fenix.helpers.MatcherHelper.assertCheckedItemWithResIdExists
|
|
||||||
import org.mozilla.fenix.helpers.MatcherHelper.assertItemWithResIdExists
|
|
||||||
import org.mozilla.fenix.helpers.MatcherHelper.assertItemWithResIdAndDescriptionExists
|
|
||||||
import org.mozilla.fenix.helpers.MatcherHelper.assertItemWithResIdAndTextExists
|
|
||||||
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
|
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
|
||||||
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeShort
|
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeShort
|
||||||
import org.mozilla.fenix.helpers.TestHelper.appContext
|
import org.mozilla.fenix.helpers.TestHelper.appContext
|
||||||
|
|
|
@ -16,8 +16,6 @@ import androidx.test.espresso.matcher.RootMatchers
|
||||||
import androidx.test.espresso.matcher.ViewMatchers
|
import androidx.test.espresso.matcher.ViewMatchers
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.Visibility
|
import androidx.test.espresso.matcher.ViewMatchers.Visibility
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.isChecked
|
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed
|
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||||
|
@ -26,11 +24,18 @@ import androidx.test.uiautomator.By
|
||||||
import androidx.test.uiautomator.UiSelector
|
import androidx.test.uiautomator.UiSelector
|
||||||
import androidx.test.uiautomator.Until
|
import androidx.test.uiautomator.Until
|
||||||
import org.hamcrest.Matchers.allOf
|
import org.hamcrest.Matchers.allOf
|
||||||
import org.hamcrest.Matchers.not
|
|
||||||
import org.junit.Assert.assertFalse
|
import org.junit.Assert.assertFalse
|
||||||
import org.junit.Assert.assertTrue
|
import org.junit.Assert.assertTrue
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.helpers.Constants.RETRY_COUNT
|
import org.mozilla.fenix.helpers.Constants.RETRY_COUNT
|
||||||
|
import org.mozilla.fenix.helpers.MatcherHelper.assertCheckedItemWithResIdAndTextExists
|
||||||
|
import org.mozilla.fenix.helpers.MatcherHelper.assertItemContainingTextExists
|
||||||
|
import org.mozilla.fenix.helpers.MatcherHelper.assertItemWithDescriptionExists
|
||||||
|
import org.mozilla.fenix.helpers.MatcherHelper.assertItemWithResIdAndTextExists
|
||||||
|
import org.mozilla.fenix.helpers.MatcherHelper.checkedItemWithResIdAndText
|
||||||
|
import org.mozilla.fenix.helpers.MatcherHelper.itemContainingText
|
||||||
|
import org.mozilla.fenix.helpers.MatcherHelper.itemWithDescription
|
||||||
|
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResIdAndText
|
||||||
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
|
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
|
||||||
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeLong
|
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeLong
|
||||||
import org.mozilla.fenix.helpers.TestHelper.getStringResource
|
import org.mozilla.fenix.helpers.TestHelper.getStringResource
|
||||||
|
@ -45,20 +50,12 @@ import org.mozilla.fenix.helpers.ext.waitNotNull
|
||||||
@Suppress("ForbiddenComment")
|
@Suppress("ForbiddenComment")
|
||||||
class ThreeDotMenuMainRobot {
|
class ThreeDotMenuMainRobot {
|
||||||
fun verifyShareAllTabsButton() = assertShareAllTabsButton()
|
fun verifyShareAllTabsButton() = assertShareAllTabsButton()
|
||||||
fun verifySettingsButton() = assertSettingsButton()
|
fun verifySettingsButton() = assertItemContainingTextExists(settingsButton())
|
||||||
fun verifyCustomizeHomeButton() = assertCustomizeHomeButton()
|
fun verifyHistoryButton() = assertItemContainingTextExists(historyButton)
|
||||||
fun verifyAddOnsButton() = assertAddOnsButton()
|
|
||||||
fun verifyHistoryButton() = assertHistoryButton()
|
|
||||||
fun verifyBookmarksButton() = assertBookmarksButton()
|
|
||||||
fun verifySyncSignInButton() = assertSyncSignInButton()
|
|
||||||
fun verifyHelpButton() = assertHelpButton()
|
|
||||||
fun verifyThreeDotMenuExists() = threeDotMenuRecyclerViewExists()
|
fun verifyThreeDotMenuExists() = threeDotMenuRecyclerViewExists()
|
||||||
fun verifyForwardButton() = assertForwardButton()
|
fun verifyAddBookmarkButton() = assertItemWithResIdAndTextExists(addBookmarkButton)
|
||||||
fun verifyAddBookmarkButton() = assertAddBookmarkButton()
|
|
||||||
fun verifyEditBookmarkButton() = assertEditBookmarkButton()
|
fun verifyEditBookmarkButton() = assertEditBookmarkButton()
|
||||||
fun verifyRefreshButton() = assertRefreshButton()
|
|
||||||
fun verifyCloseAllTabsButton() = assertCloseAllTabsButton()
|
fun verifyCloseAllTabsButton() = assertCloseAllTabsButton()
|
||||||
fun verifyShareButton() = assertShareButton()
|
|
||||||
fun verifyReaderViewAppearance(visible: Boolean) = assertReaderViewAppearanceButton(visible)
|
fun verifyReaderViewAppearance(visible: Boolean) = assertReaderViewAppearanceButton(visible)
|
||||||
|
|
||||||
fun expandMenu() {
|
fun expandMenu() {
|
||||||
|
@ -66,49 +63,61 @@ class ThreeDotMenuMainRobot {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun verifyShareTabButton() = assertShareTabButton()
|
fun verifyShareTabButton() = assertShareTabButton()
|
||||||
fun verifySaveCollection() = assertSaveCollectionButton()
|
|
||||||
fun verifySelectTabs() = assertSelectTabsButton()
|
fun verifySelectTabs() = assertSelectTabsButton()
|
||||||
|
|
||||||
fun verifyFindInPageButton() = assertFindInPageButton()
|
fun verifyFindInPageButton() = assertItemContainingTextExists(findInPageButton)
|
||||||
fun verifyWhatsNewButton() = assertWhatsNewButton()
|
fun verifyAddToShortcutsButton() = assertItemContainingTextExists(addToShortcutsButton)
|
||||||
fun verifyAddToTopSitesButton() = assertAddToTopSitesButton()
|
|
||||||
fun verifyRemoveFromShortcutsButton() = assertRemoveFromShortcutsButton()
|
fun verifyRemoveFromShortcutsButton() = assertRemoveFromShortcutsButton()
|
||||||
fun verifyAddToMobileHome() = assertAddToMobileHome()
|
|
||||||
fun verifyDesktopSite() = assertDesktopSite()
|
|
||||||
fun verifyDownloadsButton() = assertDownloadsButton()
|
|
||||||
fun verifyShareTabsOverlay() = assertShareTabsOverlay()
|
fun verifyShareTabsOverlay() = assertShareTabsOverlay()
|
||||||
fun verifyNewTabButton() = assertNormalBrowsingNewTabButton()
|
|
||||||
fun verifyReportSiteIssueButton() = assertReportSiteIssueButton()
|
|
||||||
|
|
||||||
fun verifyDesktopSiteModeEnabled(state: Boolean) {
|
fun verifyDesktopSiteModeEnabled(isRequestDesktopSiteEnabled: Boolean) {
|
||||||
expandMenu()
|
expandMenu()
|
||||||
if (state) {
|
assertCheckedItemWithResIdAndTextExists(desktopSiteToggle(isRequestDesktopSiteEnabled))
|
||||||
desktopSiteButton().check(matches(isChecked()))
|
|
||||||
} else {
|
|
||||||
desktopSiteButton().check(matches(not(isChecked())))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun verifyPageThreeDotMainMenuItems() {
|
fun verifyPageThreeDotMainMenuItems(isRequestDesktopSiteEnabled: Boolean) {
|
||||||
verifyNewTabButton()
|
expandMenu()
|
||||||
verifyBookmarksButton()
|
assertItemContainingTextExists(
|
||||||
verifyAddBookmarkButton()
|
normalBrowsingNewTabButton,
|
||||||
verifyHistoryButton()
|
bookmarksButton,
|
||||||
verifyDownloadsButton()
|
historyButton,
|
||||||
verifyAddOnsButton()
|
downloadsButton,
|
||||||
verifySyncSignInButton()
|
addOnsButton,
|
||||||
threeDotMenuRecyclerView().perform(swipeUp())
|
syncAndSaveDataButton,
|
||||||
verifyFindInPageButton()
|
findInPageButton,
|
||||||
verifyDesktopSite()
|
desktopSiteButton,
|
||||||
threeDotMenuRecyclerView().perform(swipeUp())
|
reportSiteIssueButton,
|
||||||
verifyReportSiteIssueButton()
|
addToHomeScreenButton,
|
||||||
verifyAddToTopSitesButton()
|
addToShortcutsButton,
|
||||||
verifyAddToMobileHome()
|
saveToCollectionButton,
|
||||||
verifySaveCollection()
|
settingsButton(),
|
||||||
verifySettingsButton()
|
)
|
||||||
verifyShareButton()
|
assertCheckedItemWithResIdAndTextExists(addBookmarkButton)
|
||||||
verifyForwardButton()
|
assertCheckedItemWithResIdAndTextExists(desktopSiteToggle(isRequestDesktopSiteEnabled))
|
||||||
verifyRefreshButton()
|
assertItemWithDescriptionExists(
|
||||||
|
backButton,
|
||||||
|
forwardButton,
|
||||||
|
shareButton,
|
||||||
|
refreshButton,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun verifyHomeThreeDotMainMenuItems(isRequestDesktopSiteEnabled: Boolean) {
|
||||||
|
assertItemContainingTextExists(
|
||||||
|
bookmarksButton,
|
||||||
|
historyButton,
|
||||||
|
downloadsButton,
|
||||||
|
addOnsButton,
|
||||||
|
// Disabled step due to https://github.com/mozilla-mobile/fenix/issues/26788
|
||||||
|
// syncAndSaveDataButton,
|
||||||
|
desktopSiteButton,
|
||||||
|
whatsNewButton,
|
||||||
|
helpButton,
|
||||||
|
customizeHomeButton,
|
||||||
|
settingsButton(),
|
||||||
|
)
|
||||||
|
|
||||||
|
assertCheckedItemWithResIdAndTextExists(desktopSiteToggle(isRequestDesktopSiteEnabled))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun assertShareTabsOverlay() {
|
private fun assertShareTabsOverlay() {
|
||||||
|
@ -164,7 +173,7 @@ class ThreeDotMenuMainRobot {
|
||||||
|
|
||||||
fun openDownloadsManager(interact: DownloadRobot.() -> Unit): DownloadRobot.Transition {
|
fun openDownloadsManager(interact: DownloadRobot.() -> Unit): DownloadRobot.Transition {
|
||||||
threeDotMenuRecyclerView().perform(swipeDown())
|
threeDotMenuRecyclerView().perform(swipeDown())
|
||||||
downloadsButton().click()
|
downloadsButton.click()
|
||||||
|
|
||||||
DownloadRobot().interact()
|
DownloadRobot().interact()
|
||||||
return DownloadRobot.Transition()
|
return DownloadRobot.Transition()
|
||||||
|
@ -173,7 +182,7 @@ class ThreeDotMenuMainRobot {
|
||||||
fun openSyncSignIn(interact: SyncSignInRobot.() -> Unit): SyncSignInRobot.Transition {
|
fun openSyncSignIn(interact: SyncSignInRobot.() -> Unit): SyncSignInRobot.Transition {
|
||||||
threeDotMenuRecyclerView().perform(swipeDown())
|
threeDotMenuRecyclerView().perform(swipeDown())
|
||||||
mDevice.waitNotNull(Until.findObject(By.text("Sync and save data")), waitingTime)
|
mDevice.waitNotNull(Until.findObject(By.text("Sync and save data")), waitingTime)
|
||||||
syncSignInButton().click()
|
syncAndSaveDataButton.click()
|
||||||
|
|
||||||
SyncSignInRobot().interact()
|
SyncSignInRobot().interact()
|
||||||
return SyncSignInRobot.Transition()
|
return SyncSignInRobot.Transition()
|
||||||
|
@ -183,7 +192,7 @@ class ThreeDotMenuMainRobot {
|
||||||
threeDotMenuRecyclerView().perform(swipeDown())
|
threeDotMenuRecyclerView().perform(swipeDown())
|
||||||
mDevice.waitNotNull(Until.findObject(By.text("Bookmarks")), waitingTime)
|
mDevice.waitNotNull(Until.findObject(By.text("Bookmarks")), waitingTime)
|
||||||
|
|
||||||
bookmarksButton().click()
|
bookmarksButton.click()
|
||||||
assertTrue(mDevice.findObject(UiSelector().resourceId("$packageName:id/bookmark_list")).waitForExists(waitingTime))
|
assertTrue(mDevice.findObject(UiSelector().resourceId("$packageName:id/bookmark_list")).waitForExists(waitingTime))
|
||||||
|
|
||||||
BookmarksRobot().interact()
|
BookmarksRobot().interact()
|
||||||
|
@ -193,7 +202,7 @@ class ThreeDotMenuMainRobot {
|
||||||
fun openHistory(interact: HistoryRobot.() -> Unit): HistoryRobot.Transition {
|
fun openHistory(interact: HistoryRobot.() -> Unit): HistoryRobot.Transition {
|
||||||
threeDotMenuRecyclerView().perform(swipeDown())
|
threeDotMenuRecyclerView().perform(swipeDown())
|
||||||
mDevice.waitNotNull(Until.findObject(By.text("History")), waitingTime)
|
mDevice.waitNotNull(Until.findObject(By.text("History")), waitingTime)
|
||||||
historyButton().click()
|
historyButton.click()
|
||||||
|
|
||||||
HistoryRobot().interact()
|
HistoryRobot().interact()
|
||||||
return HistoryRobot.Transition()
|
return HistoryRobot.Transition()
|
||||||
|
@ -201,7 +210,7 @@ class ThreeDotMenuMainRobot {
|
||||||
|
|
||||||
fun bookmarkPage(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
fun bookmarkPage(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||||
mDevice.waitNotNull(Until.findObject(By.text("Bookmarks")), waitingTime)
|
mDevice.waitNotNull(Until.findObject(By.text("Bookmarks")), waitingTime)
|
||||||
addBookmarkButton().click()
|
addBookmarkButton.click()
|
||||||
|
|
||||||
BrowserRobot().interact()
|
BrowserRobot().interact()
|
||||||
return BrowserRobot.Transition()
|
return BrowserRobot.Transition()
|
||||||
|
@ -217,7 +226,7 @@ class ThreeDotMenuMainRobot {
|
||||||
|
|
||||||
fun openHelp(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
fun openHelp(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||||
mDevice.waitNotNull(Until.findObject(By.text("Help")), waitingTime)
|
mDevice.waitNotNull(Until.findObject(By.text("Help")), waitingTime)
|
||||||
helpButton().click()
|
helpButton.click()
|
||||||
|
|
||||||
BrowserRobot().interact()
|
BrowserRobot().interact()
|
||||||
return BrowserRobot.Transition()
|
return BrowserRobot.Transition()
|
||||||
|
@ -232,7 +241,7 @@ class ThreeDotMenuMainRobot {
|
||||||
waitingTime,
|
waitingTime,
|
||||||
)
|
)
|
||||||
|
|
||||||
customizeHomeButton().click()
|
customizeHomeButton.click()
|
||||||
|
|
||||||
mDevice.findObject(
|
mDevice.findObject(
|
||||||
UiSelector().resourceId("$packageName:id/recycler_view"),
|
UiSelector().resourceId("$packageName:id/recycler_view"),
|
||||||
|
@ -243,21 +252,21 @@ class ThreeDotMenuMainRobot {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun goForward(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
fun goForward(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||||
forwardButton().click()
|
forwardButton.click()
|
||||||
|
|
||||||
BrowserRobot().interact()
|
BrowserRobot().interact()
|
||||||
return BrowserRobot.Transition()
|
return BrowserRobot.Transition()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun goBack(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
fun goToPreviousPage(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||||
backButton().click()
|
backButton.click()
|
||||||
|
|
||||||
BrowserRobot().interact()
|
BrowserRobot().interact()
|
||||||
return BrowserRobot.Transition()
|
return BrowserRobot.Transition()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clickShareButton(interact: ShareOverlayRobot.() -> Unit): ShareOverlayRobot.Transition {
|
fun clickShareButton(interact: ShareOverlayRobot.() -> Unit): ShareOverlayRobot.Transition {
|
||||||
shareButton().click()
|
shareButton.click()
|
||||||
mDevice.waitNotNull(Until.findObject(By.text("ALL ACTIONS")), waitingTime)
|
mDevice.waitNotNull(Until.findObject(By.text("ALL ACTIONS")), waitingTime)
|
||||||
|
|
||||||
ShareOverlayRobot().interact()
|
ShareOverlayRobot().interact()
|
||||||
|
@ -281,8 +290,7 @@ class ThreeDotMenuMainRobot {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun refreshPage(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
fun refreshPage(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||||
assertRefreshButton()
|
refreshButton.click()
|
||||||
refreshButton().click()
|
|
||||||
|
|
||||||
BrowserRobot().interact()
|
BrowserRobot().interact()
|
||||||
return BrowserRobot.Transition()
|
return BrowserRobot.Transition()
|
||||||
|
@ -298,7 +306,7 @@ class ThreeDotMenuMainRobot {
|
||||||
fun openReportSiteIssue(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
fun openReportSiteIssue(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||||
threeDotMenuRecyclerView().perform(swipeUp())
|
threeDotMenuRecyclerView().perform(swipeUp())
|
||||||
threeDotMenuRecyclerView().perform(swipeUp())
|
threeDotMenuRecyclerView().perform(swipeUp())
|
||||||
reportSiteIssueButton().click()
|
reportSiteIssueButton.click()
|
||||||
|
|
||||||
BrowserRobot().interact()
|
BrowserRobot().interact()
|
||||||
return BrowserRobot.Transition()
|
return BrowserRobot.Transition()
|
||||||
|
@ -308,7 +316,7 @@ class ThreeDotMenuMainRobot {
|
||||||
threeDotMenuRecyclerView().perform(swipeUp())
|
threeDotMenuRecyclerView().perform(swipeUp())
|
||||||
threeDotMenuRecyclerView().perform(swipeUp())
|
threeDotMenuRecyclerView().perform(swipeUp())
|
||||||
mDevice.waitNotNull(Until.findObject(By.text("Find in page")), waitingTime)
|
mDevice.waitNotNull(Until.findObject(By.text("Find in page")), waitingTime)
|
||||||
findInPageButton().click()
|
findInPageButton.click()
|
||||||
|
|
||||||
FindInPageRobot().interact()
|
FindInPageRobot().interact()
|
||||||
return FindInPageRobot.Transition()
|
return FindInPageRobot.Transition()
|
||||||
|
@ -316,7 +324,7 @@ class ThreeDotMenuMainRobot {
|
||||||
|
|
||||||
fun openWhatsNew(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
fun openWhatsNew(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||||
mDevice.waitNotNull(Until.findObject(By.text("What’s new")), waitingTime)
|
mDevice.waitNotNull(Until.findObject(By.text("What’s new")), waitingTime)
|
||||||
whatsNewButton().click()
|
whatsNewButton.click()
|
||||||
|
|
||||||
BrowserRobot().interact()
|
BrowserRobot().interact()
|
||||||
return BrowserRobot.Transition()
|
return BrowserRobot.Transition()
|
||||||
|
@ -332,7 +340,7 @@ class ThreeDotMenuMainRobot {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addToFirefoxHome(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
fun addToFirefoxHome(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||||
addToTopSitesButton().click()
|
addToShortcutsButton.click()
|
||||||
|
|
||||||
BrowserRobot().interact()
|
BrowserRobot().interact()
|
||||||
return BrowserRobot.Transition()
|
return BrowserRobot.Transition()
|
||||||
|
@ -347,7 +355,7 @@ class ThreeDotMenuMainRobot {
|
||||||
|
|
||||||
fun openAddToHomeScreen(interact: AddToHomeScreenRobot.() -> Unit): AddToHomeScreenRobot.Transition {
|
fun openAddToHomeScreen(interact: AddToHomeScreenRobot.() -> Unit): AddToHomeScreenRobot.Transition {
|
||||||
mDevice.waitNotNull(Until.findObject(By.text("Add to Home screen")), waitingTime)
|
mDevice.waitNotNull(Until.findObject(By.text("Add to Home screen")), waitingTime)
|
||||||
addToHomeScreenButton().click()
|
addToHomeScreenButton.click()
|
||||||
|
|
||||||
AddToHomeScreenRobot().interact()
|
AddToHomeScreenRobot().interact()
|
||||||
return AddToHomeScreenRobot.Transition()
|
return AddToHomeScreenRobot.Transition()
|
||||||
|
@ -368,7 +376,7 @@ class ThreeDotMenuMainRobot {
|
||||||
threeDotMenuRecyclerView().perform(swipeUp())
|
threeDotMenuRecyclerView().perform(swipeUp())
|
||||||
|
|
||||||
mDevice.waitNotNull(Until.findObject(By.text("Save to collection")), waitingTime)
|
mDevice.waitNotNull(Until.findObject(By.text("Save to collection")), waitingTime)
|
||||||
saveCollectionButton().click()
|
saveToCollectionButton.click()
|
||||||
CollectionRobot().interact()
|
CollectionRobot().interact()
|
||||||
return CollectionRobot.Transition()
|
return CollectionRobot.Transition()
|
||||||
}
|
}
|
||||||
|
@ -396,7 +404,7 @@ class ThreeDotMenuMainRobot {
|
||||||
fun switchDesktopSiteMode(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
fun switchDesktopSiteMode(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||||
threeDotMenuRecyclerView().perform(swipeUp())
|
threeDotMenuRecyclerView().perform(swipeUp())
|
||||||
threeDotMenuRecyclerView().perform(swipeUp())
|
threeDotMenuRecyclerView().perform(swipeUp())
|
||||||
desktopSiteButton().click()
|
desktopSiteButton.click()
|
||||||
|
|
||||||
BrowserRobot().interact()
|
BrowserRobot().interact()
|
||||||
return BrowserRobot.Transition()
|
return BrowserRobot.Transition()
|
||||||
|
@ -417,61 +425,10 @@ private fun threeDotMenuRecyclerViewExists() {
|
||||||
threeDotMenuRecyclerView().check(matches(isDisplayed()))
|
threeDotMenuRecyclerView().check(matches(isDisplayed()))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun settingsButton(localizedText: String = getStringResource(R.string.browser_menu_settings)) =
|
|
||||||
mDevice.findObject(UiSelector().text(localizedText))
|
|
||||||
|
|
||||||
private fun assertSettingsButton() = assertTrue(settingsButton().waitForExists(waitingTime))
|
|
||||||
|
|
||||||
private fun customizeHomeButton() =
|
|
||||||
onView(
|
|
||||||
allOf(
|
|
||||||
withId(R.id.text),
|
|
||||||
withText(R.string.browser_menu_customize_home_1),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
private fun assertCustomizeHomeButton() =
|
|
||||||
customizeHomeButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
||||||
|
|
||||||
private fun addOnsButton() = onView(allOf(withText("Add-ons")))
|
|
||||||
private fun assertAddOnsButton() {
|
|
||||||
onView(withId(R.id.mozac_browser_menu_menuView)).perform(swipeDown())
|
|
||||||
addOnsButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun historyButton() = onView(allOf(withText(R.string.library_history)))
|
|
||||||
private fun assertHistoryButton() = historyButton()
|
|
||||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
||||||
|
|
||||||
private fun bookmarksButton() = onView(allOf(withText(R.string.library_bookmarks)))
|
|
||||||
private fun assertBookmarksButton() = bookmarksButton()
|
|
||||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
||||||
|
|
||||||
private fun syncSignInButton() = onView(withText("Sync and save data"))
|
|
||||||
private fun assertSyncSignInButton() = syncSignInButton().check(matches(isDisplayed()))
|
|
||||||
|
|
||||||
private fun helpButton() = onView(allOf(withText(R.string.browser_menu_help)))
|
|
||||||
private fun assertHelpButton() = helpButton()
|
|
||||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
||||||
|
|
||||||
private fun forwardButton() = mDevice.findObject(UiSelector().description("Forward"))
|
|
||||||
private fun assertForwardButton() = assertTrue(forwardButton().waitForExists(waitingTime))
|
|
||||||
|
|
||||||
private fun backButton() = mDevice.findObject(UiSelector().description("Back"))
|
|
||||||
|
|
||||||
private fun addBookmarkButton() = onView(allOf(withId(R.id.checkbox), withText("Add")))
|
|
||||||
private fun assertAddBookmarkButton() {
|
|
||||||
onView(withId(R.id.mozac_browser_menu_menuView)).perform(swipeUp())
|
|
||||||
addBookmarkButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun editBookmarkButton() = onView(withText("Edit"))
|
private fun editBookmarkButton() = onView(withText("Edit"))
|
||||||
private fun assertEditBookmarkButton() = editBookmarkButton()
|
private fun assertEditBookmarkButton() = editBookmarkButton()
|
||||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
|
|
||||||
private fun refreshButton() = mDevice.findObject(UiSelector().description("Refresh"))
|
|
||||||
private fun assertRefreshButton() = assertTrue(refreshButton().waitForExists(waitingTime))
|
|
||||||
|
|
||||||
private fun stopLoadingButton() = onView(ViewMatchers.withContentDescription("Stop"))
|
private fun stopLoadingButton() = onView(ViewMatchers.withContentDescription("Stop"))
|
||||||
|
|
||||||
private fun closeAllTabsButton() = onView(allOf(withText("Close all tabs"))).inRoot(RootMatchers.isPlatformPopup())
|
private fun closeAllTabsButton() = onView(allOf(withText("Close all tabs"))).inRoot(RootMatchers.isPlatformPopup())
|
||||||
|
@ -482,36 +439,10 @@ private fun shareTabButton() = onView(allOf(withText("Share all tabs"))).inRoot(
|
||||||
private fun assertShareTabButton() = shareTabButton()
|
private fun assertShareTabButton() = shareTabButton()
|
||||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
|
|
||||||
private fun shareButton() = mDevice.findObject(UiSelector().description("Share"))
|
|
||||||
private fun assertShareButton() = assertTrue(shareButton().waitForExists(waitingTime))
|
|
||||||
|
|
||||||
private fun saveCollectionButton() = onView(allOf(withText("Save to collection"))).inRoot(RootMatchers.isPlatformPopup())
|
|
||||||
private fun assertSaveCollectionButton() = saveCollectionButton()
|
|
||||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
||||||
|
|
||||||
private fun selectTabsButton() = onView(allOf(withText("Select tabs"))).inRoot(RootMatchers.isPlatformPopup())
|
private fun selectTabsButton() = onView(allOf(withText("Select tabs"))).inRoot(RootMatchers.isPlatformPopup())
|
||||||
private fun assertSelectTabsButton() = selectTabsButton()
|
private fun assertSelectTabsButton() = selectTabsButton()
|
||||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
|
|
||||||
private fun reportSiteIssueButton() = onView(withText("Report Site Issue…"))
|
|
||||||
private fun assertReportSiteIssueButton() = reportSiteIssueButton().check(matches(isDisplayed()))
|
|
||||||
|
|
||||||
private fun findInPageButton() = onView(allOf(withText("Find in page")))
|
|
||||||
|
|
||||||
private fun assertFindInPageButton() = findInPageButton()
|
|
||||||
|
|
||||||
private fun whatsNewButton() = onView(
|
|
||||||
allOf(
|
|
||||||
withText("What’s new"),
|
|
||||||
withEffectiveVisibility(Visibility.VISIBLE),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
private fun assertWhatsNewButton() = whatsNewButton()
|
|
||||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
||||||
|
|
||||||
private fun addToHomeScreenButton() = onView(withText("Add to Home screen"))
|
|
||||||
|
|
||||||
private fun readerViewAppearanceToggle() =
|
private fun readerViewAppearanceToggle() =
|
||||||
mDevice.findObject(UiSelector().text("Customize reader view"))
|
mDevice.findObject(UiSelector().text("Customize reader view"))
|
||||||
|
|
||||||
|
@ -532,21 +463,9 @@ private fun assertReaderViewAppearanceButton(visible: Boolean) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addToTopSitesButton() =
|
|
||||||
onView(allOf(withText(R.string.browser_menu_add_to_shortcuts)))
|
|
||||||
|
|
||||||
private fun removeFromShortcutsButton() =
|
private fun removeFromShortcutsButton() =
|
||||||
onView(allOf(withText(R.string.browser_menu_remove_from_shortcuts)))
|
onView(allOf(withText(R.string.browser_menu_remove_from_shortcuts)))
|
||||||
|
|
||||||
private fun assertAddToTopSitesButton() {
|
|
||||||
onView(withId(R.id.mozac_browser_menu_recyclerView))
|
|
||||||
.perform(
|
|
||||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
||||||
hasDescendant(withText(R.string.browser_menu_add_to_shortcuts)),
|
|
||||||
),
|
|
||||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun assertRemoveFromShortcutsButton() {
|
private fun assertRemoveFromShortcutsButton() {
|
||||||
onView(withId(R.id.mozac_browser_menu_recyclerView))
|
onView(withId(R.id.mozac_browser_menu_recyclerView))
|
||||||
.perform(
|
.perform(
|
||||||
|
@ -556,26 +475,8 @@ private fun assertRemoveFromShortcutsButton() {
|
||||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addToMobileHomeButton() =
|
|
||||||
onView(allOf(withText(R.string.browser_menu_add_to_homescreen)))
|
|
||||||
|
|
||||||
private fun assertAddToMobileHome() {
|
|
||||||
onView(withId(R.id.mozac_browser_menu_recyclerView))
|
|
||||||
.perform(
|
|
||||||
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
||||||
hasDescendant(withText(R.string.browser_menu_add_to_homescreen)),
|
|
||||||
),
|
|
||||||
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun installPWAButton() = mDevice.findObject(UiSelector().text("Install"))
|
private fun installPWAButton() = mDevice.findObject(UiSelector().text("Install"))
|
||||||
|
|
||||||
private fun desktopSiteButton() = onView(withId(R.id.switch_widget))
|
|
||||||
private fun assertDesktopSite() {
|
|
||||||
threeDotMenuRecyclerView().perform(swipeUp())
|
|
||||||
desktopSiteButton().check(matches(isDisplayed()))
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun openInAppButton() =
|
private fun openInAppButton() =
|
||||||
onView(
|
onView(
|
||||||
allOf(
|
allOf(
|
||||||
|
@ -584,15 +485,9 @@ private fun openInAppButton() =
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun downloadsButton() = onView(withText(R.string.library_downloads))
|
|
||||||
private fun assertDownloadsButton() {
|
|
||||||
onView(withId(R.id.mozac_browser_menu_menuView)).perform(swipeDown())
|
|
||||||
downloadsButton().check(matches(isDisplayed()))
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun clickAddonsManagerButton() {
|
private fun clickAddonsManagerButton() {
|
||||||
onView(withId(R.id.mozac_browser_menu_menuView)).perform(swipeDown())
|
onView(withId(R.id.mozac_browser_menu_menuView)).perform(swipeDown())
|
||||||
addOnsButton().check(matches(isCompletelyDisplayed())).click()
|
addOnsButton.click()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun shareAllTabsButton() =
|
private fun shareAllTabsButton() =
|
||||||
|
@ -605,4 +500,45 @@ private fun assertShareAllTabsButton() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun assertNormalBrowsingNewTabButton() = onView(withText("New tab")).check(matches(isDisplayed()))
|
private val bookmarksButton =
|
||||||
|
itemContainingText(getStringResource(R.string.library_bookmarks))
|
||||||
|
private val historyButton =
|
||||||
|
itemContainingText(getStringResource(R.string.library_history))
|
||||||
|
private val downloadsButton =
|
||||||
|
itemContainingText(getStringResource(R.string.library_downloads))
|
||||||
|
private val addOnsButton =
|
||||||
|
itemContainingText(getStringResource(R.string.browser_menu_add_ons))
|
||||||
|
private val desktopSiteButton =
|
||||||
|
itemContainingText(getStringResource(R.string.browser_menu_desktop_site))
|
||||||
|
private fun desktopSiteToggle(state: Boolean) =
|
||||||
|
checkedItemWithResIdAndText(
|
||||||
|
"$packageName:id/switch_widget",
|
||||||
|
getStringResource(R.string.browser_menu_desktop_site),
|
||||||
|
state,
|
||||||
|
)
|
||||||
|
private val whatsNewButton =
|
||||||
|
itemContainingText(getStringResource(R.string.browser_menu_whats_new))
|
||||||
|
private val helpButton =
|
||||||
|
itemContainingText(getStringResource(R.string.browser_menu_help))
|
||||||
|
private val customizeHomeButton =
|
||||||
|
itemContainingText(getStringResource(R.string.browser_menu_customize_home_1))
|
||||||
|
private fun settingsButton(localizedText: String = getStringResource(R.string.browser_menu_settings)) =
|
||||||
|
itemContainingText(localizedText)
|
||||||
|
private val syncAndSaveDataButton =
|
||||||
|
itemContainingText(getStringResource(R.string.sync_menu_sync_and_save_data))
|
||||||
|
private val normalBrowsingNewTabButton =
|
||||||
|
itemContainingText(getStringResource(R.string.library_new_tab))
|
||||||
|
private val addBookmarkButton =
|
||||||
|
itemWithResIdAndText(
|
||||||
|
"$packageName:id/checkbox",
|
||||||
|
getStringResource(R.string.browser_menu_add),
|
||||||
|
)
|
||||||
|
private val findInPageButton = itemContainingText(getStringResource(R.string.browser_menu_find_in_page))
|
||||||
|
private val reportSiteIssueButton = itemContainingText("Report Site Issue")
|
||||||
|
private val addToHomeScreenButton = itemContainingText(getStringResource(R.string.browser_menu_add_to_homescreen))
|
||||||
|
private val addToShortcutsButton = itemContainingText(getStringResource(R.string.browser_menu_add_to_shortcuts))
|
||||||
|
private val saveToCollectionButton = itemContainingText(getStringResource(R.string.browser_menu_save_to_collection_2))
|
||||||
|
private val backButton = itemWithDescription(getStringResource(R.string.browser_menu_back))
|
||||||
|
private val forwardButton = itemWithDescription(getStringResource(R.string.browser_menu_forward))
|
||||||
|
private val shareButton = itemWithDescription(getStringResource(R.string.share_button_content_description))
|
||||||
|
private val refreshButton = itemWithDescription(getStringResource(R.string.browser_menu_refresh))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user