[fenix] 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.
pull/600/head
Christian Sadilek 3 years ago committed by mergify[bot]
parent 3efc227bb7
commit 57f46aa08e

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

Loading…
Cancel
Save