For #22640 re-enable verifyUndoSnackBarTest UI test, add and update RetryTestRule

This commit is contained in:
AndiAJ 2022-04-13 12:08:28 +03:00 committed by mergify[bot]
parent 09c93f0fce
commit 84184e03d2
2 changed files with 15 additions and 3 deletions

View File

@ -4,10 +4,11 @@
package org.mozilla.fenix.helpers
import androidx.test.uiautomator.UiObjectNotFoundException
import junit.framework.AssertionFailedError
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
import java.lang.AssertionError
class RetryTestRule(private val retryCount: Int = 5) : TestRule {
@ -21,6 +22,14 @@ class RetryTestRule(private val retryCount: Int = 5) : TestRule {
if (i == retryCount) {
throw t
}
} catch (t: AssertionFailedError) {
if (i == retryCount) {
throw t
}
} catch (t: UiObjectNotFoundException) {
if (i == retryCount) {
throw t
}
}
}
}

View File

@ -10,12 +10,12 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
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
import org.mozilla.fenix.helpers.FeatureSettingsHelper
import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.RetryTestRule
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.ui.robots.browserScreen
import org.mozilla.fenix.ui.robots.homeScreen
@ -48,6 +48,10 @@ class TabbedBrowsingTest {
@get:Rule
val activityTestRule = HomeActivityTestRule()
@Rule
@JvmField
val retryTestRule = RetryTestRule(3)
@Before
fun setUp() {
// disabling the new homepage pop-up that interferes with the tests.
@ -172,7 +176,6 @@ class TabbedBrowsingTest {
}
}
@Ignore("Currently failing, will need some investigation, see https://github.com/mozilla-mobile/fenix/issues/22640")
@Test
fun verifyUndoSnackBarTest() {
// disabling these features because they interfere with the snackbar visibility