1
0
Fork 0

fix #9670 intermittent tests (#9767)

also disabled intermittent closePrivateTabsNotification
master
Oana Horvath 2020-04-13 13:17:35 +03:00 committed by GitHub
parent 8cdc523de9
commit 52857b09d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 3 deletions

View File

@ -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)
}
}
}

View File

@ -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)

View File

@ -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
)

View File

@ -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()