pull/600/head
Oana Horvath 4 years ago
parent 1ed7efce41
commit 6b4fbca1bb

@ -10,7 +10,6 @@ import androidx.test.uiautomator.UiDevice
import okhttp3.mockwebserver.MockWebServer import okhttp3.mockwebserver.MockWebServer
import org.junit.After import org.junit.After
import org.junit.Before import org.junit.Before
import org.junit.Ignore
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.helpers.AndroidAssetDispatcher import org.mozilla.fenix.helpers.AndroidAssetDispatcher
@ -130,9 +129,8 @@ class SmokeTest {
} }
} }
@Ignore("Flaky test: https://github.com/mozilla-mobile/fenix/issues/12899")
@Test @Test
fun verifyETPToolbarShieldIconIsNotDisplayedIfETPIsOFFGloballyTest() { fun verifyETPShieldNotDisplayedIfOFFGlobally() {
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
homeScreen { homeScreen {
@ -149,9 +147,8 @@ class SmokeTest {
}.openSettings { }.openSettings {
}.openEnhancedTrackingProtectionSubMenu { }.openEnhancedTrackingProtectionSubMenu {
clickEnhancedTrackingProtectionDefaults() clickEnhancedTrackingProtectionDefaults()
}.goBackToHomeScreen { }.goBack {
}.openTabDrawer { }.goBackToBrowser {
}.openTab(defaultWebPage.title) {
clickEnhancedTrackingProtectionPanel() clickEnhancedTrackingProtectionPanel()
verifyEnhancedTrackingProtectionSwitch() verifyEnhancedTrackingProtectionSwitch()
// Turning off TP Switch results in adding the WebPage to exception list // 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 androidx.test.uiautomator.Until
import org.hamcrest.CoreMatchers.allOf import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.CoreMatchers.containsString import org.hamcrest.CoreMatchers.containsString
import org.hamcrest.Matchers.not
import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
@ -185,10 +186,10 @@ class BrowserRobot {
.perform(ViewActions.pressBack()) .perform(ViewActions.pressBack())
} }
fun clickEnhancedTrackingProtectionPanel() = enhancedTrackingProtectionPanel().click() fun clickEnhancedTrackingProtectionPanel() = enhancedTrackingProtectionIndicator().click()
fun verifyEnhancedTrackingProtectionPanelNotVisible() = fun verifyEnhancedTrackingProtectionPanelNotVisible() =
assertEnhancedTrackingProtectionPanelNotVisible() assertEnhancedTrackingProtectionIndicatorNotVisible()
fun clickContextOpenLinkInNewTab() { fun clickContextOpenLinkInNewTab() {
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) 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() private fun assertNavURLBar() = navURLBar()
.check(matches(withEffectiveVisibility(Visibility.VISIBLE))) .check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
fun enhancedTrackingProtectionPanel() = fun enhancedTrackingProtectionIndicator() =
onView(withId(R.id.mozac_browser_toolbar_tracking_protection_indicator)) onView(withId(R.id.mozac_browser_toolbar_tracking_protection_indicator))
private fun assertEnhancedTrackingProtectionPanelNotVisible() { private fun assertEnhancedTrackingProtectionIndicatorNotVisible() {
enhancedTrackingProtectionPanel() enhancedTrackingProtectionIndicator().check(matches(not(isDisplayed())))
.check(matches(withEffectiveVisibility(Visibility.GONE)))
} }
private fun assertEnhancedTrackingProtectionSwitch() { private fun assertEnhancedTrackingProtectionSwitch() {

Loading…
Cancel
Save