2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-02 03:40:16 +00:00

For #25726 fix failing testStrictVisitSheetDetails UI test

This commit is contained in:
AndiAJ 2022-06-24 12:12:05 +03:00 committed by mergify[bot]
parent fbb678f7da
commit fe0165a846
2 changed files with 29 additions and 2 deletions

View File

@ -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)

View File

@ -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(