I have the following piece of code which is:
- click a toggle from Firefox app
- the toggle opens the Default apps menu from System settings
- I open the browser list, pick my browser and return to the app by pressing back.
This part works fine in my local Android studio emulator and real device, but when I run it on Firebase test lab with the same virtual device configuration: Pixel 2 API 28, it will not detect the "Browser app" text and fail.
Any ideas why it behaves differently on the Firebase virtual device?
fun selectDefaultBrowser() {
clickSetDefaultBrowserToggle()
mDevice.waitNotNull(
Until.findObject(By.text("Browser app")),
TestAssetHelper.waitingTime
)
assertAndroidSettingsPackage()
defaultBrowserAppList().waitForExists(waitingTime)
defaultBrowserAppList().clickAndWaitForNewWindow()
fenixDebugOption().click()
mDevice.pressBack()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mDevice.pressBack()
}
}
fun clickSetDefaultBrowserToggle() =
setDefaultBrowserToggle().clickAndWaitForNewWindow()
fun setDefaultBrowserToggle() = mDevice.findObject(
UiSelector().resourceId("org.mozilla.fenix.debug:id/switch_widget")
)
fun defaultBrowserAppList() = mDevice.findObject(
(UiSelector()
.className("android.widget.TextView"))
.resourceId("android:id/title")
.text("Browser app")
)
fun assertAndroidSettingsPackage() = assertTrue(
mDevice.findObject(
(UiSelector().packageName("com.android.settings"))
).waitForExists(waitingTime)
)
fun fenixDebugOption() = mDevice.findObject(UiSelector().text("Firefox Preview"))```