Bug 1884363 - Add logs to ThreeDotMenuMainRobot

fenix/125.0
AndiAJ 2 months ago committed by mergify[bot]
parent a6755ca5df
commit f4cf272743

@ -52,26 +52,46 @@ import org.mozilla.fenix.nimbus.FxNimbus
*/
@Suppress("ForbiddenComment")
class ThreeDotMenuMainRobot {
fun verifyShareAllTabsButton() = shareAllTabsButton().check(matches(isDisplayed()))
fun verifyShareAllTabsButton() {
Log.i(TAG, "verifyShareAllTabsButton: Trying to verify that the \"Share all tabs\" menu button is displayed")
shareAllTabsButton().check(matches(isDisplayed()))
Log.i(TAG, "verifyShareAllTabsButton: Verified that the \"Share all tabs\" menu button is displayed")
}
fun verifySettingsButton() = assertUIObjectExists(settingsButton())
fun verifyHistoryButton() = assertUIObjectExists(historyButton())
fun verifyThreeDotMenuExists() = threeDotMenuRecyclerView().check(matches(isDisplayed()))
fun verifyThreeDotMenuExists() {
Log.i(TAG, "verifyThreeDotMenuExists: Trying to verify that the three dot menu is displayed")
threeDotMenuRecyclerView().check(matches(isDisplayed()))
Log.i(TAG, "verifyThreeDotMenuExists: Verified that the three dot menu is displayed")
}
fun verifyAddBookmarkButton() = assertUIObjectExists(addBookmarkButton())
fun verifyEditBookmarkButton() =
fun verifyEditBookmarkButton() {
Log.i(TAG, "verifyEditBookmarkButton: Trying to verify that the \"Edit\" button is visible")
editBookmarkButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
fun verifyCloseAllTabsButton() =
Log.i(TAG, "verifyEditBookmarkButton: Verified that the \"Edit\" button is visible")
}
fun verifyCloseAllTabsButton() {
Log.i(TAG, "verifyCloseAllTabsButton: Trying to verify that the \"Close all tabs\" button is visible")
closeAllTabsButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
Log.i(TAG, "verifyCloseAllTabsButton: Verified that the \"Close all tabs\" button is visible")
}
fun verifyReaderViewAppearance(visible: Boolean) {
var maxSwipes = 3
if (visible) {
while (!readerViewAppearanceToggle().exists() && maxSwipes != 0) {
Log.i(TAG, "verifyReaderViewAppearance: The \"Customize reader view\" button does not exist")
Log.i(TAG, "verifyReaderViewAppearance: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "verifyReaderViewAppearance: Performed swipe up action on the three dot menu")
maxSwipes--
}
assertUIObjectExists(readerViewAppearanceToggle())
} else {
while (!readerViewAppearanceToggle().exists() && maxSwipes != 0) {
Log.i(TAG, "verifyReaderViewAppearance: The \"Customize reader view\" button does not exist")
Log.i(TAG, "verifyReaderViewAppearance: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "verifyReaderViewAppearance: Performed swipe up action on the three dot menu")
maxSwipes--
}
assertUIObjectExists(readerViewAppearanceToggle(), exists = false)
@ -87,27 +107,49 @@ class ThreeDotMenuMainRobot {
}
fun expandMenu() {
Log.i(TAG, "expandMenu: Trying to perform swipe up action on the three dot menu")
onView(withId(R.id.mozac_browser_menu_menuView)).perform(swipeUp())
Log.i(TAG, "expandMenu: Performed swipe up action on the three dot menu")
}
fun verifyShareTabButton() = shareTabButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
fun verifySelectTabs() = selectTabsButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
fun verifyShareTabButton() {
Log.i(TAG, "verifyShareTabButton: Trying to verify that the \"Share all tabs\" button is visible")
shareTabButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
Log.i(TAG, "verifyShareTabButton: Verified that the \"Share all tabs\" button is visible")
}
fun verifySelectTabs() {
Log.i(TAG, "verifySelectTabs: Trying to verify that the \"Select tabs\" button is visible")
selectTabsButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
Log.i(TAG, "verifySelectTabs: Verified that the \"Select tabs\" button is visible")
}
fun verifyFindInPageButton() = assertUIObjectExists(findInPageButton())
fun verifyAddToShortcutsButton(shouldExist: Boolean) =
assertUIObjectExists(addToShortcutsButton(), exists = shouldExist)
fun verifyRemoveFromShortcutsButton() =
fun verifyRemoveFromShortcutsButton() {
Log.i(TAG, "verifyRemoveFromShortcutsButton: Trying to perform scroll action to the \"Settings\" button")
onView(withId(R.id.mozac_browser_menu_recyclerView))
.perform(
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText(R.string.browser_menu_settings)),
),
).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
Log.i(TAG, "verifyRemoveFromShortcutsButton: Performed scroll action to the \"Settings\" button")
}
fun verifyShareTabsOverlay() {
Log.i(TAG, "verifyShareTabsOverlay: Trying to verify that the share overlay site list is displayed")
onView(withId(R.id.shared_site_list)).check(matches(isDisplayed()))
Log.i(TAG, "verifyShareTabsOverlay: Verified that the share overlay site list is displayed")
Log.i(TAG, "verifyShareTabsOverlay: Trying to verify that the shared tab title is displayed")
onView(withId(R.id.share_tab_title)).check(matches(isDisplayed()))
Log.i(TAG, "verifyShareTabsOverlay: Verified that the shared tab title is displayed")
Log.i(TAG, "verifyShareTabsOverlay: Trying to verify that the shared tab favicon is displayed")
onView(withId(R.id.share_tab_favicon)).check(matches(isDisplayed()))
Log.i(TAG, "verifyShareTabsOverlay: Verified that the shared tab favicon is displayed")
Log.i(TAG, "verifyShareTabsOverlay: Trying to verify that the shared tab url is displayed")
onView(withId(R.id.share_tab_url)).check(matches(isDisplayed()))
Log.i(TAG, "verifyShareTabsOverlay: Verified that the shared tab url is displayed")
}
fun verifyDesktopSiteModeEnabled(isRequestDesktopSiteEnabled: Boolean) {
@ -175,10 +217,12 @@ class ThreeDotMenuMainRobot {
fun verifyAddonAvailableInMainMenu(addonName: String) {
for (i in 1..RETRY_COUNT) {
Log.i(TAG, "verifyAddonAvailableInMainMenu: Started try #$i")
try {
assertUIObjectExists(itemContainingText(addonName))
break
} catch (e: AssertionError) {
Log.i(TAG, "verifyAddonAvailableInMainMenu: AssertionError caught, executing fallback methods")
if (i == RETRY_COUNT) {
throw e
} else {
@ -194,12 +238,16 @@ class ThreeDotMenuMainRobot {
fun verifyTrackersBlockedByUblock() {
assertUIObjectExists(itemWithResId("$packageName:id/badge_text"))
assertTrue(itemWithResId("$packageName:id/badge_text").text.toInt() > 0)
Log.i(TAG, "verifyTrackersBlockedByUblock: Trying to verify that the count of trackers blocked is greater than 0")
assertTrue("$TAG: The count of trackers blocked is not greater than 0", itemWithResId("$packageName:id/badge_text").text.toInt() > 0)
Log.i(TAG, "verifyTrackersBlockedByUblock: Verified that the count of trackers blocked is greater than 0")
}
fun clickQuit() {
expandMenu()
Log.i(TAG, "clickQuit: Trying to click the \"Quit\" button")
onView(withText("Quit")).click()
Log.i(TAG, "clickQuit: Clicked the \"Quit\" button")
}
class Transition {
@ -210,41 +258,53 @@ class ThreeDotMenuMainRobot {
// We require one swipe to display the full size 3-dot menu. On smaller devices
// such as the Pixel 2, we require two swipes to display the "Settings" menu item
// at the bottom. On larger devices, the second swipe is a no-op.
Log.i(TAG, "openSettings: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "openSettings: Swiped up the main menu once")
Log.i(TAG, "openSettings: Performed swipe up action on the three dot menu")
Log.i(TAG, "openSettings: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "openSettings: Swiped up the main menu twice")
Log.i(TAG, "openSettings: Performed swipe up action on the three dot menu")
Log.i(TAG, "openSettings: Trying to click the $localizedText button")
settingsButton(localizedText).click()
Log.i(TAG, "openSettings: Clicked main menu $localizedText button")
Log.i(TAG, "openSettings: Clicked the $localizedText button")
SettingsRobot().interact()
return SettingsRobot.Transition()
}
fun openDownloadsManager(interact: DownloadRobot.() -> Unit): DownloadRobot.Transition {
Log.i(TAG, "openDownloadsManager: Trying to perform swipe down action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeDown())
Log.i(TAG, "openDownloadsManager: Swiped up main menu")
Log.i(TAG, "openDownloadsManager: Performed swipe down action on the three dot menu")
Log.i(TAG, "openDownloadsManager: Trying to click the \"DOWNLOADS\" button")
downloadsButton().click()
Log.i(TAG, "openDownloadsManager: Clicked main menu \"DOWNLOADS\" button")
Log.i(TAG, "openDownloadsManager: Clicked the \"DOWNLOADS\" button")
DownloadRobot().interact()
return DownloadRobot.Transition()
}
fun openSyncSignIn(interact: SyncSignInRobot.() -> Unit): SyncSignInRobot.Transition {
Log.i(TAG, "openSyncSignIn: Trying to perform swipe down action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeDown())
Log.i(TAG, "openSyncSignIn: Performed swipe down action on the three dot menu")
mDevice.waitNotNull(Until.findObject(By.text("Sync and save data")), waitingTime)
Log.i(TAG, "openSyncSignIn: Trying to click the \"Sync and save data\" button")
syncAndSaveDataButton().click()
Log.i(TAG, "openSyncSignIn: Clicked the \"Sync and save data\" button")
SyncSignInRobot().interact()
return SyncSignInRobot.Transition()
}
fun openBookmarks(interact: BookmarksRobot.() -> Unit): BookmarksRobot.Transition {
Log.i(TAG, "openBookmarks: Trying to perform swipe down action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeDown())
Log.i(TAG, "openBookmarks: Performed swipe down action on the three dot menu")
mDevice.waitNotNull(Until.findObject(By.text("Bookmarks")), waitingTime)
Log.i(TAG, "openBookmarks: Trying to click the \"Bookmarks\" button")
bookmarksButton().click()
Log.i(TAG, "openBookmarks: Clicked the \"Bookmarks\" button")
assertUIObjectExists(itemWithResId("$packageName:id/bookmark_list"))
BookmarksRobot().interact()
@ -252,16 +312,22 @@ class ThreeDotMenuMainRobot {
}
fun clickNewTabButton(interact: SearchRobot.() -> Unit): SearchRobot.Transition {
Log.i(TAG, "clickNewTabButton: Trying to click the \"New tab\" button")
normalBrowsingNewTabButton().click()
Log.i(TAG, "clickNewTabButton: Clicked the \"New tab\" button")
SearchRobot().interact()
return SearchRobot.Transition()
}
fun openHistory(interact: HistoryRobot.() -> Unit): HistoryRobot.Transition {
Log.i(TAG, "openHistory: Trying to perform swipe down action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeDown())
Log.i(TAG, "openHistory: Performed swipe down action on the three dot menu")
mDevice.waitNotNull(Until.findObject(By.text("History")), waitingTime)
Log.i(TAG, "openHistory: Trying to click the \"History\" button")
historyButton().click()
Log.i(TAG, "openHistory: Clicked the \"History\" button")
HistoryRobot().interact()
return HistoryRobot.Transition()
@ -269,7 +335,9 @@ class ThreeDotMenuMainRobot {
fun bookmarkPage(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
mDevice.waitNotNull(Until.findObject(By.text("Bookmarks")), waitingTime)
Log.i(TAG, "bookmarkPage: Trying to click the \"Add\" button")
addBookmarkButton().click()
Log.i(TAG, "bookmarkPage: Clicked the \"Add\" button")
BrowserRobot().interact()
return BrowserRobot.Transition()
@ -277,7 +345,9 @@ class ThreeDotMenuMainRobot {
fun editBookmarkPage(interact: BookmarksRobot.() -> Unit): BookmarksRobot.Transition {
mDevice.waitNotNull(Until.findObject(By.text("Bookmarks")), waitingTime)
Log.i(TAG, "editBookmarkPage: Trying to click the \"Edit\" button")
editBookmarkButton().click()
Log.i(TAG, "editBookmarkPage: Clicked the \"Edit\" button")
BookmarksRobot().interact()
return BookmarksRobot.Transition()
@ -285,13 +355,16 @@ class ThreeDotMenuMainRobot {
fun openHelp(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
mDevice.waitNotNull(Until.findObject(By.text("Help")), waitingTime)
Log.i(TAG, "openHelp: Trying to click the \"Help\" button")
helpButton().click()
Log.i(TAG, "openHelp: Clicked the \"Help\" button")
BrowserRobot().interact()
return BrowserRobot.Transition()
}
fun openCustomizeHome(interact: SettingsSubMenuHomepageRobot.() -> Unit): SettingsSubMenuHomepageRobot.Transition {
Log.i(TAG, "openCustomizeHome: Waiting for $waitingTime ms until finding the \"Customize homepage\" button")
mDevice.wait(
Until
.findObject(
@ -299,34 +372,42 @@ class ThreeDotMenuMainRobot {
),
waitingTime,
)
Log.i(TAG, "openCustomizeHome: Waited for $waitingTime ms until the \"Customize homepage\" button was found")
Log.i(TAG, "openCustomizeHome: Trying to click the \"Customize homepage\" button")
customizeHomeButton().click()
Log.i(TAG, "openCustomizeHome: Clicked the \"Customize homepage\" button")
Log.i(TAG, "openCustomizeHome: Waiting for $waitingTime ms for \"Customize homepage\" settings menu to exist")
mDevice.findObject(
UiSelector().resourceId("$packageName:id/recycler_view"),
).waitForExists(waitingTime)
Log.i(TAG, "openCustomizeHome: Waited for $waitingTime ms for \"Customize homepage\" settings menu to exist")
SettingsSubMenuHomepageRobot().interact()
return SettingsSubMenuHomepageRobot.Transition()
}
fun goForward(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
Log.i(TAG, "goForward: Trying to click the \"Forward\" button")
forwardButton().click()
Log.i(TAG, "goForward: Clicked the \"Forward\" button")
BrowserRobot().interact()
return BrowserRobot.Transition()
}
fun goToPreviousPage(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
Log.i(TAG, "goToPreviousPage: Trying to click the \"Back\" button")
backButton().click()
Log.i(TAG, "goToPreviousPage: Clicked the \"Back\" button")
BrowserRobot().interact()
return BrowserRobot.Transition()
}
fun clickShareButton(interact: ShareOverlayRobot.() -> Unit): ShareOverlayRobot.Transition {
Log.i(TAG, "clickShareButton: Trying to click the \"Share\" button")
shareButton().click()
Log.i(TAG, "clickShareButton: Clicked main menu share button")
Log.i(TAG, "clickShareButton: Clicked the \"Share\" button")
mDevice.waitNotNull(Until.findObject(By.text("ALL ACTIONS")), waitingTime)
ShareOverlayRobot().interact()
@ -334,8 +415,10 @@ class ThreeDotMenuMainRobot {
}
fun closeBrowserMenuToBrowser(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
Log.i(TAG, "closeBrowserMenuToBrowser: Trying to click device back button")
// Close three dot
mDevice.pressBack()
Log.i(TAG, "closeBrowserMenuToBrowser: Clicked the device back button")
BrowserRobot().interact()
return BrowserRobot.Transition()
@ -343,10 +426,12 @@ class ThreeDotMenuMainRobot {
fun refreshPage(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
refreshButton().also {
Log.i(TAG, "refreshPage: Looking for refresh button")
Log.i(TAG, "refreshPage: Waiting for $waitingTime ms for the \"Refresh\" button to exist")
it.waitForExists(waitingTime)
Log.i(TAG, "refreshPage: Waited for $waitingTime ms for the \"Refresh\" button to exist")
Log.i(TAG, "refreshPage: Trying to click the \"Refresh\" button")
it.click()
Log.i(TAG, "refreshPage: Clicked the refresh button")
Log.i(TAG, "refreshPage: Clicked the \"Refresh\" button")
}
BrowserRobot().interact()
@ -354,34 +439,50 @@ class ThreeDotMenuMainRobot {
}
fun forceRefreshPage(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
Log.i(TAG, "forceRefreshPage: Trying to long click the \"Refresh\" button")
mDevice.findObject(By.desc(getStringResource(R.string.browser_menu_refresh)))
.click(LONG_CLICK_DURATION)
Log.i(TAG, "forceRefreshPage: Long clicked the \"Refresh\" button")
BrowserRobot().interact()
return BrowserRobot.Transition()
}
fun closeAllTabs(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
Log.i(TAG, "closeAllTabs: Trying to click the \"Close all tabs\" button")
closeAllTabsButton().click()
Log.i(TAG, "closeAllTabs: Clicked the \"Close all tabs\" button")
HomeScreenRobot().interact()
return HomeScreenRobot.Transition()
}
fun openReportSiteIssue(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
Log.i(TAG, "openReportSiteIssue: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "openReportSiteIssue: Performed swipe up action on the three dot menu")
Log.i(TAG, "openReportSiteIssue: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "openReportSiteIssue: Performed swipe up action on the three dot menu")
Log.i(TAG, "openReportSiteIssue: Trying to click the \"Report Site Issue\" button")
reportSiteIssueButton().click()
Log.i(TAG, "openReportSiteIssue: Clicked the \"Report Site Issue\" button")
BrowserRobot().interact()
return BrowserRobot.Transition()
}
fun openFindInPage(interact: FindInPageRobot.() -> Unit): FindInPageRobot.Transition {
Log.i(TAG, "openFindInPage: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "openFindInPage: Performed swipe up action on the three dot menu")
Log.i(TAG, "openFindInPage: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "openFindInPage: Performed swipe up action on the three dot menu")
mDevice.waitNotNull(Until.findObject(By.text("Find in page")), waitingTime)
Log.i(TAG, "openFindInPage: Trying to click the \"Find in page\" button")
findInPageButton().click()
Log.i(TAG, "openFindInPage: Clicked the \"Find in page\" button")
FindInPageRobot().interact()
return FindInPageRobot.Transition()
@ -389,16 +490,24 @@ class ThreeDotMenuMainRobot {
fun openWhatsNew(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
mDevice.waitNotNull(Until.findObject(By.text("Whats new")), waitingTime)
Log.i(TAG, "openWhatsNew: Trying to click the \"Whats new\" button")
whatsNewButton().click()
Log.i(TAG, "openWhatsNew: Clicked the \"Whats new\" button")
BrowserRobot().interact()
return BrowserRobot.Transition()
}
fun openReaderViewAppearance(interact: ReaderViewRobot.() -> Unit): ReaderViewRobot.Transition {
Log.i(TAG, "openReaderViewAppearance: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "openReaderViewAppearance: Performed swipe up action on the three dot menu")
Log.i(TAG, "openReaderViewAppearance: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "openReaderViewAppearance: Performed swipe up action on the three dot menu")
Log.i(TAG, "openReaderViewAppearance: Trying to click the \"Customize reader view\" button")
readerViewAppearanceToggle().click()
Log.i(TAG, "openReaderViewAppearance: Clicked the \"Customize reader view\" button")
ReaderViewRobot().interact()
return ReaderViewRobot.Transition()
@ -406,18 +515,26 @@ class ThreeDotMenuMainRobot {
fun addToFirefoxHome(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
for (i in 1..RETRY_COUNT) {
Log.i(TAG, "addToFirefoxHome: Started try #$i")
try {
addToShortcutsButton().also {
Log.i(TAG, "addToFirefoxHome: Waiting for $waitingTime ms for the \"Add to shortcuts\" button to exist")
it.waitForExists(waitingTime)
Log.i(TAG, "addToFirefoxHome: Waited for $waitingTime ms for the \"Add to shortcuts\" button to exist")
Log.i(TAG, "addToFirefoxHome: Trying to click the \"Add to shortcuts\" button")
it.click()
Log.i(TAG, "addToFirefoxHome: Clicked the \"Add to shortcuts\" button")
}
break
} catch (e: UiObjectNotFoundException) {
Log.i(TAG, "addToFirefoxHome: UiObjectNotFoundException caught, executing fallback methods")
if (i == RETRY_COUNT) {
throw e
} else {
Log.i(TAG, "addToFirefoxHome: Trying to click the device back button")
mDevice.pressBack()
Log.i(TAG, "addToFirefoxHome: Clicked the device back button")
navigationToolbar {
}.openThreeDotMenu {
expandMenu()
@ -431,23 +548,33 @@ class ThreeDotMenuMainRobot {
}
fun clickRemoveFromShortcuts(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
Log.i(TAG, "clickRemoveFromShortcuts: Trying to click the \"Remove from shortcuts\" button")
removeFromShortcutsButton().click()
Log.i(TAG, "clickRemoveFromShortcuts: Clicked the \"Remove from shortcuts\" button")
BrowserRobot().interact()
return BrowserRobot.Transition()
}
fun openAddToHomeScreen(interact: AddToHomeScreenRobot.() -> Unit): AddToHomeScreenRobot.Transition {
Log.i(TAG, "openAddToHomeScreen: Trying to click the \"Add to Home screen\" button and wait for $waitingTime ms for a new window")
addToHomeScreenButton().clickAndWaitForNewWindow(waitingTime)
Log.i(TAG, "openAddToHomeScreen: Clicked the \"Add to Home screen\" button and waited for $waitingTime ms for a new window")
AddToHomeScreenRobot().interact()
return AddToHomeScreenRobot.Transition()
}
fun clickInstall(interact: AddToHomeScreenRobot.() -> Unit): AddToHomeScreenRobot.Transition {
Log.i(TAG, "clickInstall: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "clickInstall: Performed swipe up action on the three dot menu")
Log.i(TAG, "clickInstall: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "clickInstall: Performed swipe up action on the three dot menu")
Log.i(TAG, "clickInstall: Trying to click the \"Install\" button")
installPWAButton().click()
Log.i(TAG, "clickInstall: Clicked the \"Install\" button")
AddToHomeScreenRobot().interact()
return AddToHomeScreenRobot.Transition()
@ -455,56 +582,87 @@ class ThreeDotMenuMainRobot {
fun openSaveToCollection(interact: CollectionRobot.() -> Unit): CollectionRobot.Transition {
// Ensure the menu is expanded and fully scrolled to the bottom.
Log.i(TAG, "openSaveToCollection: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "openSaveToCollection: Performed swipe up action on the three dot menu")
Log.i(TAG, "openSaveToCollection: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "openSaveToCollection: Performed swipe up action on the three dot menu")
mDevice.waitNotNull(Until.findObject(By.text("Save to collection")), waitingTime)
Log.i(TAG, "openSaveToCollection: Trying to click the \"Save to collection\" button")
saveToCollectionButton().click()
Log.i(TAG, "openSaveToCollection: Clicked the \"Save to collection\" button")
CollectionRobot().interact()
return CollectionRobot.Transition()
}
fun openAddonsManagerMenu(interact: SettingsSubMenuAddonsManagerRobot.() -> Unit): SettingsSubMenuAddonsManagerRobot.Transition {
clickAddonsManagerButton()
Log.i(TAG, "openAddonsManagerMenu: Waiting for $waitingTimeLong ms for the addons list to exist")
mDevice.findObject(UiSelector().resourceId("$packageName:id/add_ons_list"))
.waitForExists(waitingTimeLong)
Log.i(TAG, "openAddonsManagerMenu: Waited for $waitingTimeLong ms for the addons list to exist")
SettingsSubMenuAddonsManagerRobot().interact()
return SettingsSubMenuAddonsManagerRobot.Transition()
}
fun clickOpenInApp(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
Log.i(TAG, "clickOpenInApp: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "clickOpenInApp: Performed swipe up action on the three dot menu")
Log.i(TAG, "clickOpenInApp: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "clickOpenInApp: Performed swipe up action on the three dot menu")
Log.i(TAG, "clickOpenInApp: Trying to click the \"Open in app\" button")
openInAppButton().click()
Log.i(TAG, "clickOpenInApp: Clicked the \"Open in app\" button")
Log.i(TAG, "clickOpenInApp: Waiting for device to be idle")
mDevice.waitForIdle()
Log.i(TAG, "clickOpenInApp: Waited for device to be idle")
BrowserRobot().interact()
return BrowserRobot.Transition()
}
fun switchDesktopSiteMode(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
Log.i(TAG, "switchDesktopSiteMode: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "switchDesktopSiteMode: Performed swipe up action on the three dot menu")
Log.i(TAG, "switchDesktopSiteMode: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "switchDesktopSiteMode: Performed swipe up action on the three dot menu")
Log.i(TAG, "switchDesktopSiteMode: Trying to click the \"Desktop site\" button")
desktopSiteButton().click()
Log.i(TAG, "switchDesktopSiteMode: Clicked the \"Desktop site\" button")
BrowserRobot().interact()
return BrowserRobot.Transition()
}
fun clickShareAllTabsButton(interact: ShareOverlayRobot.() -> Unit): ShareOverlayRobot.Transition {
Log.i(TAG, "clickShareAllTabsButton: Trying to click the \"Share all tabs\" button")
shareAllTabsButton().click()
Log.i(TAG, "clickShareAllTabsButton: Clicked the \"Share all tabs\" button")
ShareOverlayRobot().interact()
return ShareOverlayRobot.Transition()
}
fun clickPrintButton(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
Log.i(TAG, "clickPrintButton: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "clickPrintButton: Performed swipe up action on the three dot menu")
Log.i(TAG, "clickPrintButton: Trying to perform swipe up action on the three dot menu")
threeDotMenuRecyclerView().perform(swipeUp())
Log.i(TAG, "clickPrintButton: Performed swipe up action on the three dot menu")
Log.i(TAG, "clickPrintButton: Waiting for $waitingTime ms for the \"Print\" button to exist")
printButton().waitForExists(waitingTime)
Log.i(TAG, "clickPrintButton: Waited for $waitingTime ms for the \"Print\" button to exist")
Log.i(TAG, "clickPrintButton: Trying to click the \"Print\" button")
printButton().click()
Log.i(TAG, "clickPrintButton: Clicked the \"Print\" button")
BrowserRobot().interact()
return BrowserRobot.Transition()
@ -541,8 +699,12 @@ private fun openInAppButton() =
)
private fun clickAddonsManagerButton() {
Log.i(TAG, "clickAddonsManagerButton: Trying to perform swipe down action on the three dot menu")
onView(withId(R.id.mozac_browser_menu_menuView)).perform(swipeDown())
Log.i(TAG, "clickAddonsManagerButton: Performed swipe down action on the three dot menu")
Log.i(TAG, "clickAddonsManagerButton: Trying to click the \"Add-ons\" button")
addOnsButton().click()
Log.i(TAG, "clickAddonsManagerButton: Clicked the \"Add-ons\" button")
}
private fun shareAllTabsButton() =

Loading…
Cancel
Save