Bug 1827406 - New connection error message UI test

fenix/114.1.0
AndiAJ 1 year ago committed by mergify[bot]
parent 304ff9a0b7
commit 23bbffe22b

@ -5,6 +5,7 @@
package org.mozilla.fenix.ui package org.mozilla.fenix.ui
import androidx.core.net.toUri import androidx.core.net.toUri
import org.junit.After
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.mozilla.fenix.R import org.mozilla.fenix.R
@ -12,6 +13,8 @@ import org.mozilla.fenix.customannotations.SmokeTest
import org.mozilla.fenix.helpers.HomeActivityTestRule import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.RetryTestRule import org.mozilla.fenix.helpers.RetryTestRule
import org.mozilla.fenix.helpers.TestHelper.getStringResource import org.mozilla.fenix.helpers.TestHelper.getStringResource
import org.mozilla.fenix.helpers.TestHelper.setNetworkEnabled
import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.navigationToolbar import org.mozilla.fenix.ui.robots.navigationToolbar
/** /**
@ -31,6 +34,12 @@ class BrowsingErrorPagesTest {
@JvmField @JvmField
val retryTestRule = RetryTestRule(3) val retryTestRule = RetryTestRule(3)
@After
fun tearDown() {
// Restoring network connection
setNetworkEnabled(true)
}
@SmokeTest @SmokeTest
@Test @Test
fun blockMalwarePageTest() { fun blockMalwarePageTest() {
@ -74,4 +83,33 @@ class BrowsingErrorPagesTest {
verifyPageContent(harmfulSiteWarning) verifyPageContent(harmfulSiteWarning)
} }
} }
@Test
fun connectionFailureErrorMessageTest() {
val url = "example.com"
navigationToolbar {
}.enterURLAndEnterToBrowser(url.toUri()) {
waitForPageToLoad()
verifyPageContent("Example Domain")
}
setNetworkEnabled(false)
browserScreen {
}.openThreeDotMenu {
}.refreshPage {
waitForPageToLoad()
verifyConnectionErrorMessage()
}
setNetworkEnabled(true)
browserScreen {
}.openThreeDotMenu {
}.refreshPage {
waitForPageToLoad()
verifyPageContent("Example Domain")
}
}
} }

@ -1080,6 +1080,15 @@ class BrowserRobot {
exists = exists, exists = exists,
) )
fun verifyConnectionErrorMessage() {
assertItemContainingTextExists(
itemContainingText(getStringResource(R.string.mozac_browser_errorpages_connection_failure_title)),
itemContainingText("The site could be temporarily unavailable or too busy. Try again in a few moments."),
itemContainingText("If you are unable to load any pages, check your devices data or Wi-Fi connection."),
)
assertItemWithResIdExists(itemWithResId("errorTryAgain"))
}
class Transition { class Transition {
private fun threeDotButton() = onView( private fun threeDotButton() = onView(
allOf( allOf(

Loading…
Cancel
Save