From 908d95afb120f2c73f6bd89cf3cd7e5d670a9c5b Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Tue, 27 Sep 2022 16:51:29 +0300 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/24978 re-enable media notification UI tests --- .../mozilla/fenix/ui/MediaNotificationTest.kt | 6 +++--- .../mozilla/fenix/ui/robots/BrowserRobot.kt | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt index 2380e770cf..abc644f0a8 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt @@ -11,11 +11,11 @@ import mozilla.components.concept.engine.mediasession.MediaSession import okhttp3.mockwebserver.MockWebServer import org.junit.After import org.junit.Before -import org.junit.Ignore import org.junit.Rule import org.junit.Test import org.mozilla.fenix.ext.components import org.mozilla.fenix.helpers.AndroidAssetDispatcher +import org.mozilla.fenix.helpers.FeatureSettingsHelper import org.mozilla.fenix.helpers.HomeActivityTestRule import org.mozilla.fenix.helpers.RetryTestRule import org.mozilla.fenix.helpers.TestAssetHelper @@ -35,6 +35,7 @@ class MediaNotificationTest { private lateinit var mockWebServer: MockWebServer private lateinit var mDevice: UiDevice + val featureSettingsHelper = FeatureSettingsHelper() @get:Rule val activityTestRule = HomeActivityTestRule() @@ -55,6 +56,7 @@ class MediaNotificationTest { dispatcher = AndroidAssetDispatcher() start() } + featureSettingsHelper.setTCPCFREnabled(false) } @After @@ -62,7 +64,6 @@ class MediaNotificationTest { mockWebServer.shutdown() } - @Ignore("Failing with ANR: https://github.com/mozilla-mobile/fenix/issues/15754") @Test fun videoPlaybackSystemNotificationTest() { val videoTestPage = TestAssetHelper.getVideoPageAsset(mockWebServer) @@ -96,7 +97,6 @@ class MediaNotificationTest { mDevice.pressBack() } - @Ignore("Failing with frequent ANR: https://bugzilla.mozilla.org/show_bug.cgi?id=1764605") @Test fun mediaSystemNotificationInPrivateModeTest() { val audioTestPage = TestAssetHelper.getAudioPageAsset(mockWebServer) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt index 3068a399aa..bab7ef9ac9 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt @@ -556,8 +556,22 @@ class BrowserRobot { } fun clickMediaPlayerPlayButton() { - mediaPlayerPlayButton().waitForExists(waitingTime) - mediaPlayerPlayButton().click() + for (i in 1..RETRY_COUNT) { + try { + mediaPlayerPlayButton().waitForExists(waitingTime) + mediaPlayerPlayButton().click() + + break + } catch (e: UiObjectNotFoundException) { + if (i == RETRY_COUNT) { + throw e + } else { + browserScreen { + }.openThreeDotMenu { + }.refreshPage { } + } + } + } } /**