Skip to content

UI tests: fix six order-dependent flakes and cut 5 s off the suite - #14591

Merged
niksedk merged 1 commit into
mainfrom
claude/flaky-tests-optimization-5dd6e8
Sep 6, 2026
Merged

UI tests: fix six order-dependent flakes and cut 5 s off the suite#14591
niksedk merged 1 commit into
mainfrom
claude/flaky-tests-optimization-5dd6e8

Conversation

@niksedk

@niksedk niksedk commented Sep 6, 2026

Copy link
Copy Markdown
Member

What

Triage of the first-attempt failures in the last ~60 tests.yml runs (via the "Flaky test run" annotations), plus an after-each-test probe run locally that logged libse settings, thread-pool size and the focused window after every test.

Flakes fixed

Test Hits Cause
FixCommonErrorsUnfixableErrorsTests.Scan_ReportsErrorsThatCouldNotBeFixed 4 (3 red through the retry) SplitManagerTests sets MinimumBetweenLines.Milliseconds = 0 in nearly every test and never restores it; the next MainView host mirrors 0 into libse, and the "unfixable" 300 ms line becomes extendable by 20 ms
SpeechToTextQualityReportTests.Fix_FixShortDuration_RunsAfterSplitLines 2 same leak, split halves end up touching
UndoRedoManagerTests.CheckForChanges_OverlappingTick 3 first tick queued via Task.Run starved behind blocked pool threads (pool is 40-130 threads deep by then); now a dedicated thread
SpellCheckPlayCurrentLineTests.* (cleanup failures) 1 block no dictionaries on CI → Initialize posts the get-dictionaries dialog at Background priority → null service provider throws inside the posted job. Reproduced locally by pointing Se.DictionariesFolder at an empty dir; a seeded dictionary entry skips the dialog
MainMenuKeyboardActivationTests.BareAlt_ClosesTheMenu_WhileFocusIsInsideAnOpenDropDown 2 + local Down sent before the first header holds focus
TimeCodeUpDownNegativeTests.SteppingAcrossZeroUpdatesSignAndCaret 1 first key before the focus settled

Also closes the window AudioVisualizerOriginalTextTests left open (the only unclosed window in the suite).

Not touched: BurnInWindowTests failures were both on one PR branch (a real regression there, since fixed).

Speed

Test Before After
LibMpvEventLoopTests.EventLoop_ForwardsMpvWarningsAndErrors 2.5 s (15 s in one run) 30 ms
FontCollectorEmbeddedMatchTests.EmbeddedFontRoundTrip_DecodesToLoadableTypeface 2.9 s 26 ms

Nothing was removed; the remaining slow classes (MultipleReplacePreviewTests ~9 s on a real 250 ms timer, MainReadOnlyOriginalTests ~8 s of MainView hosting) are legitimately waiting.

Verification

Full UITests locally: two runs before the change failed one test each (menu drop-down; STT short duration), two runs after are clean (4894 passed, 1 skipped).

🤖 Generated with Claude Code

Flakes from the last two days of CI runs (first-attempt failures):

- FixCommonErrorsUnfixableErrorsTests / SpeechToTextPostProcessorTests
  short-duration tests: SplitManagerTests zeroes
  Se.Settings.General.MinimumBetweenLines in nearly every test and never
  restores it; the next MainView host mirrors 0 into libse's
  Configuration.Settings, and FixShortDisplayTimes then extends lines the
  scenarios rely on being unfixable. Restore in SplitManagerTests, and pin
  the libse gap in both victims.
- UndoRedoManagerTests.CheckForChanges_OverlappingTick: the first tick was
  queued with Task.Run and starved behind blocked pool threads (the pool
  is ~40-130 threads deep by then); use a dedicated thread.
- SpellCheckPlayCurrentLineTests: with no dictionaries (the CI runner)
  Initialize posts the get-dictionaries dialog at Background priority and
  the null service provider throws inside that job, on whatever test pumps
  next. Point the dictionaries folder at an empty dir so the local run
  takes the CI path, and seed one dictionary entry so no dialog is posted.
- MainMenuKeyboardActivationTests bare-Alt drop-down: wait for the first
  header to hold focus before sending Down.
- TimeCodeUpDownNegativeTests: settle the dispatcher after Focus().
- AudioVisualizerOriginalTextTests: the window was never closed.

Speed:

- LibMpvEventLoopTests.EventLoop_ForwardsMpvWarningsAndErrors: the
  missing file had a .wav extension, so LoadFile polled the duration for
  2.5 s after the failed open (15 s in one run, behind the starved pool).
  A .mp4 name takes it to ~30 ms.
- FontCollectorEmbeddedMatchTests round trip: Assert.Equal over an
  IEnumerable<byte> of a ~1 MB font took ~3 s; span compare is ~25 ms.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@niksedk
niksedk merged commit cecca6e into main Sep 6, 2026
1 check passed
@niksedk
niksedk deleted the claude/flaky-tests-optimization-5dd6e8 branch September 6, 2026 05:32
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