commit 1aadc7314b7b4624dc24817868dcc7ebf70219d6
parent f3f1165d3637bcc3ba791c4a0ceba1c7821316c8
Author: AndiAJ <andiaj@users.noreply.github.com>
Date: Fri, 31 Oct 2025 06:37:10 +0000
Bug 1926200 - Fix verifyQRScanningCameraAccessDialogTest UI test r=aaronmt
The UI test was sometimes flaky because the awesome bar wasn't always enabled.
Because of this it sometimes clicked the main menu button.
To fix this, I've tried to improve syncing between actions.
The UI test successfully passed 100x on Firebase ✅
Differential Revision: https://phabricator.services.mozilla.com/D270659
Diffstat:
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/SearchTest.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/SearchTest.kt
@@ -195,6 +195,8 @@ class SearchTest : TestSetup() {
homeScreen {
}.openSearch {
+ waitForAppWindowToBeUpdated()
+ verifySearchView()
clickScanButton()
denyPermission()
clickScanButton()
diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt
@@ -62,6 +62,7 @@ import org.mozilla.fenix.helpers.TestHelper.appContext
import org.mozilla.fenix.helpers.TestHelper.appName
import org.mozilla.fenix.helpers.TestHelper.mDevice
import org.mozilla.fenix.helpers.TestHelper.packageName
+import org.mozilla.fenix.helpers.TestHelper.waitForAppWindowToBeUpdated
import mozilla.components.browser.toolbar.R as toolbarR
import mozilla.components.feature.qr.R as qrR
@@ -419,15 +420,13 @@ class SearchRobot {
Log.i(TAG, "selectTemporarySearchMethodWithComposableToolbar: Clicked the $searchEngineName search shortcut")
}
- fun clickScanButton() =
- scanButton().also {
- Log.i(TAG, "clickScanButton: Waiting for $waitingTime ms for the scan button to exist")
- it.waitForExists(waitingTime)
- Log.i(TAG, "clickScanButton: Waited for $waitingTime ms for the scan button to exist")
- Log.i(TAG, "clickScanButton: Trying to click the scan button")
- it.click()
- Log.i(TAG, "clickScanButton: Clicked the scan button")
- }
+ fun clickScanButton() {
+ waitForAppWindowToBeUpdated()
+ assertUIObjectExists(scanButton())
+ Log.i(TAG, "clickScanButton: Trying to click the scan button and wait for $waitingTimeShort ms for a new window")
+ scanButton().clickAndWaitForNewWindow(waitingTimeShort)
+ Log.i(TAG, "clickScanButton: Clicked the scan button and waited for $waitingTimeShort ms for a new window")
+ }
fun clickScanButtonWithComposableToolbar(composeTestRule: ComposeTestRule) {
Log.i(TAG, "clickScanButtonWithComposableToolbar: Trying to click the scan button")