Skip to content

Commit

Permalink
test(custom-scheduler): add retries, re-enable in CI
Browse files Browse the repository at this point in the history
with appropriate retries it appears to work reliably
  • Loading branch information
mikehardy committed Jun 3, 2024
1 parent 7030339 commit 8d5d3da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.ichi2.anki.preferences.sharedPrefs
import com.ichi2.anki.tests.InstrumentedTest
import com.ichi2.anki.tests.libanki.RetryRule
import com.ichi2.anki.testutil.GrantStoragePermission.storagePermission
import com.ichi2.anki.testutil.grantPermissions
import com.ichi2.anki.testutil.notificationPermission
import com.ichi2.libanki.Collection
import com.ichi2.testutils.Flaky
import com.ichi2.testutils.OS
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
import org.junit.Rule
Expand All @@ -56,8 +55,10 @@ class ReviewerFragmentTest : InstrumentedTest() {
@get:Rule
val runtimePermissionRule = grantPermissions(storagePermission, notificationPermission)

@get:Rule
val retry = RetryRule(10)

@Test
@Flaky(os = OS.ALL, "Fails on CI with timing issues frequently")
fun testCustomSchedulerWithCustomData() {
setNewReviewer()
col.cardStateCustomizer =
Expand Down Expand Up @@ -95,7 +96,6 @@ class ReviewerFragmentTest : InstrumentedTest() {
}

@Test
@Flaky(os = OS.ALL, "Fails on CI with timing issues frequently")
fun testCustomSchedulerWithRuntimeError() {
setNewReviewer()
// Issue 15035 - runtime errors weren't handled
Expand Down
8 changes: 4 additions & 4 deletions AnkiDroid/src/androidTest/java/com/ichi2/anki/ReviewerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.ichi2.anki.tests.InstrumentedTest
import com.ichi2.anki.tests.libanki.RetryRule
import com.ichi2.anki.testutil.GrantStoragePermission.storagePermission
import com.ichi2.anki.testutil.ThreadUtils
import com.ichi2.anki.testutil.grantPermissions
import com.ichi2.anki.testutil.notificationPermission
import com.ichi2.libanki.Collection
import com.ichi2.testutils.Flaky
import com.ichi2.testutils.OS
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
import org.junit.Rule
Expand All @@ -59,8 +58,10 @@ class ReviewerTest : InstrumentedTest() {
@get:Rule
val runtimePermissionRule = grantPermissions(storagePermission, notificationPermission)

@get:Rule
val retry = RetryRule(10)

@Test
@Flaky(os = OS.ALL, "Fails on CI with timing issues frequently")
fun testCustomSchedulerWithCustomData() {
col.cardStateCustomizer =
"""
Expand Down Expand Up @@ -108,7 +109,6 @@ class ReviewerTest : InstrumentedTest() {
}

@Test
@Flaky(os = OS.ALL, "Fails on CI with timing issues frequently")
fun testCustomSchedulerWithRuntimeError() {
// Issue 15035 - runtime errors weren't handled
col.cardStateCustomizer = "states.this_is_not_defined.normal.review = 12;"
Expand Down

0 comments on commit 8d5d3da

Please sign in to comment.