From c18fa2d3958775f73adc8cdef6b94dcaf326a5ad Mon Sep 17 00:00:00 2001 From: sergiomartins8 Date: Wed, 17 Jan 2024 16:19:27 +0000 Subject: [PATCH] retry --- .github/workflows/integration_tests.yml | 2 +- .../com/onfido/evergreen/RetryTestRule.kt | 45 ------------------- .../evergreen/WebViewIntegrationTest.kt | 4 -- 3 files changed, 1 insertion(+), 50 deletions(-) delete mode 100644 app/src/androidTest/java/com/onfido/evergreen/RetryTestRule.kt diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index f766fcd..b9ee29f 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -13,7 +13,7 @@ jobs: runs-on: macos-latest strategy: matrix: - api-level: [ 34 ] + api-level: [ 32 ] steps: - name: Checkout diff --git a/app/src/androidTest/java/com/onfido/evergreen/RetryTestRule.kt b/app/src/androidTest/java/com/onfido/evergreen/RetryTestRule.kt deleted file mode 100644 index 5ae2952..0000000 --- a/app/src/androidTest/java/com/onfido/evergreen/RetryTestRule.kt +++ /dev/null @@ -1,45 +0,0 @@ -package com.onfido.evergreen - -import android.util.Log -import org.junit.rules.TestRule -import org.junit.runner.Description -import org.junit.runners.model.Statement - -/** - * Retry test rule used to retry test that failed. - * Retry failed test 3 times - */ -class RetryTestRule(val retryCount: Int = 3) : TestRule { - - private val TAG = RetryTestRule::class.java.simpleName - - override fun apply(base: Statement, description: Description): Statement { - return statement(base, description) - } - - private fun statement(base: Statement, description: Description): Statement { - return object : Statement() { - @Throws(Throwable::class) - override fun evaluate() { - var caughtThrowable: Throwable? = null - - // implement retry logic here - for (i in 0 until retryCount) { - try { - base.evaluate() - return - } catch (t: Throwable) { - caughtThrowable = t - Log.e(TAG, description.displayName + ": run " + (i + 1) + " failed") - } - } - - Log.e( - TAG, - description.displayName + ": giving up after " + retryCount + " failures" - ) - throw caughtThrowable!! - } - } - } -} diff --git a/app/src/androidTest/java/com/onfido/evergreen/WebViewIntegrationTest.kt b/app/src/androidTest/java/com/onfido/evergreen/WebViewIntegrationTest.kt index ad1dde2..6b5a9cf 100644 --- a/app/src/androidTest/java/com/onfido/evergreen/WebViewIntegrationTest.kt +++ b/app/src/androidTest/java/com/onfido/evergreen/WebViewIntegrationTest.kt @@ -27,10 +27,6 @@ class WebViewIntegrationTest { @get:Rule var activityScenarioRule = activityScenarioRule() - @Rule - @JvmField - val mRetryTestRule = RetryTestRule() - @Test fun openApp() { onView(withId(R.id.webview)).check(matches(isDisplayed()))