Closes #12645: Re-enable mediaSystemNotificationInPrivateModeTest

pull/90/head
Oana Horvath 4 years ago
parent b94a6c244b
commit cf69058ce8

@ -8,7 +8,6 @@ import androidx.test.uiautomator.UiSelector
import okhttp3.mockwebserver.MockWebServer import okhttp3.mockwebserver.MockWebServer
import org.junit.After import org.junit.After
import org.junit.Before import org.junit.Before
import org.junit.Ignore
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.helpers.AndroidAssetDispatcher import org.mozilla.fenix.helpers.AndroidAssetDispatcher
@ -61,6 +60,7 @@ class MediaNotificationTest {
}.enterURLAndEnterToBrowser(videoTestPage.url) { }.enterURLAndEnterToBrowser(videoTestPage.url) {
mDevice.waitForIdle() mDevice.waitForIdle()
clickMediaPlayerPlayButton() clickMediaPlayerPlayButton()
waitForPlaybackToStart()
}.openNotificationShade { }.openNotificationShade {
verifySystemNotificationExists(videoTestPage.title) verifySystemNotificationExists(videoTestPage.title)
clickMediaSystemNotificationControlButton("Pause") clickMediaSystemNotificationControlButton("Pause")
@ -136,7 +136,6 @@ class MediaNotificationTest {
} }
} }
@Ignore("Flaky test, temp disabled: https://github.com/mozilla-mobile/fenix/issues/12645")
@Test @Test
fun mediaSystemNotificationInPrivateModeTest() { fun mediaSystemNotificationInPrivateModeTest() {
val audioTestPage = TestAssetHelper.getAudioPageAsset(mockWebServer) val audioTestPage = TestAssetHelper.getAudioPageAsset(mockWebServer)
@ -160,6 +159,7 @@ class MediaNotificationTest {
verifyMediaIsPaused() verifyMediaIsPaused()
}.openTabDrawer { }.openTabDrawer {
closeTab() closeTab()
verifySnackBarText("Private tab closed")
} }
mDevice.openNotification() mDevice.openNotification()

@ -12,14 +12,12 @@ import android.net.Uri
import androidx.test.espresso.Espresso.onView import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.Espresso.pressBack import androidx.test.espresso.Espresso.pressBack
import androidx.test.espresso.action.ViewActions import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.intent.Intents import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.matcher.BundleMatchers import androidx.test.espresso.intent.matcher.BundleMatchers
import androidx.test.espresso.intent.matcher.IntentMatchers import androidx.test.espresso.intent.matcher.IntentMatchers
import androidx.test.espresso.matcher.RootMatchers.isDialog import androidx.test.espresso.matcher.RootMatchers.isDialog
import androidx.test.espresso.matcher.ViewMatchers import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
import androidx.test.espresso.matcher.ViewMatchers.Visibility import androidx.test.espresso.matcher.ViewMatchers.Visibility
import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
@ -33,7 +31,6 @@ import androidx.test.uiautomator.By.text
import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.UiSelector import androidx.test.uiautomator.UiSelector
import androidx.test.uiautomator.Until import androidx.test.uiautomator.Until
import androidx.test.uiautomator.Until.hasObject
import org.hamcrest.CoreMatchers.allOf import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.CoreMatchers.containsString import org.hamcrest.CoreMatchers.containsString
import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue
@ -328,14 +325,7 @@ class BrowserRobot {
} }
fun clickMediaPlayerPlayButton() { fun clickMediaPlayerPlayButton() {
mDevice.waitNotNull( mediaPlayerPlayButton().waitForExists(waitingTime)
hasObject(
By
.clazz("android.widget.Button")
.textContains("Play")
),
waitingTime
)
mediaPlayerPlayButton().click() mediaPlayerPlayButton().click()
} }
@ -459,9 +449,9 @@ private fun tabsCounter() = onView(withId(R.id.counter_box))
private fun mediaPlayerPlayButton() = private fun mediaPlayerPlayButton() =
mDevice.findObject( mDevice.findObject(
By UiSelector()
.clazz("android.widget.Button") .className("android.widget.Button")
.textContains("Play") .text("Play")
) )
private fun assertBlueDot() { private fun assertBlueDot() {

Loading…
Cancel
Save