Bug 1879886 - Add test logs to NavigationToolbarRobot

fenix/124.1.0
AndiAJ 4 months ago committed by mergify[bot]
parent 611c39e09c
commit c3da54cfba

@ -31,7 +31,6 @@ import androidx.test.uiautomator.By.textContains
import androidx.test.uiautomator.UiSelector import androidx.test.uiautomator.UiSelector
import androidx.test.uiautomator.Until import androidx.test.uiautomator.Until
import org.hamcrest.CoreMatchers.allOf import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.CoreMatchers.not
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 import org.mozilla.fenix.helpers.Constants
@ -58,23 +57,29 @@ import org.mozilla.fenix.tabstray.TabsTrayTestTag
* Implementation of Robot Pattern for the URL toolbar. * Implementation of Robot Pattern for the URL toolbar.
*/ */
class NavigationToolbarRobot { class NavigationToolbarRobot {
fun verifyUrl(url: String) = fun verifyUrl(url: String) {
Log.i(TAG, "verifyUrl: Trying to verify toolbar text matches $url")
onView(withId(R.id.mozac_browser_toolbar_url_view)).check(matches(withText(url))) onView(withId(R.id.mozac_browser_toolbar_url_view)).check(matches(withText(url)))
Log.i(TAG, "verifyUrl: Verified toolbar text matches $url")
}
fun verifyTabButtonShortcutMenuItems() { fun verifyTabButtonShortcutMenuItems() {
Log.i(TAG, "verifyTabButtonShortcutMenuItems: Trying to verify tab counter shortcut options")
onView(withId(R.id.mozac_browser_menu_recyclerView)) onView(withId(R.id.mozac_browser_menu_recyclerView))
.check(matches(hasDescendant(withText("Close tab")))) .check(matches(hasDescendant(withText("Close tab"))))
.check(matches(hasDescendant(withText("New private tab")))) .check(matches(hasDescendant(withText("New private tab"))))
.check(matches(hasDescendant(withText("New tab")))) .check(matches(hasDescendant(withText("New tab"))))
Log.i(TAG, "verifyTabButtonShortcutMenuItems: Verified tab counter shortcut options")
} }
fun verifyReaderViewDetected(visible: Boolean = false) { fun verifyReaderViewDetected(visible: Boolean = false) {
Log.i(TAG, "verifyReaderViewDetected: Waiting for $waitingTime ms for reader view button to exist")
mDevice.findObject( mDevice.findObject(
UiSelector() UiSelector()
.description("Reader view"), .description("Reader view"),
) ).waitForExists(waitingTime)
.waitForExists(waitingTime) Log.i(TAG, "verifyReaderViewDetected: Waited for $waitingTime ms for reader view button to exist")
Log.i(TAG, "verifyReaderViewDetected: Trying to verify that the reader view button is visible")
onView( onView(
allOf( allOf(
withParent(withId(R.id.mozac_browser_toolbar_page_actions)), withParent(withId(R.id.mozac_browser_toolbar_page_actions)),
@ -87,16 +92,20 @@ class NavigationToolbarRobot {
ViewAssertions.doesNotExist() ViewAssertions.doesNotExist()
}, },
) )
Log.i(TAG, "verifyReaderViewDetected: Verified that the reader view button is visible")
} }
fun toggleReaderView() { fun toggleReaderView() {
Log.i(TAG, "toggleReaderView: Waiting for $waitingTime ms for reader view button to exist")
mDevice.findObject( mDevice.findObject(
UiSelector() UiSelector()
.resourceId("$packageName:id/mozac_browser_toolbar_page_actions"), .resourceId("$packageName:id/mozac_browser_toolbar_page_actions"),
) )
.waitForExists(waitingTime) .waitForExists(waitingTime)
Log.i(TAG, "toggleReaderView: Waited for $waitingTime ms for reader view button to exist")
Log.i(TAG, "toggleReaderView: Trying to click the reader view button")
readerViewToggle().click() readerViewToggle().click()
Log.i(TAG, "toggleReaderView: Clicked the reader view button")
} }
fun verifyClipboardSuggestionsAreDisplayed(link: String = "", shouldBeDisplayed: Boolean) = fun verifyClipboardSuggestionsAreDisplayed(link: String = "", shouldBeDisplayed: Boolean) =
@ -109,28 +118,42 @@ class NavigationToolbarRobot {
exists = shouldBeDisplayed, exists = shouldBeDisplayed,
) )
fun longClickEditModeToolbar() = fun longClickEditModeToolbar() {
mDevice.findObject(By.res("$packageName:id/mozac_browser_toolbar_edit_url_view")).click(LONG_CLICK_DURATION) Log.i(TAG, "longClickEditModeToolbar: Trying to long click the edit mode toolbar")
mDevice.findObject(By.res("$packageName:id/mozac_browser_toolbar_edit_url_view"))
.click(LONG_CLICK_DURATION)
Log.i(TAG, "longClickEditModeToolbar: Long clicked the edit mode toolbar")
}
fun clickContextMenuItem(item: String) { fun clickContextMenuItem(item: String) {
mDevice.waitNotNull( mDevice.waitNotNull(
Until.findObject(By.text(item)), Until.findObject(By.text(item)),
waitingTime, waitingTime,
) )
Log.i(TAG, "clickContextMenuItem: Trying click context menu item: $item")
mDevice.findObject(By.text(item)).click() mDevice.findObject(By.text(item)).click()
Log.i(TAG, "clickContextMenuItem: Clicked context menu item: $item")
} }
fun clickClearToolbarButton() = clearAddressBarButton().click() fun clickClearToolbarButton() {
Log.i(TAG, "clickClearToolbarButton: Trying click the clear address button")
clearAddressBarButton().click()
Log.i(TAG, "clickClearToolbarButton: Clicked the clear address button")
}
fun verifyToolbarIsEmpty() = fun verifyToolbarIsEmpty() =
itemWithResIdContainingText( assertUIObjectExists(
"$packageName:id/mozac_browser_toolbar_edit_url_view", itemWithResIdContainingText(
getStringResource(R.string.search_hint), "$packageName:id/mozac_browser_toolbar_edit_url_view",
getStringResource(R.string.search_hint),
),
) )
// New unified search UI selector // New unified search UI selector
fun verifySearchBarPlaceholder(text: String) { fun verifySearchBarPlaceholder(text: String) {
Log.i(TAG, "verifySearchBarPlaceholder: Waiting for $waitingTime ms for the toolbar to exist")
urlBar().waitForExists(waitingTime) urlBar().waitForExists(waitingTime)
Log.i(TAG, "verifySearchBarPlaceholder: Waited for $waitingTime ms for the toolbar to exist")
assertItemTextEquals(urlBar(), expectedText = text) assertItemTextEquals(urlBar(), expectedText = text)
} }
@ -156,19 +179,21 @@ class NavigationToolbarRobot {
sessionLoadedIdlingResource = SessionLoadedIdlingResource() sessionLoadedIdlingResource = SessionLoadedIdlingResource()
openEditURLView() openEditURLView()
Log.i(TAG, "enterURLAndEnterToBrowser: Opened edit mode URL view") Log.i(TAG, "enterURLAndEnterToBrowser: Trying to set toolbar text to: $url")
awesomeBar().setText(url.toString()) awesomeBar().setText(url.toString())
Log.i(TAG, "enterURLAndEnterToBrowser: Set toolbar text to: $url") Log.i(TAG, "enterURLAndEnterToBrowser: Toolbar text was set to: $url")
Log.i(TAG, "enterURLAndEnterToBrowser: Trying to press device enter button")
mDevice.pressEnter() mDevice.pressEnter()
Log.i(TAG, "enterURLAndEnterToBrowser: Clicked enter on keyboard, submitted query") Log.i(TAG, "enterURLAndEnterToBrowser: Pressed device enter button")
runWithIdleRes(sessionLoadedIdlingResource) { runWithIdleRes(sessionLoadedIdlingResource) {
Log.i(TAG, "enterURLAndEnterToBrowser: Trying to assert that home screen layout or download button or the total cookie protection contextual hint exist")
assertTrue( assertTrue(
itemWithResId("$packageName:id/browserLayout").waitForExists(waitingTime) || itemWithResId("$packageName:id/browserLayout").waitForExists(waitingTime) ||
itemWithResId("$packageName:id/download_button").waitForExists(waitingTime) || itemWithResId("$packageName:id/download_button").waitForExists(waitingTime) ||
itemWithResId("cfr.dismiss").waitForExists(waitingTime), itemWithResId("cfr.dismiss").waitForExists(waitingTime),
) )
Log.i(TAG, "enterURLAndEnterToBrowser: Asserted that home screen layout or download button or the total cookie protection contextual hint exist")
} }
BrowserRobot().interact() BrowserRobot().interact()
@ -180,9 +205,12 @@ class NavigationToolbarRobot {
interact: BrowserRobot.() -> Unit, interact: BrowserRobot.() -> Unit,
): BrowserRobot.Transition { ): BrowserRobot.Transition {
openEditURLView() openEditURLView()
Log.i(TAG, "enterURLAndEnterToBrowserForTCPCFR: Trying to set toolbar text to: $url")
awesomeBar().setText(url.toString()) awesomeBar().setText(url.toString())
Log.i(TAG, "enterURLAndEnterToBrowserForTCPCFR: Toolbar text was set to: $url")
Log.i(TAG, "enterURLAndEnterToBrowserForTCPCFR: Trying to press device enter button")
mDevice.pressEnter() mDevice.pressEnter()
Log.i(TAG, "enterURLAndEnterToBrowserForTCPCFR: Pressed device enter button")
BrowserRobot().interact() BrowserRobot().interact()
return BrowserRobot.Transition() return BrowserRobot.Transition()
@ -194,12 +222,17 @@ class NavigationToolbarRobot {
sessionLoadedIdlingResource = SessionLoadedIdlingResource() sessionLoadedIdlingResource = SessionLoadedIdlingResource()
openEditURLView() openEditURLView()
Log.i(TAG, "openTabCrashReporter: Trying to set toolbar text to: $crashUrl")
awesomeBar().setText(crashUrl) awesomeBar().setText(crashUrl)
Log.i(TAG, "openTabCrashReporter: Toolbar text was set to: $crashUrl")
Log.i(TAG, "openTabCrashReporter: Trying to press device enter button")
mDevice.pressEnter() mDevice.pressEnter()
Log.i(TAG, "openTabCrashReporter: Pressed device enter button")
runWithIdleRes(sessionLoadedIdlingResource) { runWithIdleRes(sessionLoadedIdlingResource) {
Log.i(TAG, "openTabCrashReporter: Trying to find the tab crasher image")
mDevice.findObject(UiSelector().resourceId("$packageName:id/crash_tab_image")) mDevice.findObject(UiSelector().resourceId("$packageName:id/crash_tab_image"))
Log.i(TAG, "openTabCrashReporter: Found the tab crasher image")
} }
BrowserRobot().interact() BrowserRobot().interact()
@ -208,15 +241,21 @@ class NavigationToolbarRobot {
fun openThreeDotMenu(interact: ThreeDotMenuMainRobot.() -> Unit): ThreeDotMenuMainRobot.Transition { fun openThreeDotMenu(interact: ThreeDotMenuMainRobot.() -> Unit): ThreeDotMenuMainRobot.Transition {
mDevice.waitNotNull(Until.findObject(By.res("$packageName:id/mozac_browser_toolbar_menu")), waitingTime) mDevice.waitNotNull(Until.findObject(By.res("$packageName:id/mozac_browser_toolbar_menu")), waitingTime)
Log.i(TAG, "openThreeDotMenu: Trying to click the main menu button")
threeDotButton().click() threeDotButton().click()
Log.i(TAG, "openThreeDotMenu: Clicked the main menu button")
ThreeDotMenuMainRobot().interact() ThreeDotMenuMainRobot().interact()
return ThreeDotMenuMainRobot.Transition() return ThreeDotMenuMainRobot.Transition()
} }
fun openTabTray(interact: TabDrawerRobot.() -> Unit): TabDrawerRobot.Transition { fun openTabTray(interact: TabDrawerRobot.() -> Unit): TabDrawerRobot.Transition {
Log.i(TAG, "openTabTray: Waiting for device to be idle for $waitingTime ms")
mDevice.waitForIdle(waitingTime) mDevice.waitForIdle(waitingTime)
Log.i(TAG, "openTabTray: Waited for device to be idle for $waitingTime ms")
Log.i(TAG, "openTabTray: Trying to click the tabs tray button")
tabTrayButton().click() tabTrayButton().click()
Log.i(TAG, "openTabTray: Clicked the tabs tray button")
mDevice.waitNotNull( mDevice.waitNotNull(
Until.findObject(By.res("$packageName:id/tab_layout")), Until.findObject(By.res("$packageName:id/tab_layout")),
waitingTime, waitingTime,
@ -229,6 +268,7 @@ class NavigationToolbarRobot {
fun openComposeTabDrawer(composeTestRule: HomeActivityComposeTestRule, interact: ComposeTabDrawerRobot.() -> Unit): ComposeTabDrawerRobot.Transition { fun openComposeTabDrawer(composeTestRule: HomeActivityComposeTestRule, interact: ComposeTabDrawerRobot.() -> Unit): ComposeTabDrawerRobot.Transition {
for (i in 1..Constants.RETRY_COUNT) { for (i in 1..Constants.RETRY_COUNT) {
try { try {
Log.i(TAG, "openComposeTabDrawer: Started try #$i")
mDevice.waitForObjects( mDevice.waitForObjects(
mDevice.findObject( mDevice.findObject(
UiSelector() UiSelector()
@ -236,30 +276,40 @@ class NavigationToolbarRobot {
), ),
waitingTime, waitingTime,
) )
Log.i(TAG, "openComposeTabDrawer: Trying to click the tabs tray button")
tabTrayButton().click() tabTrayButton().click()
Log.i(TAG, "openComposeTabDrawer: Clicked the tabs tray button")
Log.i(TAG, "openComposeTabDrawer: Trying to verify that the tabs tray exists")
composeTestRule.onNodeWithTag(TabsTrayTestTag.tabsTray).assertExists() composeTestRule.onNodeWithTag(TabsTrayTestTag.tabsTray).assertExists()
Log.i(TAG, "openComposeTabDrawer: Verified that the tabs tray exists")
break break
} catch (e: AssertionError) { } catch (e: AssertionError) {
Log.i(TAG, "openComposeTabDrawer: AssertionError caught, executing fallback methods")
if (i == Constants.RETRY_COUNT) { if (i == Constants.RETRY_COUNT) {
throw e throw e
} else { } else {
Log.i(TAG, "openComposeTabDrawer: Waiting for device to be idle")
mDevice.waitForIdle() mDevice.waitForIdle()
Log.i(TAG, "openComposeTabDrawer: Waited for device to be idle")
} }
} }
} }
Log.i(TAG, "openComposeTabDrawer: Trying to verify the tabs tray new tab FAB button exists")
composeTestRule.onNodeWithTag(TabsTrayTestTag.fab).assertExists() composeTestRule.onNodeWithTag(TabsTrayTestTag.fab).assertExists()
Log.i(TAG, "openComposeTabDrawer: Verified the tabs tray new tab FAB button exists")
ComposeTabDrawerRobot(composeTestRule).interact() ComposeTabDrawerRobot(composeTestRule).interact()
return ComposeTabDrawerRobot.Transition(composeTestRule) return ComposeTabDrawerRobot.Transition(composeTestRule)
} }
fun visitLinkFromClipboard(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { fun visitLinkFromClipboard(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
Log.i(TAG, "visitLinkFromClipboard: Waiting for $waitingTimeShort ms for clear address button to exist")
if (clearAddressBarButton().waitForExists(waitingTimeShort)) { if (clearAddressBarButton().waitForExists(waitingTimeShort)) {
Log.i(TAG, "visitLinkFromClipboard: Waited for $waitingTimeShort ms for clear address button to exist")
Log.i(TAG, "visitLinkFromClipboard: Trying to click the clear address button")
clearAddressBarButton().click() clearAddressBarButton().click()
Log.i(TAG, "visitLinkFromClipboard: Clicked the clear address button")
} }
mDevice.waitNotNull( mDevice.waitNotNull(
@ -275,26 +325,33 @@ class NavigationToolbarRobot {
waitingTime, waitingTime,
) )
} }
Log.i(TAG, "visitLinkFromClipboard: Trying to click the fill link from clipboard button")
fillLinkButton().click() fillLinkButton().click()
Log.i(TAG, "visitLinkFromClipboard: Clicked the fill link from clipboard button")
BrowserRobot().interact() BrowserRobot().interact()
return BrowserRobot.Transition() return BrowserRobot.Transition()
} }
fun goBackToHomeScreen(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition { fun goBackToHomeScreen(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
Log.i(TAG, "goBackToHomeScreen: Trying to click the device back button")
mDevice.pressBack() mDevice.pressBack()
Log.i(TAG, "goBackToHomeScreen: Clicked the device back button")
Log.i(TAG, "goBackToHomeScreen: Waiting for $waitingTimeShort ms for $packageName window to be updated")
mDevice.waitForWindowUpdate(packageName, waitingTimeShort) mDevice.waitForWindowUpdate(packageName, waitingTimeShort)
Log.i(TAG, "goBackToHomeScreen: Waited for $waitingTimeShort ms for $packageName window to be updated")
HomeScreenRobot().interact() HomeScreenRobot().interact()
return HomeScreenRobot.Transition() return HomeScreenRobot.Transition()
} }
fun goBackToBrowserScreen(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { fun goBackToBrowserScreen(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
Log.i(TAG, "goBackToBrowserScreen: Trying to click the device back button")
mDevice.pressBack() mDevice.pressBack()
Log.i(TAG, "goBackToBrowserScreen: Dismiss awesome bar using device back button") Log.i(TAG, "goBackToBrowserScreen: Clicked the device back button")
Log.i(TAG, "goBackToBrowserScreen: Waiting for $waitingTimeShort ms for $packageName window to be updated")
mDevice.waitForWindowUpdate(packageName, waitingTimeShort) mDevice.waitForWindowUpdate(packageName, waitingTimeShort)
Log.i(TAG, "goBackToBrowserScreen: Waited $waitingTimeShort for window update") Log.i(TAG, "goBackToBrowserScreen: Waited for $waitingTimeShort ms for $packageName window to be updated")
BrowserRobot().interact() BrowserRobot().interact()
return BrowserRobot.Transition() return BrowserRobot.Transition()
@ -302,16 +359,19 @@ class NavigationToolbarRobot {
fun openTabButtonShortcutsMenu(interact: NavigationToolbarRobot.() -> Unit): Transition { fun openTabButtonShortcutsMenu(interact: NavigationToolbarRobot.() -> Unit): Transition {
mDevice.waitNotNull(Until.findObject(By.res("$packageName:id/counter_root"))) mDevice.waitNotNull(Until.findObject(By.res("$packageName:id/counter_root")))
Log.i(TAG, "openTabButtonShortcutsMenu: Trying to long click the tab counter button")
tabsCounter().perform(longClick()) tabsCounter().perform(longClick())
Log.i(TAG, "Tabs counter long-click successful.") Log.i(TAG, "openTabButtonShortcutsMenu: Long clicked the tab counter button")
NavigationToolbarRobot().interact() NavigationToolbarRobot().interact()
return Transition() return Transition()
} }
fun closeTabFromShortcutsMenu(interact: NavigationToolbarRobot.() -> Unit): Transition { fun closeTabFromShortcutsMenu(interact: NavigationToolbarRobot.() -> Unit): Transition {
Log.i(TAG, "closeTabFromShortcutsMenu: Waiting for device to be idle for $waitingTime ms")
mDevice.waitForIdle(waitingTime) mDevice.waitForIdle(waitingTime)
Log.i(TAG, "closeTabFromShortcutsMenu: Waited for device to be idle for $waitingTime ms")
Log.i(TAG, "closeTabFromShortcutsMenu: Trying to click the \"Close tab\" button")
onView(withId(R.id.mozac_browser_menu_recyclerView)) onView(withId(R.id.mozac_browser_menu_recyclerView))
.perform( .perform(
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>( RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
@ -321,15 +381,17 @@ class NavigationToolbarRobot {
ViewActions.click(), ViewActions.click(),
), ),
) )
Log.i(TAG, "Clicked the tab shortcut Close tab button.") Log.i(TAG, "closeTabFromShortcutsMenu: Clicked the \"Close tab\" button")
NavigationToolbarRobot().interact() NavigationToolbarRobot().interact()
return Transition() return Transition()
} }
fun openNewTabFromShortcutsMenu(interact: SearchRobot.() -> Unit): SearchRobot.Transition { fun openNewTabFromShortcutsMenu(interact: SearchRobot.() -> Unit): SearchRobot.Transition {
Log.i(TAG, "openNewTabFromShortcutsMenu: Waiting for device to be idle for $waitingTime ms")
mDevice.waitForIdle(waitingTime) mDevice.waitForIdle(waitingTime)
Log.i(TAG, "Looking for tab shortcut New tab button.") Log.i(TAG, "openNewTabFromShortcutsMenu: Waited for device to be idle for $waitingTime ms")
Log.i(TAG, "openNewTabFromShortcutsMenu: Trying to click the \"New tab\" button")
onView(withId(R.id.mozac_browser_menu_recyclerView)) onView(withId(R.id.mozac_browser_menu_recyclerView))
.perform( .perform(
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>( RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
@ -339,15 +401,17 @@ class NavigationToolbarRobot {
ViewActions.click(), ViewActions.click(),
), ),
) )
Log.i(TAG, "Clicked the tab shortcut New tab button.") Log.i(TAG, "openNewTabFromShortcutsMenu: Clicked the \"New tab\" button")
SearchRobot().interact() SearchRobot().interact()
return SearchRobot.Transition() return SearchRobot.Transition()
} }
fun openNewPrivateTabFromShortcutsMenu(interact: SearchRobot.() -> Unit): SearchRobot.Transition { fun openNewPrivateTabFromShortcutsMenu(interact: SearchRobot.() -> Unit): SearchRobot.Transition {
Log.i(TAG, "openNewPrivateTabFromShortcutsMenu: Waiting for device to be idle for $waitingTime ms")
mDevice.waitForIdle(waitingTime) mDevice.waitForIdle(waitingTime)
Log.i(TAG, "Looking for tab shortcut New private tab button.") Log.i(TAG, "openNewPrivateTabFromShortcutsMenu: Waited for device to be idle for $waitingTime ms")
Log.i(TAG, "openNewPrivateTabFromShortcutsMenu: Trying to click the \"New private tab\" button")
onView(withId(R.id.mozac_browser_menu_recyclerView)) onView(withId(R.id.mozac_browser_menu_recyclerView))
.perform( .perform(
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>( RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
@ -357,26 +421,33 @@ class NavigationToolbarRobot {
ViewActions.click(), ViewActions.click(),
), ),
) )
Log.i(TAG, "Clicked the tab shortcut New private tab button.") Log.i(TAG, "openNewPrivateTabFromShortcutsMenu: Clicked the \"New private tab\" button")
SearchRobot().interact() SearchRobot().interact()
return SearchRobot.Transition() return SearchRobot.Transition()
} }
fun clickUrlbar(interact: SearchRobot.() -> Unit): SearchRobot.Transition { fun clickUrlbar(interact: SearchRobot.() -> Unit): SearchRobot.Transition {
Log.i(TAG, "clickUrlbar: Trying to click the toolbar")
urlBar().click() urlBar().click()
Log.i(TAG, "clickUrlbar: Clicked the toolbar")
Log.i(TAG, "clickUrlbar: Waiting for $waitingTime ms for the edit mode toolbar to exist")
mDevice.findObject( mDevice.findObject(
UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view"), UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view"),
).waitForExists(waitingTime) ).waitForExists(waitingTime)
Log.i(TAG, "clickUrlbar: Waited for $waitingTime ms for the edit mode toolbar to exist")
SearchRobot().interact() SearchRobot().interact()
return SearchRobot.Transition() return SearchRobot.Transition()
} }
fun clickSearchSelectorButton(interact: SearchRobot.() -> Unit): SearchRobot.Transition { fun clickSearchSelectorButton(interact: SearchRobot.() -> Unit): SearchRobot.Transition {
Log.i(TAG, "clickSearchSelectorButton: Waiting for $waitingTime ms for the search selector button to exist")
searchSelectorButton().waitForExists(waitingTime) searchSelectorButton().waitForExists(waitingTime)
Log.i(TAG, "clickSearchSelectorButton: Waited for $waitingTime ms for the search selector button to exist")
Log.i(TAG, "clickSearchSelectorButton: Trying to click the search selector button")
searchSelectorButton().click() searchSelectorButton().click()
Log.i(TAG, "clickSearchSelectorButton: Clicked the search selector button")
SearchRobot().interact() SearchRobot().interact()
return SearchRobot.Transition() return SearchRobot.Transition()
@ -390,11 +461,15 @@ fun navigationToolbar(interact: NavigationToolbarRobot.() -> Unit): NavigationTo
} }
fun openEditURLView() { fun openEditURLView() {
Log.i(TAG, "openEditURLView: Waiting for $waitingTime ms for the toolbar to exist")
urlBar().waitForExists(waitingTime) urlBar().waitForExists(waitingTime)
Log.i(TAG, "openEditURLView: Waited for $waitingTime ms for the toolbar to exist")
Log.i(TAG, "openEditURLView: Trying to click the toolbar")
urlBar().click() urlBar().click()
Log.i(TAG, "openEditURLView: URL bar clicked.") Log.i(TAG, "openEditURLView: Clicked the toolbar")
Log.i(TAG, "openEditURLView: Waiting for $waitingTime ms for the edit mode toolbar to exist")
itemWithResId("$packageName:id/mozac_browser_toolbar_edit_url_view").waitForExists(waitingTime) itemWithResId("$packageName:id/mozac_browser_toolbar_edit_url_view").waitForExists(waitingTime)
Log.i(TAG, "openEditURLView: Edit URL bar displayed.") Log.i(TAG, "openEditURLView: Waited for $waitingTime ms for the edit mode toolbar to exist")
} }
private fun urlBar() = mDevice.findObject(UiSelector().resourceId("$packageName:id/toolbar")) private fun urlBar() = mDevice.findObject(UiSelector().resourceId("$packageName:id/toolbar"))

Loading…
Cancel
Save