Skip to content

Make Theme Preview tooltip delay test deterministic - #3258

Merged
ymichael merged 1 commit into
mainfrom
bb/ci-flake-fix-theme-preview-tooltip-dismissal-thr_bi3h5tmfs6
Sep 8, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/ci-flake-fix-theme-preview-tooltip-dismissal-thr_bi3h5tmfs6

Conversation

@ymichael

@ymichael ymichael commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The tooltip test compared a 250 ms real-time sleep with the production 700 ms dismissal timer. If the test worker was suspended past 700 ms, React's async act could process the already-due dismissal before returning from the shorter sleep, so the intermediate assertion observed null even though production retained the correct 700 ms delay. A bounded 750 ms event-loop suspension reproduced the exact current-main assertion failure.

What changed

Theme Preview's test now switches to fake timers only after focus has opened the tooltip, then checks the exact dismissal boundary: content remains at 699 ms and disappears after the final 1 ms. Production code and its 700 ms delay are unchanged.

How you verified

  • Before: focused current-main test passed unloaded and in 6 contended runs; a bounded 750 ms event-loop suspension reproduced expected null not to be null at the intermediate assertion.
  • After: focused regression test passed.
  • After: 10/10 focused runs passed with four bounded CPU-load workers and two concurrent single-worker Vitest lanes; cleanup left zero load or Vitest processes.
  • pnpm exec turbo run test --filter=bb-plugin-theme-preview --concurrency=2 --output-logs=full --summarize=false (74 tests passed)
  • pnpm exec turbo run typecheck --filter=bb-plugin-theme-preview --concurrency=2 --output-logs=full --summarize=false
  • pnpm exec turbo run build --filter=bb-app --concurrency=2 --output-logs=full --summarize=false (12 tasks passed)
  • git diff --check

AGENT GENERATED: by GPT-5.6-Sol

@ymichael
ymichael merged commit c426b26 into main Sep 8, 2026
16 checks passed
@ymichael
ymichael deleted the bb/ci-flake-fix-theme-preview-tooltip-dismissal-thr_bi3h5tmfs6 branch September 8, 2026 18:03
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