Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
run #1
Browse files Browse the repository at this point in the history
  • Loading branch information
sv-ohorvath committed Jun 28, 2022
1 parent 1597231 commit 9e81540
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down
17 changes: 13 additions & 4 deletions automation/taskcluster/androidTest/flank-x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 9e81540

Please sign in to comment.