2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

Fix BrowserRobot.goToHomescreen to wait for home screen to be rendered

It was previously just waiting for the application to be idle, which
is not a reliable check in case the navigation to home is triggered
on completion of an async operation i.e., the app / main thread may
be idle, but the navigation to home hasn't completed yet.

goToHomeScreen further needs to wait for the browser fragment's
home button to exist before clicking it.
This commit is contained in:
Christian Sadilek 2021-11-30 15:47:18 -05:00 committed by mergify[bot]
parent 84c6f88154
commit 28222df29c

View File

@ -605,10 +605,19 @@ class BrowserRobot {
} }
fun goToHomescreen(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition { fun goToHomescreen(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
assertTrue(
mDevice.findObject(UiSelector().description("Home screen"))
.waitForExists(waitingTime)
)
onView(withContentDescription("Home screen")) onView(withContentDescription("Home screen"))
.check(matches(isDisplayed())) .check(matches(isDisplayed()))
.click() .click()
mDevice.waitForIdle()
assertTrue(
mDevice.findObject(UiSelector().resourceId("$packageName:id/homeLayout"))
.waitForExists(waitingTime)
)
HomeScreenRobot().interact() HomeScreenRobot().interact()
return HomeScreenRobot.Transition() return HomeScreenRobot.Transition()