mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-17 15:26:23 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/19886 fix ui tests
This commit is contained in:
parent
2d6dcb814c
commit
2e60b8d80a
@ -40,7 +40,6 @@ import org.mozilla.fenix.ui.robots.clickTabCrashedRestoreButton
|
||||
import org.mozilla.fenix.ui.robots.clickUrlbar
|
||||
import org.mozilla.fenix.ui.robots.collectionRobot
|
||||
import org.mozilla.fenix.ui.robots.customTabScreen
|
||||
import org.mozilla.fenix.ui.robots.dismissTrackingOnboarding
|
||||
import org.mozilla.fenix.ui.robots.downloadRobot
|
||||
import org.mozilla.fenix.ui.robots.enhancedTrackingProtection
|
||||
import org.mozilla.fenix.ui.robots.homeScreen
|
||||
@ -392,34 +391,7 @@ class SmokeTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
// Turns ETP toggle off from Settings and verifies the ETP shield is not displayed in the nav bar
|
||||
fun verifyETPShieldNotDisplayedIfOFFGlobally() {
|
||||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
|
||||
homeScreen {
|
||||
}.openThreeDotMenu {
|
||||
}.openSettings {
|
||||
}.openEnhancedTrackingProtectionSubMenu {
|
||||
switchEnhancedTrackingProtectionToggle()
|
||||
verifyEnhancedTrackingProtectionOptionsGrayedOut()
|
||||
}.goBackToHomeScreen {
|
||||
navigationToolbar {
|
||||
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
|
||||
verifyEnhancedTrackingProtectionPanelNotVisible()
|
||||
}.openThreeDotMenu {
|
||||
}.openSettings {
|
||||
}.openEnhancedTrackingProtectionSubMenu {
|
||||
switchEnhancedTrackingProtectionToggle()
|
||||
}.goBack {
|
||||
}.goBackToBrowser {
|
||||
clickEnhancedTrackingProtectionPanel()
|
||||
verifyEnhancedTrackingProtectionSwitch()
|
||||
clickEnhancedTrackingProtectionSwitchOffOn()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("https://github.com/mozilla-mobile/fenix/issues/20868")
|
||||
fun customTrackingProtectionSettingsTest() {
|
||||
val genericWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
|
||||
val trackingPage = TestAssetHelper.getEnhancedTrackingProtectionAsset(mockWebServer)
|
||||
@ -437,12 +409,11 @@ class SmokeTest {
|
||||
// browsing a basic page to allow GV to load on a fresh run
|
||||
}.enterURLAndEnterToBrowser(genericWebPage.url) {
|
||||
}.openNavigationToolbar {
|
||||
}.openTrackingProtectionTestPage(trackingPage.url, true) {
|
||||
dismissTrackingOnboarding()
|
||||
}
|
||||
}.openTrackingProtectionTestPage(trackingPage.url, true) {}
|
||||
|
||||
enhancedTrackingProtection {
|
||||
}.openEnhancedTrackingProtectionSheet {
|
||||
}.openDetails {
|
||||
verifyTrackingCookiesBlocked()
|
||||
verifyCryptominersBlocked()
|
||||
verifyFingerprintersBlocked()
|
||||
@ -664,9 +635,6 @@ class SmokeTest {
|
||||
}.goBack {
|
||||
}.openNavigationToolbar {
|
||||
}.openTrackingProtectionTestPage(trackingProtectionPage.url, true) {}
|
||||
enhancedTrackingProtection {
|
||||
verifyEnhancedTrackingProtectionShield()
|
||||
}.closeNotificationPopup {}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -76,19 +76,6 @@ class StrictEnhancedTrackingProtectionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testStrictVisitContentShield() {
|
||||
val trackingProtectionTest =
|
||||
TestAssetHelper.getEnhancedTrackingProtectionAsset(mockWebServer)
|
||||
|
||||
navigationToolbar {
|
||||
}.openTrackingProtectionTestPage(trackingProtectionTest.url, true) {}
|
||||
|
||||
enhancedTrackingProtection {
|
||||
verifyEnhancedTrackingProtectionShield()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testStrictVisitProtectionSheet() {
|
||||
val trackingProtectionTest =
|
||||
@ -97,9 +84,7 @@ class StrictEnhancedTrackingProtectionTest {
|
||||
navigationToolbar {
|
||||
}.openTrackingProtectionTestPage(trackingProtectionTest.url, true) {}
|
||||
|
||||
enhancedTrackingProtection {
|
||||
verifyEnhancedTrackingProtectionShield()
|
||||
}.openEnhancedTrackingProtectionSheet {
|
||||
enhancedTrackingProtection {}.openEnhancedTrackingProtectionSheet {
|
||||
verifyEnhancedTrackingProtectionSheetStatus("ON", true)
|
||||
}
|
||||
}
|
||||
@ -113,7 +98,6 @@ class StrictEnhancedTrackingProtectionTest {
|
||||
}.openTrackingProtectionTestPage(trackingProtectionTest.url, true) {}
|
||||
|
||||
enhancedTrackingProtection {
|
||||
verifyEnhancedTrackingProtectionShield()
|
||||
}.openEnhancedTrackingProtectionSheet {
|
||||
verifyEnhancedTrackingProtectionSheetStatus("ON", true)
|
||||
}.disableEnhancedTrackingProtectionFromSheet {
|
||||
@ -139,7 +123,6 @@ class StrictEnhancedTrackingProtectionTest {
|
||||
}.openTrackingProtectionTestPage(trackingProtectionTest.url, true) {}
|
||||
|
||||
enhancedTrackingProtection {
|
||||
verifyEnhancedTrackingProtectionShield()
|
||||
}.openEnhancedTrackingProtectionSheet {
|
||||
verifyEnhancedTrackingProtectionSheetStatus("ON", true)
|
||||
}.disableEnhancedTrackingProtectionFromSheet {
|
||||
@ -167,7 +150,6 @@ class StrictEnhancedTrackingProtectionTest {
|
||||
}.openTrackingProtectionTestPage(trackingProtectionTest.url, true) {}
|
||||
|
||||
enhancedTrackingProtection {
|
||||
verifyEnhancedTrackingProtectionShield()
|
||||
}.openEnhancedTrackingProtectionSheet {
|
||||
verifyEnhancedTrackingProtectionSheetStatus("ON", true)
|
||||
}.openDetails {
|
||||
|
@ -26,7 +26,6 @@ import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
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.withResourceName
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.uiautomator.By
|
||||
@ -164,15 +163,9 @@ class BrowserRobot {
|
||||
|
||||
fun verifyEnhancedTrackingProtectionSwitch() = assertEnhancedTrackingProtectionSwitch()
|
||||
|
||||
fun clickEnhancedTrackingProtectionSwitchOffOn() =
|
||||
onView(withResourceName("switch_widget")).click()
|
||||
|
||||
fun verifyProtectionSettingsButton() = assertProtectionSettingsButton()
|
||||
|
||||
fun verifyEnhancedTrackingOptions() {
|
||||
clickEnhancedTrackingProtectionPanel()
|
||||
onView(withId(R.id.mozac_browser_toolbar_security_indicator)).click()
|
||||
verifyEnhancedTrackingProtectionSwitch()
|
||||
verifyProtectionSettingsButton()
|
||||
}
|
||||
|
||||
fun verifyMenuButton() = assertMenuButton()
|
||||
@ -214,11 +207,6 @@ class BrowserRobot {
|
||||
.perform(ViewActions.pressBack())
|
||||
}
|
||||
|
||||
fun clickEnhancedTrackingProtectionPanel() = enhancedTrackingProtectionIndicator().click()
|
||||
|
||||
fun verifyEnhancedTrackingProtectionPanelNotVisible() =
|
||||
assertEnhancedTrackingProtectionIndicatorNotVisible()
|
||||
|
||||
fun clickContextOpenLinkInNewTab() {
|
||||
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
||||
mDevice.waitNotNull(
|
||||
@ -566,11 +554,6 @@ fun browserScreen(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
||||
return BrowserRobot.Transition()
|
||||
}
|
||||
|
||||
fun dismissTrackingOnboarding() {
|
||||
mDevice.wait(Until.findObject(By.res("close_onboarding")), waitingTime)
|
||||
dismissOnboardingButton().click()
|
||||
}
|
||||
|
||||
fun navURLBar() = onView(withId(R.id.toolbar))
|
||||
|
||||
private fun assertNavURLBar() = navURLBar()
|
||||
@ -579,13 +562,6 @@ private fun assertNavURLBar() = navURLBar()
|
||||
private fun assertNavURLBarHidden() = navURLBar()
|
||||
.check(matches(not(isDisplayed())))
|
||||
|
||||
fun enhancedTrackingProtectionIndicator() =
|
||||
onView(withId(R.id.mozac_browser_toolbar_tracking_protection_indicator))
|
||||
|
||||
private fun assertEnhancedTrackingProtectionIndicatorNotVisible() {
|
||||
enhancedTrackingProtectionIndicator().check(matches(not(isDisplayed())))
|
||||
}
|
||||
|
||||
private fun assertEnhancedTrackingProtectionSwitch() {
|
||||
withText(R.id.trackingProtectionSwitch)
|
||||
.matches(withEffectiveVisibility(Visibility.VISIBLE))
|
||||
|
@ -33,8 +33,6 @@ class EnhancedTrackingProtectionRobot {
|
||||
|
||||
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())!!
|
||||
|
||||
fun verifyEnhancedTrackingProtectionShield() = assertEnhancedTrackingProtectionShield()
|
||||
|
||||
fun verifyEnhancedTrackingProtectionSheetStatus(status: String, state: Boolean) =
|
||||
assertEnhancedTrackingProtectionSheetStatus(status, state)
|
||||
|
||||
@ -52,18 +50,10 @@ class EnhancedTrackingProtectionRobot {
|
||||
class Transition {
|
||||
fun openEnhancedTrackingProtectionSheet(interact: EnhancedTrackingProtectionRobot.() -> Unit): Transition {
|
||||
openEnhancedTrackingProtectionSheet().click()
|
||||
|
||||
EnhancedTrackingProtectionRobot().interact()
|
||||
return Transition()
|
||||
}
|
||||
|
||||
fun closeNotificationPopup(interact: BrowserRobot.() -> Unit): Transition {
|
||||
closeButton().click()
|
||||
|
||||
BrowserRobot().interact()
|
||||
return Transition()
|
||||
}
|
||||
|
||||
fun closeEnhancedTrackingProtectionSheet(interact: BrowserRobot.() -> Unit): Transition {
|
||||
// Back out of the Enhanced Tracking Protection sheet
|
||||
mDevice.pressBack()
|
||||
@ -80,6 +70,7 @@ class EnhancedTrackingProtectionRobot {
|
||||
}
|
||||
|
||||
fun openProtectionSettings(interact: SettingsSubMenuEnhancedTrackingProtectionRobot.() -> Unit): Transition {
|
||||
onView(withId(R.id.trackingProtectionDetails)).click()
|
||||
openEnhancedTrackingProtectionSettings().click()
|
||||
|
||||
SettingsSubMenuEnhancedTrackingProtectionRobot().interact()
|
||||
@ -121,10 +112,8 @@ private fun assertEnhancedTrackingProtectionDetailsStatus(status: String) {
|
||||
mDevice.waitNotNull(Until.findObjects(By.textContains(status)))
|
||||
}
|
||||
|
||||
private fun closeButton() = onView(ViewMatchers.withId(R.id.close_onboarding))
|
||||
|
||||
private fun openEnhancedTrackingProtectionSheet() =
|
||||
onView(ViewMatchers.withId(R.id.mozac_browser_toolbar_tracking_protection_indicator))
|
||||
onView(withId(R.id.mozac_browser_toolbar_security_indicator))
|
||||
|
||||
private fun disableEnhancedTrackingProtection() =
|
||||
onView(ViewMatchers.withResourceName("switch_widget"))
|
||||
@ -133,7 +122,7 @@ private fun openEnhancedTrackingProtectionSettings() =
|
||||
onView(ViewMatchers.withId(R.id.protection_settings))
|
||||
|
||||
private fun openEnhancedTrackingProtectionDetails() =
|
||||
onView(ViewMatchers.withId(R.id.tracking_content))
|
||||
onView(ViewMatchers.withId(R.id.trackingProtectionDetails))
|
||||
|
||||
private fun assertTrackingCookiesBlocked() {
|
||||
mDevice.findObject(UiSelector().resourceId("$packageName:id/cross_site_tracking"))
|
||||
|
@ -50,8 +50,6 @@ class SettingsSubMenuEnhancedTrackingProtectionRobot {
|
||||
|
||||
fun verifyEnhancedTrackingProtectionOptions() = assertEnhancedTrackingProtectionOptions()
|
||||
|
||||
fun verifyEnhancedTrackingProtectionOptionsGrayedOut() = assertEnhancedTrackingProtectionOptionsGrayedOut()
|
||||
|
||||
fun verifyTrackingProtectionSwitchEnabled() = assertTrackingProtectionSwitchEnabled()
|
||||
|
||||
fun switchEnhancedTrackingProtectionToggle() = onView(withResourceName("switch_widget")).click()
|
||||
|
Loading…
Reference in New Issue
Block a user