Skip to content

Commit b69d0e9

Browse files
committed
Bug 1919763 - Fix verifyCreditCardRedirectionsToAutofillSectionAfterInterruptionTest UI test on API 34 r=ohorvath
The UI test was failing on API 34 because of the background-foreground actions (slightly different behaviour compared to API 30) To overcome this problem, I've added a couple of extra actions and had to make minor sync improvements after resuming the app. The UI test: - Successfully passed 25x on API 30 ✅ - Successfully passed 50x on API 34 ✅ Differential Revision: https://phabricator.services.mozilla.com/D222781 UltraBlame original commit: 507b9c91a6dfdc0a9d1ee667ad76652e109a0770
1 parent a0a3546 commit b69d0e9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/helpers/AppAndSystemHelper.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
5555
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeShort
5656
import org.mozilla.fenix.helpers.TestHelper.appContext
5757
import org.mozilla.fenix.helpers.TestHelper.mDevice
58+
import org.mozilla.fenix.helpers.TestHelper.packageName
5859
import org.mozilla.fenix.helpers.ext.waitNotNull
5960
import org.mozilla.fenix.helpers.idlingresource.NetworkConnectionIdlingResource
6061
import org.mozilla.fenix.ui.robots.BrowserRobot
@@ -559,6 +560,9 @@ object AppAndSystemHelper {
559560
waitingTime,
560561
)
561562
Log.i(TAG, "putAppToBackground: Waited for the app to be gone for $waitingTime ms.")
563+
Log.i(TAG, "putAppToBackground: Trying to press device home button")
564+
mDevice.pressHome()
565+
Log.i(TAG, "putAppToBackground: Pressed the device home button")
562566
}
563567

564568
/**
@@ -568,10 +572,16 @@ object AppAndSystemHelper {
568572
* The index of the most recent opened app will always have index 2, meaning that the previously opened app will have index 1.
569573
*/
570574
fun bringAppToForeground() {
575+
Log.i(TAG, "bringAppToForeground: Trying to press the device Recent apps button.")
576+
mDevice.pressRecentApps()
577+
Log.i(TAG, "bringAppToForeground: Pressed the device Recent apps button.")
571578
Log.i(TAG, "bringAppToForeground: Trying to select the app from the recent apps tray and wait for $waitingTime ms for a new window")
572579
mDevice.findObject(UiSelector().index(2).packageName(PIXEL_LAUNCHER))
573580
.clickAndWaitForNewWindow(waitingTimeShort)
574581
Log.i(TAG, "bringAppToForeground: Selected the app from the recent apps tray.")
582+
Log.i(TAG, "bringAppToForeground: Waiting for $waitingTime ms for $packageName window to be updated")
583+
mDevice.waitForWindowUpdate(packageName, waitingTime)
584+
Log.i(TAG, "bringAppToForeground: Waited for $waitingTime ms for $packageName window to be updated")
575585
}
576586

577587
fun verifyKeyboardVisibility(isExpectedToBeVisible: Boolean = true) {

mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/CreditCardAutofillTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
package org.mozilla.fenix.ui
66

7-
import androidx.test.filters.SdkSuppress
87
import org.junit.Rule
98
import org.junit.Test
109
import org.mozilla.fenix.customannotations.SmokeTest
@@ -557,7 +556,6 @@ class CreditCardAutofillTest : TestSetup() {
557556
}
558557

559558
// TestRail link: https://mozilla.testrail.io/index.php?/cases/view/1512791
560-
@SdkSuppress(maxSdkVersion = 30)
561559
@Test
562560
fun verifyCreditCardRedirectionsToAutofillSectionAfterInterruptionTest() {
563561
homeScreen {

0 commit comments

Comments
 (0)