Repository navigation
Tests: fix the Robolectric flakes (v2 Compose rule everywhere, Levels trial wait) - #21
Merged
Merged
Conversation
…s trial end to the minute The v1 rule's unconfined effect dispatcher resumed frames on the background thread that emitted a flow update (CalledFromWrongThreadException, 'performMeasureAndLayout called during measure layout', half-applied frames). Since the foss/play split runs every Robolectric test twice, that hit almost every CI run. 2429dfe fixed one test this way; this moves the other 34. LevelsGateTest waited for the trial end to match the stored start to the millisecond; until the stored start reaches the state it is a few ms off, and on a loaded runner that update missed the 30 s wait.
ApolloF
enabled auto-merge (squash)
October 12, 2026 14:30
CI run 38262804082 (foss): a sheet's text showed before its dialog window took focus, so Espresso's back press went to the activity and closed the app (NoActivityResumedException). Back on the dialog root waits for that focus.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main and the open release PRs fail on one random Robolectric test per run since the foss/play split runs the suite twice.
Cause. 34 of 46 Compose tests used the v1 test rule. Its unconfined effect dispatcher resumes the composition on whichever thread emitted a flow update (the view models'
flowOn(Dispatchers.Default)pipelines), so frames ran off the main thread:CalledFromWrongThreadException(TodayWeekPagerTest)performMeasureAndLayout called during measure layout(AppNavTest)2429dfe fixed one test this way; this moves the other 34 to
junit4.v2.createComposeRule, whose standard test dispatcher queues every resume for the test thread. Import change only.LevelsGateTest (no Compose rule) waited for the trial end to equal the stored start + 14 days to the millisecond. Until the stored start reaches the state, the gate shows a trial from "now", a few ms off; on a loaded runner that update missed the 30 s wait. It now compares to the minute (the banner shows a date).
Verification (local).
:core:domain:test: 526 passedtestFossDebugUnitTest: full suite, 208 tests, 0 failures (before the LevelsGateTest edit)testPlayDebugUnitTest: AppNav, LevelsScreen, TodayWeekPager, LevelsGate, JournalLogMenu, JournalHeaders, 18 tests, 0 failuresNot run locally: the full play suite, both lints, and the edited LevelsGateTest. The local runs were stopped by low memory, so CI covers those.