For #25726 fix failing testStrictVisitSheetDetails UI test

pull/543/head
AndiAJ 2 years ago committed by mergify[bot]
parent fbb678f7da
commit fe0165a846

@ -161,7 +161,6 @@ class StrictEnhancedTrackingProtectionTest {
}
}
@Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/25726")
@Test
fun testStrictVisitSheetDetails() {
val genericPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
@ -176,7 +175,9 @@ class StrictEnhancedTrackingProtectionTest {
}
navigationToolbar {
}.enterURLAndEnterToBrowser(trackingProtectionTest.url) {}
}.enterURLAndEnterToBrowser(trackingProtectionTest.url) {
verifyTrackingProtectionWebContent("blocked")
}
enhancedTrackingProtection {
}.openEnhancedTrackingProtectionSheet {
verifyEnhancedTrackingProtectionSheetStatus("ON", true)

@ -41,6 +41,7 @@ import org.junit.Assert.fail
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.helpers.Constants.LONG_CLICK_DURATION
import org.mozilla.fenix.helpers.Constants.RETRY_COUNT
import org.mozilla.fenix.helpers.SessionLoadedIdlingResource
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeLong
@ -682,6 +683,31 @@ class BrowserRobot {
)
}
fun verifyTrackingProtectionWebContent(state: String) {
for (i in 1..RETRY_COUNT) {
try {
assertTrue(
mDevice.findObject(
UiSelector().textContains(state)
).waitForExists(waitingTimeLong)
)
break
} catch (e: AssertionError) {
if (i == RETRY_COUNT) {
throw e
} else {
Log.e("TestLog", "On try $i, trackers are not: $state")
navigationToolbar {
}.openThreeDotMenu {
}.refreshPage {
}
}
}
}
}
class Transition {
private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
private fun threeDotButton() = onView(

Loading…
Cancel
Save