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 ad6ddc8d2..287a16d07 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt @@ -7,7 +7,6 @@ package org.mozilla.fenix.ui 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.helpers.AndroidAssetDispatcher @@ -17,6 +16,7 @@ import org.mozilla.fenix.ui.robots.browserScreen import org.mozilla.fenix.ui.robots.homeScreen import org.mozilla.fenix.ui.robots.mDevice import org.mozilla.fenix.ui.robots.navigationToolbar +import org.mozilla.fenix.ui.robots.notificationShade /** * Tests for verifying basic functionality of media notifications: @@ -63,6 +63,14 @@ class MediaNotificationTest { browserScreen { verifyMediaIsPaused() + }.openHomeScreen { + closeTab() + } + + mDevice.openNotification() + + notificationShade { + verifySystemNotificationGone(videoTestPage.title) } } @@ -85,11 +93,18 @@ class MediaNotificationTest { browserScreen { verifyMediaIsPaused() + }.openHomeScreen { + closeTab() + } + + mDevice.openNotification() + + notificationShade { + verifySystemNotificationGone(audioTestPage.title) } } @Test - @Ignore("Temp disable test - see: https://github.com/mozilla-mobile/fenix/issues/9670") fun tabMediaControlButtonTest() { val audioTestPage = TestAssetHelper.getAudioPageAsset(mockWebServer) @@ -128,6 +143,14 @@ class MediaNotificationTest { browserScreen { verifyMediaIsPaused() + }.openHomeScreen { + closeTab() + } + + mDevice.openNotification() + + notificationShade { + verifySystemNotificationGone(audioTestPage.title) } } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt index d48856747..094ddc7a9 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt @@ -11,6 +11,7 @@ import androidx.test.uiautomator.Until 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.helpers.AndroidAssetDispatcher @@ -250,6 +251,7 @@ class TabbedBrowsingTest { } } + @Ignore("Temp disabled, intermittent test: https://github.com/mozilla-mobile/fenix/issues/9783") @Test fun closePrivateTabsNotificationTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt index b87c4e3cb..afab1c7b5 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt @@ -194,7 +194,11 @@ class HomeScreenRobot { fun verifyTabMediaControlButtonState(action: String) { mDevice.waitNotNull( - Until.findObject(By.res("org.mozilla.fenix.debug:id/play_pause_button")), + findObject( + By + .res("org.mozilla.fenix.debug:id/play_pause_button") + .desc(action) + ), waitingTime ) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NotificationRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NotificationRobot.kt index 879bf029c..df3e5c6fc 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NotificationRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NotificationRobot.kt @@ -5,6 +5,7 @@ import androidx.test.uiautomator.By.text import androidx.test.uiautomator.UiScrollable import androidx.test.uiautomator.UiSelector import androidx.test.uiautomator.Until +import org.junit.Assert.assertFalse import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime import org.mozilla.fenix.helpers.ext.waitNotNull @@ -36,6 +37,19 @@ class NotificationRobot { } } + fun verifySystemNotificationGone(notificationMessage: String) { + mDevice.waitNotNull( + Until.gone(text(notificationMessage)), + waitingTime + ) + + assertFalse( + mDevice.findObject( + UiSelector().text(notificationMessage) + ).exists() + ) + } + fun verifyPrivateTabsNotification() { mDevice.waitNotNull(Until.hasObject(text("Close private tabs")), waitingTime) assertPrivateTabsNotification()