Skip to content

Fix flaky AnkiDroidJsAPITest on Windows CI#1

Open
kevs-mist wants to merge 1 commit intofix/jsapi-test-flaky-windows-timeoutfrom
kevs-mist-patch-1
Open

Fix flaky AnkiDroidJsAPITest on Windows CI#1
kevs-mist wants to merge 1 commit intofix/jsapi-test-flaky-windows-timeoutfrom
kevs-mist-patch-1

Conversation

@kevs-mist
Copy link
Owner


Purpose / Description
AnkiDroidJsAPITest flakes on Windows CI with UncompletedCoroutinesError: After waiting for 1m, the test body did not run to completion. On slow Windows runners, startReviewer() and advanceRobolectricLooper() consume most of the default 1-minute runTest budget before any assertions run, causing sporadic timeouts.

Fixes

Approach

  • Added an explicit 5.minutes timeout constant (TEST_TIMEOUT) to all runTest calls in the class, giving adequate headroom on slow CI runners while still catching genuine hangs
  • Fixed ankiJsUiTest which was annotated with @override instead of @Test, causing it to be silently skipped by JUnit and never actually run

How Has This Been Tested?
Verified locally that TEST_TIMEOUT is present in the file. The flake is infrastructure-dependent (Windows CI runner slowness) so cannot be fully reproduced locally, but the fix directly addresses the timeout budget issue identified in the CI logs.

Learning
The default runTest timeout of 1 minute is documented in kotlinx.coroutines.test — it is intentionally tight for unit tests but insufficient for Robolectric tests that spin up a full Reviewer activity. See [kotlinx.coroutines TestBuilders docs](https://kotlinx.github.io/kotlinx.coroutines/kotlinx-coroutines-test/kotlinx.coroutines.test/run-test.html).


Checklist:

  • Check the first three boxes ✅
  • Leave the UI and accessibility ones unchecked (no UI changes)

- Add an explicit 5-minute timeout to all runTest calls to prevent
  UncompletedCoroutinesError on slow Windows runners, where startReviewer()
  and advanceRobolectricLooper() consume most of the default 1-minute budget
- Fix ankiJsUiTest silently not running due to @OverRide instead of @test

Fixes ankidroid#20377."
@kevs-mist
Copy link
Owner Author

Please review the text and inform me if any changes are needed. If no changes are required, please allow me to commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant