2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-02 03:40:16 +00:00

[fenix] [UI smoke test] For https://github.com/mozilla-mobile/fenix/issues/21002: Ads new audio-video permissions test

This commit is contained in:
Oana Horvath 2022-01-20 12:24:56 +02:00 committed by mergify[bot]
parent 7b68f83e10
commit ff6e060e03
3 changed files with 103 additions and 7 deletions

View File

@ -26,6 +26,89 @@ class SitePermissionsTest {
val activityTestRule = HomeActivityIntentTestRule()
@SmokeTest
@Test
fun audioVideoPermissionChoiceOnEachRequestTest() {
navigationToolbar {
}.enterURLAndEnterToBrowser(testPage.toUri()) {
waitForPageToLoad()
}.clickStartAudioVideoButton {
// allow app to record video
clickAppPermissionButton(true)
// allow app to record audio
clickAppPermissionButton(true)
verifyAudioVideoPermissionPrompt(testPageSubstring)
}.clickPagePermissionButton(false) {
verifyPageContent("Camera and Microphone not allowed")
}.clickStartAudioVideoButton {
}.clickPagePermissionButton(true) {
verifyPageContent("Camera and Microphone allowed")
}
}
@SmokeTest
@Test
fun rememberBlockAudioVideoPermissionChoiceTest() {
navigationToolbar {
}.enterURLAndEnterToBrowser(testPage.toUri()) {
waitForPageToLoad()
}.clickStartAudioVideoButton {
// allow app to record video
clickAppPermissionButton(true)
// allow app to record audio
clickAppPermissionButton(true)
verifyAudioVideoPermissionPrompt(testPageSubstring)
selectRememberPermissionDecision()
}.clickPagePermissionButton(false) {
verifyPageContent("Camera and Microphone not allowed")
}.openThreeDotMenu {
}.refreshPage {
waitForPageToLoad()
}.clickStartAudioVideoButton { }
browserScreen {
verifyPageContent("Camera and Microphone not allowed")
}
}
@SmokeTest
@Test
fun rememberAllowAudioVideoPermissionChoiceTest() {
navigationToolbar {
}.enterURLAndEnterToBrowser(testPage.toUri()) {
waitForPageToLoad()
}.clickStartAudioVideoButton {
// allow app to record video
clickAppPermissionButton(true)
// allow app to record audio
clickAppPermissionButton(true)
verifyAudioVideoPermissionPrompt(testPageSubstring)
selectRememberPermissionDecision()
}.clickPagePermissionButton(true) {
verifyPageContent("Camera and Microphone allowed")
}.openThreeDotMenu {
}.refreshPage {
waitForPageToLoad()
}.clickStartAudioVideoButton { }
browserScreen {
verifyPageContent("Camera and Microphone allowed")
}
}
@SmokeTest
@Test
fun blockAppUsingAudioVideoTest() {
navigationToolbar {
}.enterURLAndEnterToBrowser(testPage.toUri()) {
}.clickStartAudioVideoButton {
// allow app to record video
clickAppPermissionButton(false)
// allow app to record audio
clickAppPermissionButton(false)
}
browserScreen {
verifyPageContent("Camera and Microphone not allowed")
}
}
@Test
fun microphonePermissionChoiceOnEachRequestTest() {
navigationToolbar {
@ -42,7 +125,6 @@ class SitePermissionsTest {
}
}
@SmokeTest
@Test
fun rememberBlockMicrophonePermissionChoiceTest() {
navigationToolbar {
@ -64,7 +146,6 @@ class SitePermissionsTest {
}
@Ignore("Flaky, needs investigation: https://github.com/mozilla-mobile/fenix/issues/23298")
@SmokeTest
@Test
fun rememberAllowMicrophonePermissionChoiceTest() {
navigationToolbar {
@ -85,7 +166,6 @@ class SitePermissionsTest {
}
}
@SmokeTest
@Test
fun blockAppUsingMicrophoneTest() {
navigationToolbar {
@ -98,7 +178,6 @@ class SitePermissionsTest {
}
}
@SmokeTest
@Test
fun cameraPermissionChoiceOnEachRequestTest() {
navigationToolbar {
@ -115,7 +194,6 @@ class SitePermissionsTest {
}
}
@SmokeTest
@Test
fun rememberBlockCameraPermissionChoiceTest() {
navigationToolbar {
@ -136,7 +214,6 @@ class SitePermissionsTest {
}
}
@SmokeTest
@Test
fun rememberAllowCameraPermissionChoiceTest() {
navigationToolbar {
@ -157,7 +234,6 @@ class SitePermissionsTest {
}
}
@SmokeTest
@Test
fun blockAppUsingCameraTest() {
navigationToolbar {

View File

@ -685,6 +685,15 @@ class BrowserRobot {
return SitePermissionsRobot.Transition()
}
fun clickStartAudioVideoButton(interact: SitePermissionsRobot.() -> Unit): SitePermissionsRobot.Transition {
// Test page used for testing permissions located at https://mozilla-mobile.github.io/testapp/permissions
audioVideoButton.waitForExists(waitingTime)
audioVideoButton.click()
SitePermissionsRobot().interact()
return SitePermissionsRobot.Transition()
}
fun clickOpenNotificationButton(interact: SitePermissionsRobot.() -> Unit): SitePermissionsRobot.Transition {
// Test page used for testing permissions located at https://mozilla-mobile.github.io/testapp/permissions
notificationButton.waitForExists(waitingTime)
@ -757,6 +766,8 @@ private val cameraButton = mDevice.findObject(UiSelector().text("Open camera"))
private val microphoneButton = mDevice.findObject(UiSelector().text("Open microphone"))
private val audioVideoButton = mDevice.findObject(UiSelector().text("Camera & Microphone"))
private val notificationButton = mDevice.findObject(UiSelector().text("Open notifications dialogue"))
private val getLocationButton = mDevice.findObject(UiSelector().text("Get Location"))

View File

@ -46,6 +46,15 @@ class SitePermissionsRobot {
assertTrue(allowPagePermissionButton.text.equals("Allow"))
}
fun verifyAudioVideoPermissionPrompt(url: String) {
assertTrue(
mDevice.findObject(UiSelector().text("Allow $url to use your camera and microphone?"))
.waitForExists(waitingTime)
)
assertTrue(denyPagePermissionButton.text.equals("Dont allow"))
assertTrue(allowPagePermissionButton.text.equals("Allow"))
}
fun verifyLocationPermissionPrompt(url: String) {
assertTrue(
mDevice.findObject(UiSelector().text("Allow $url to use your location?"))