For #21006 & #21005: fixed ETP status info display

This commit is contained in:
Oana Horvath 2021-10-11 17:07:58 +03:00 committed by mergify[bot]
parent ab25f17185
commit e3266ca6e0
3 changed files with 50 additions and 16 deletions

View File

@ -79,9 +79,12 @@ class StrictEnhancedTrackingProtectionTest {
// browsing a generic page to allow GV to load on a fresh run
navigationToolbar {
}.enterURLAndEnterToBrowser(genericPage.url) {
}.openNavigationToolbar {
}.enterURLAndEnterToBrowser(trackingProtectionTest.url) {}
}.openTabDrawer {
closeTab()
}
navigationToolbar {
}.enterURLAndEnterToBrowser(trackingProtectionTest.url) {}
enhancedTrackingProtection {
}.openEnhancedTrackingProtectionSheet {
verifyEnhancedTrackingProtectionSheetStatus("ON", true)
@ -97,9 +100,12 @@ class StrictEnhancedTrackingProtectionTest {
// browsing a generic page to allow GV to load on a fresh run
navigationToolbar {
}.enterURLAndEnterToBrowser(genericPage.url) {
}.openNavigationToolbar {
}.enterURLAndEnterToBrowser(trackingProtectionTest.url) {}
}.openTabDrawer {
closeTab()
}
navigationToolbar {
}.enterURLAndEnterToBrowser(trackingProtectionTest.url) {}
enhancedTrackingProtection {
}.openEnhancedTrackingProtectionSheet {
verifyEnhancedTrackingProtectionSheetStatus("ON", true)
@ -113,7 +119,7 @@ class StrictEnhancedTrackingProtectionTest {
settingsSubMenuEnhancedTrackingProtection {
}.openExceptions {
verifyListedURL(trackingProtectionTest.url.toString())
verifyListedURL(trackingProtectionTest.url.host.toString())
}.disableExceptions {
verifyDefault()
}
@ -128,9 +134,12 @@ class StrictEnhancedTrackingProtectionTest {
// browsing a generic page to allow GV to load on a fresh run
navigationToolbar {
}.enterURLAndEnterToBrowser(genericPage.url) {
}.openNavigationToolbar {
}.enterURLAndEnterToBrowser(trackingProtectionTest.url) {}
}.openTabDrawer {
closeTab()
}
navigationToolbar {
}.enterURLAndEnterToBrowser(trackingProtectionTest.url) {}
enhancedTrackingProtection {
}.openEnhancedTrackingProtectionSheet {
verifyEnhancedTrackingProtectionSheetStatus("ON", true)

View File

@ -9,7 +9,9 @@ package org.mozilla.fenix.ui.robots
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.platform.app.InstrumentationRegistry
@ -69,6 +71,7 @@ class EnhancedTrackingProtectionRobot {
fun openEnhancedTrackingProtectionSheet(interact: EnhancedTrackingProtectionRobot.() -> Unit): Transition {
openEnhancedTrackingProtectionSheet().waitForExists(waitingTime)
openEnhancedTrackingProtectionSheet().click()
assertSecuritySheetIsCompletelyDisplayed()
EnhancedTrackingProtectionRobot().interact()
return Transition()
@ -169,3 +172,10 @@ private fun assertTrackingContentBlocked() {
}
private fun trackingContentBlockListButton() = onView(withId(R.id.tracking_content))
private fun assertSecuritySheetIsCompletelyDisplayed() {
mDevice.findObject(UiSelector().description("Quick settings sheet"))
.waitForExists(waitingTime)
onView(withContentDescription("Quick settings sheet"))
.check(matches(isCompletelyDisplayed()))
}

View File

@ -6,16 +6,19 @@ package org.mozilla.fenix.ui.robots
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.Visibility
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.espresso.matcher.ViewMatchers.Visibility
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.UiSelector
import junit.framework.TestCase.assertTrue
import org.hamcrest.CoreMatchers.allOf
import org.mozilla.fenix.helpers.click
import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
import org.mozilla.fenix.helpers.click
/**
* Implementation of Robot Pattern for the settings Enhanced Tracking Protection Exceptions sub menu.
@ -24,11 +27,11 @@ class SettingsSubMenuEnhancedTrackingProtectionExceptionsRobot {
fun verifyNavigationToolBarHeader() = assertNavigationToolBarHeader()
fun verifyDefault() = assertExceptionDefault()!!
fun verifyDefault() = assertExceptionDefault()
fun verifyExceptionLearnMoreText() = assertExceptionLearnMoreText()!!
fun verifyExceptionLearnMoreText() = assertExceptionLearnMoreText()
fun verifyListedURL(url: String) = assertExceptionURL(url)!!
fun verifyListedURL(url: String) = assertExceptionURL(url)
fun verifyEnhancedTrackingProtectionProtectionExceptionsSubMenuItems() {
verifyDefault()
@ -63,13 +66,25 @@ private fun assertNavigationToolBarHeader() {
}
private fun assertExceptionDefault() =
onView(allOf(withText(R.string.exceptions_empty_message_description)))
assertTrue(
mDevice.findObject(
UiSelector().text("Exceptions let you disable tracking protection for selected sites.")
).waitForExists(waitingTime)
)
private fun assertExceptionLearnMoreText() =
onView(allOf(withText(R.string.exceptions_empty_message_learn_more_link)))
assertTrue(
mDevice.findObject(
UiSelector().text("Learn more")
).waitForExists(waitingTime)
)
private fun assertExceptionURL(url: String) =
onView(allOf(withText(url)))
assertTrue(
mDevice.findObject(
UiSelector().textContains(url.replace("http://", "https://"))
).waitForExists(waitingTime)
)
private fun disableExceptionsButton() =
onView(allOf(withId(R.id.removeAllExceptions)))
onView(withId(R.id.removeAllExceptions)).click()