test(webviews): B3 waits for conditions, not fixed times (155 waits)

Merged
TE
15d ago
+638-211

Third browser batch of the fixed-wait sweep. It removes all 155 fixed waits in 18 test files, and none are kept with a marker. Frame waits use the shared paintedFrames helper (#23374).

  • Settling: most files now wait until no animation is running and the scroll position or box holds still over several painted frames. This covers diff-virtualization, older-rows-fade, reading-place, queue-collapse, thread-minimap-motion and support/papercutChat. diff-virtualization's "no jump" check needs the header at offset 0 for 30 painted frames in a row. queue-collapse's rest needs 10 frames with no scroll event.
  • Stand-ins that wait for the test: in new-tab-warm-first-frame, the stand-in host and daemon hold their answers until the test releases them. In attach-links, the daemon resolves a promise when the prompt arrives.
  • Absence checks: start-mode-chip records its own start-mode requests. Its "returning asks nothing" check waits for every answer after a pushed change and counts exactly one ask, so a re-ask sent 100 ms after focus fails it. ime-composition-keys checks after two painted frames.
  • Polls: loops in agents-pill, unsent-draft and markdown-wide-width-layout became waitForFunction or locator.waitFor on the state the test then checks.
  • Merge with base: base changed papercutChat (#23243 added an options.ready selector) and thread-minimap-motion (#23529 samples after the frame paints). Both sides are kept. Both files and wheel-pass-through, which uses papercutChat, pass on the merged head.
  • Known flake: thread-minimap-motion's click-scroll timing check fails some runs on unchanged base as well (608 to 635 ms against a 500 ms limit under load).
  • Review: the independent review returned FIX for the start-mode-chip absence check, which caught only an immediate re-ask; that is fixed in this PR. It also noted two waits that end only at the bun timeout and two that swallow their timeout as before; these are minor and not changed.

Files:

  • webviews/test/agent-pane-agents-pill.test.ts
  • webviews/test/agent-pane-attach-links.test.ts
  • webviews/test/agent-pane-older-rows-fade.test.ts
  • webviews/test/agent-pane-queue-collapse.test.ts
  • webviews/test/agent-pane-reading-place.test.ts
  • webviews/test/agent-pane-soft-edges.test.ts
  • webviews/test/agent-pane-start-mode-chip.test.ts
  • webviews/test/agent-pane-unsent-draft.test.ts
  • webviews/test/desktop-feel.test.ts
  • webviews/test/diff-virtualization.test.ts
  • webviews/test/ime-composition-keys.test.ts
  • webviews/test/markdown-wide-width-layout.test.ts
  • webviews/test/menu-pointer-close-focus.test.ts
  • webviews/test/new-tab-warm-first-frame.test.ts
  • webviews/test/quick-composer-chief-dock.test.ts
  • webviews/test/quiet-access-chip.test.ts
  • webviews/test/support/papercutChat.ts
  • webviews/test/thread-minimap-motion.test.ts

Checks: the baseline only goes down. Measured against base with the lane's row check, no row is raised or added, and every changed row belongs to a file this PR changes. check:fixed-waits, check:browser-lanes, bun run check and scripts/web-lint.sh pass on the merged head. Each changed file ran 3 times with CMUX_BROWSER_TESTS=1, one browser file at a time.

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

Third batch of the fixed-wait sweep: replaces all 155 fixed waits in 18 webview test files with condition-based waits, mostly using the shared paintedFrames helper.

  • Most files wait until no animation runs and the scroll position or box holds still over several painted frames; the diff viewer also waits for CodeView to re-enable pointer events after a scroll.
  • Stand-in hosts and daemons hold their answers until the test releases them (new-tab-warm-first-frame) or resolve a promise when a request arrives (attach-links, start-mode-chip), instead of answering after delays.
  • Absence checks wait for a positive signal first: start-mode-chip counts its own _acpmux/start_mode asks and waits for every answer after a pushed change, so a re-ask sent 100 ms after focus fails it.
  • Polls with sleeps became waitForFunction or locator.waitFor on the state the test then asserts.
  • The review's FIX for the start-mode-chip absence check is in; the two waits that end only at the bun timeout and the two that swallow their timeout are unchanged.
  • thread-minimap-motion's click-scroll timing check still flakes on unchanged base (608–635 ms against a 500 ms limit under load).
  • The baseline row for each changed file moves to zero; no row is raised or added.