Commit 10dadb83 authored by Oana Horvath's avatar Oana Horvath
Browse files

Closes #12899: fixed UI test for ETP off

parent d45bdfb0
......@@ -10,7 +10,6 @@ import androidx.test.uiautomator.UiDevice
import okhttp3.mockwebserver.MockWebServer
import org.junit.After
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
......@@ -130,9 +129,8 @@ class SmokeTest {
}
}
@Ignore("Flaky test: https://github.com/mozilla-mobile/fenix/issues/12899")
@Test
fun verifyETPToolbarShieldIconIsNotDisplayedIfETPIsOFFGloballyTest() {
fun verifyETPShieldNotDisplayedIfOFFGlobally() {
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
homeScreen {
......@@ -149,9 +147,8 @@ class SmokeTest {
}.openSettings {
}.openEnhancedTrackingProtectionSubMenu {
clickEnhancedTrackingProtectionDefaults()
}.goBackToHomeScreen {
}.openTabDrawer {
}.openTab(defaultWebPage.title) {
}.goBack {
}.goBackToBrowser {
clickEnhancedTrackingProtectionPanel()
verifyEnhancedTrackingProtectionSwitch()
// Turning off TP Switch results in adding the WebPage to exception list
......
......@@ -33,6 +33,7 @@ import androidx.test.uiautomator.UiSelector
import androidx.test.uiautomator.Until
import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.CoreMatchers.containsString
import org.hamcrest.Matchers.not
import org.junit.Assert.assertTrue
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.components
......@@ -185,10 +186,10 @@ class BrowserRobot {
.perform(ViewActions.pressBack())
}
fun clickEnhancedTrackingProtectionPanel() = enhancedTrackingProtectionPanel().click()
fun clickEnhancedTrackingProtectionPanel() = enhancedTrackingProtectionIndicator().click()
fun verifyEnhancedTrackingProtectionPanelNotVisible() =
assertEnhancedTrackingProtectionPanelNotVisible()
assertEnhancedTrackingProtectionIndicatorNotVisible()
fun clickContextOpenLinkInNewTab() {
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
......@@ -413,12 +414,11 @@ fun navURLBar() = onView(withId(R.id.mozac_browser_toolbar_url_view))
private fun assertNavURLBar() = navURLBar()
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
fun enhancedTrackingProtectionPanel() =
fun enhancedTrackingProtectionIndicator() =
onView(withId(R.id.mozac_browser_toolbar_tracking_protection_indicator))
private fun assertEnhancedTrackingProtectionPanelNotVisible() {
enhancedTrackingProtectionPanel()
.check(matches(withEffectiveVisibility(Visibility.GONE)))
private fun assertEnhancedTrackingProtectionIndicatorNotVisible() {
enhancedTrackingProtectionIndicator().check(matches(not(isDisplayed())))
}
private fun assertEnhancedTrackingProtectionSwitch() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment