test(webviews): U2 waits for conditions, not fixed times (157 waits)

Merged
TE
15d ago
+109-88

Part of the fixed-wait sweep that followed the ratchet in #23365. This PR removes 157 fixed-time waits from 19 webview unit-test files, and none are left in them. Their rows leave webviews/scripts/fixed-waits-baseline.tsv.

  • Timing under test now runs on bun's fake timers:
    • the New Tab's picked-name fade
    • the summary card's running-time tick
    • the kept-attachments rest timer
    • the transcript's anchor settle
    • the tooltip's scroll quiet time, which is now also checked inside the quiet window
    • the link bubble's no-hover-card check
  • Polls that already wait on a condition (render card, dropped chips, KaTeX, prompt accepted) yield one macrotask per try instead of sleeping.
  • The image viewer's actions wait for the host request, or for the refusal label. The changelog pages wait for their release to draw.
  • Menu and composer settle() helpers and PreviewCard's teardown yield one macrotask instead of sleeping 20 ms. act() already flushes the rest.
  • Negative asserts (no bubble, one request) let promises and a later task run before they check for absence.

It also carries #23414 (the base-red marker fix), which drops out once that merges.

Verification: an independent subagent review said SHIP. Each changed file passed 3 runs of bun test, and bun run check passes, including check:fixed-waits (835 on the baseline).

Agent session: huge-blue

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Removes all 157 fixed-time waits from 19 webview unit-test files so tests no longer sleep a fixed number of milliseconds. Timing under test now runs on bun's fake clock, and polls yield one macrotask per try until their condition is met.

  • The picked-name fade, running-time tick, kept-attachments rest timer, anchor settle, tooltip scroll quiet time, and no-hover-card check now run on fake timers the test advances.
  • Render-card, dropped-chip, KaTeX, and prompt-accepted polls yield one macrotask per try instead of sleeping.
  • Viewer actions wait for the host request or the refusal label; changelog pages wait for their release to draw.
  • Menu and composer settle() helpers and PreviewCard teardown yield one macrotask, with act() flushing the rest.
  • Negative asserts (no bubble, one request) yield a task before checking for absence.
  • The two 3-second frame-watch windows keep their waits with a // fixed-wait marker since the observation window is the test.