diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SitePermissionsTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SitePermissionsTest.kt index f7671f76dbfe..d18a88aa3e21 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SitePermissionsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SitePermissionsTest.kt @@ -6,10 +6,13 @@ package org.mozilla.fenix.ui import android.Manifest import android.content.Context +import android.hardware.camera2.CameraManager +import android.media.AudioManager import androidx.core.net.toUri import androidx.test.rule.GrantPermissionRule import kotlinx.coroutines.runBlocking import org.junit.After +import org.junit.Assume import org.junit.Before import org.junit.Ignore import org.junit.Rule @@ -18,6 +21,7 @@ import org.mozilla.fenix.components.PermissionStorage import org.mozilla.fenix.customannotations.SmokeTest import org.mozilla.fenix.helpers.FeatureSettingsHelper import org.mozilla.fenix.helpers.HomeActivityTestRule +import org.mozilla.fenix.helpers.TestHelper.appContext import org.mozilla.fenix.ui.robots.browserScreen import org.mozilla.fenix.ui.robots.navigationToolbar @@ -30,6 +34,8 @@ class SitePermissionsTest { private val testPage = "https://mozilla-mobile.github.io/testapp/permissions" private val testPageSubstring = "https://mozilla-mobile.github.io:443" private val featureSettingsHelper = FeatureSettingsHelper() + private val cameraManager = appContext.getSystemService(Context.CAMERA_SERVICE) as CameraManager + private val micManager = appContext.getSystemService(Context.AUDIO_SERVICE) as AudioManager @get:Rule val activityTestRule = HomeActivityTestRule() @@ -60,8 +66,10 @@ class SitePermissionsTest { @SmokeTest @Test - @Ignore("Firebase - No camera and microphone on AVD") + //@Ignore("Firebase - No camera and microphone on AVD") fun audioVideoPermissionChoiceOnEachRequestTest() { + Assume.assumeTrue(cameraManager.cameraIdList.isNotEmpty()) + navigationToolbar { }.enterURLAndEnterToBrowser(testPage.toUri()) { waitForPageToLoad() @@ -77,8 +85,11 @@ class SitePermissionsTest { @SmokeTest @Test - @Ignore("Firebase - No camera and microphone on AVD, see also https://github.com/mozilla-mobile/fenix/issues/23298") + // @Ignore("Firebase - No camera and microphone on AVD, see also https://github.com/mozilla-mobile/fenix/issues/23298") fun rememberBlockAudioVideoPermissionChoiceTest() { + Assume.assumeTrue(cameraManager.cameraIdList.isNotEmpty()) + Assume.assumeTrue(micManager.microphones.isNotEmpty()) + navigationToolbar { }.enterURLAndEnterToBrowser(testPage.toUri()) { waitForPageToLoad() @@ -96,10 +107,13 @@ class SitePermissionsTest { } } - @Ignore("Firebase - No camera and microphone on AVD, see also https://github.com/mozilla-mobile/fenix/issues/23298") + //@Ignore("Firebase - No camera and microphone on AVD, see also https://github.com/mozilla-mobile/fenix/issues/23298") @SmokeTest @Test fun rememberAllowAudioVideoPermissionChoiceTest() { + Assume.assumeTrue(cameraManager.cameraIdList.isNotEmpty()) + Assume.assumeTrue(micManager.microphones.isNotEmpty()) + navigationToolbar { }.enterURLAndEnterToBrowser(testPage.toUri()) { waitForPageToLoad() @@ -118,8 +132,10 @@ class SitePermissionsTest { } @Test - @Ignore("Firebase - No camera and microphone on AVD") + //@Ignore("Firebase - No camera and microphone on AVD") fun microphonePermissionChoiceOnEachRequestTest() { + Assume.assumeTrue(micManager.microphones.isNotEmpty()) + navigationToolbar { }.enterURLAndEnterToBrowser(testPage.toUri()) { waitForPageToLoad() @@ -134,8 +150,10 @@ class SitePermissionsTest { } @Test - @Ignore("Firebase - No camera and microphone on AVD") + //@Ignore("Firebase - No camera and microphone on AVD") fun rememberBlockMicrophonePermissionChoiceTest() { + Assume.assumeTrue(micManager.microphones.isNotEmpty()) + navigationToolbar { }.enterURLAndEnterToBrowser(testPage.toUri()) { waitForPageToLoad() @@ -153,9 +171,11 @@ class SitePermissionsTest { } } - @Ignore("Flaky, needs investigation: https://github.com/mozilla-mobile/fenix/issues/23298") + // @Ignore("Flaky, needs investigation: https://github.com/mozilla-mobile/fenix/issues/23298") @Test fun rememberAllowMicrophonePermissionChoiceTest() { + Assume.assumeTrue(micManager.microphones.isNotEmpty()) + navigationToolbar { }.enterURLAndEnterToBrowser(testPage.toUri()) { waitForPageToLoad() @@ -174,8 +194,10 @@ class SitePermissionsTest { } @Test - @Ignore("Firebase - No camera and microphone on AVD") + // @Ignore("Firebase - No camera and microphone on AVD") fun cameraPermissionChoiceOnEachRequestTest() { + Assume.assumeTrue(cameraManager.cameraIdList.isNotEmpty()) + navigationToolbar { }.enterURLAndEnterToBrowser(testPage.toUri()) { waitForPageToLoad() @@ -190,8 +212,10 @@ class SitePermissionsTest { } @Test - @Ignore("Firebase - No camera and microphone on AVD") + //@Ignore("Firebase - No camera and microphone on AVD") fun rememberBlockCameraPermissionChoiceTest() { + Assume.assumeTrue(cameraManager.cameraIdList.isNotEmpty()) + navigationToolbar { }.enterURLAndEnterToBrowser(testPage.toUri()) { waitForPageToLoad() @@ -210,8 +234,10 @@ class SitePermissionsTest { } @Test - @Ignore("Firebase - No camera and microphone on AVD") + // @Ignore("Firebase - No camera and microphone on AVD") fun rememberAllowCameraPermissionChoiceTest() { + Assume.assumeTrue(cameraManager.cameraIdList.isNotEmpty()) + navigationToolbar { }.enterURLAndEnterToBrowser(testPage.toUri()) { waitForPageToLoad() diff --git a/automation/taskcluster/androidTest/flank-x86.yml b/automation/taskcluster/androidTest/flank-x86.yml index 4226b9a209d0..004fe7b59bb2 100644 --- a/automation/taskcluster/androidTest/flank-x86.yml +++ b/automation/taskcluster/androidTest/flank-x86.yml @@ -38,12 +38,21 @@ gcloud: performance-metrics: true test-targets: - - notPackage org.mozilla.fenix.screenshots - - notPackage org.mozilla.fenix.syncintegration +# - notPackage org.mozilla.fenix.screenshots +# - notPackage org.mozilla.fenix.syncintegration + - class org.mozilla.fenix.ui.SitePermissionsTest#rememberAllowCameraPermissionChoiceTest + - class org.mozilla.fenix.ui.SitePermissionsTest#rememberBlockCameraPermissionChoiceTest + - class org.mozilla.fenix.ui.SitePermissionsTest#cameraPermissionChoiceOnEachRequestTest + - class org.mozilla.fenix.ui.SitePermissionsTest#rememberAllowMicrophonePermissionChoiceTest + - class org.mozilla.fenix.ui.SitePermissionsTest#rememberBlockMicrophonePermissionChoiceTest + - class org.mozilla.fenix.ui.SitePermissionsTest#microphonePermissionChoiceOnEachRequestTest + - class org.mozilla.fenix.ui.SitePermissionsTest#rememberAllowAudioVideoPermissionChoiceTest + - class org.mozilla.fenix.ui.SitePermissionsTest#rememberBlockAudioVideoPermissionChoiceTest + - class org.mozilla.fenix.ui.SitePermissionsTest#audioVideoPermissionChoiceOnEachRequestTest device: - model: Pixel2 - version: 30 + version: 28 locale: en_US flank: @@ -53,7 +62,7 @@ flank: max-test-shards: -1 # num-test-runs: the amount of times to run the tests. # 1 runs the tests once. 10 runs all the tests 10x - num-test-runs: 1 + num-test-runs: 5 ### Output Style flag ## Output style of execution status. May be one of [verbose, multi, single, compact]. ## For runs with only one test execution the default value is 'verbose', in other cases