Skip to content

test(ui): share pauseVirtualClock e2e helper and de-flake marquee hover-delay asserts - #115203

Merged
steipete merged 1 commit into
mainfrom
steipete/e2e-virtual-clock-pause
Jul 28, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/e2e-virtual-clock-pause

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

PR #115187 fixed a checks-ui-e2e flake where page.clock.install() without a pause let real CI seconds leak into a virtual-time assertion (expected '2m 57s', received '2m 59s'). A follow-up audit of every page.clock user in ui/src/e2e found one more latent instance of the same class, plus two inline copies of the subtle pause logic worth centralizing.

The latent flake: the marquee test in ui/src/e2e/chat-flow.navigation-presentation.e2e.test.ts dispatches mouseenter, advances the virtual clock 250ms, and asserts the marquee is not yet scrolling against a 500ms hover-intent delay (MARQUEE_HOVER_DELAY_MS in ui/src/lib/hover-marquee.ts). With an unpaused installed clock, more than 250ms of real time between the hover and the assert starts the marquee early and fails the test — the same non-monotone-assertion mechanism as #115187, just with 250ms headroom instead of 0.

All other clock users in the suite (github-link-hovercard, login-gate, session-management.groups, claude-sessions, agent-select-avatar-timeout, approval-page, lobster-pet) make monotone assertions ("after enough time, X happened" / "still nothing after extra time") or already pause/fix the time, which extra real ticking cannot flip; they are intentionally untouched.

Why This Change Was Made

  • New shared helper pauseVirtualClock(page) in ui/src/test-helpers/control-ui-e2e.ts owns the non-obvious boundary logic (pause slightly ahead of the current virtual time so the pauseAt target stays ahead of the still-ticking clock). Three call sites now share it instead of copying it.
  • mantis-chat-proof.e2e.test.ts and chat-run-lifecycle.e2e.test.ts migrate their inline copies from test(ui): pause fake clock before send so working-timer e2e assertions are deterministic #115187 onto the helper.
  • The marquee test freezes the clock for the hover-delay window, which also strengthens it: the "still not scrolling after mouseleave + 300ms" assert now proves the leave-cancel (250+300 > 500 would have fired the marquee otherwise), and the scroll-start assert becomes a deterministic runFor(500) instead of a 1.5s real-time poll. The clock then resume()s before the snap-back assert, which depends on a compositor-driven CSS transition, not fake timers.

User Impact

None — test-only. Removes the remaining latent instance of the #115187 flake class from checks-ui-e2e.

Evidence

All three affected specs pass:

$ node scripts/run-vitest.mjs ui/src/e2e/mantis-chat-proof.e2e.test.ts ui/src/e2e/chat-run-lifecycle.e2e.test.ts
 Test Files  2 passed (2)
      Tests  5 passed (5)

$ node scripts/run-vitest.mjs ui/src/e2e/chat-flow.navigation-presentation.e2e.test.ts
 Test Files  1 passed (1)
      Tests  11 passed (11)

Determinism proof (before/after with simulated CI slowness). Injecting a real await page.waitForTimeout(400) after the marquee mouseenter (more than the pre-fix 250ms headroom) reproduces the latent flake on the pre-fix code and passes with this PR:

Before (pre-fix marquee code, 400ms delay injected):

 FAIL  |ui-e2e| ui/src/e2e/chat-flow.navigation-presentation.e2e.test.ts > Control UI mocked Gateway E2E > keeps long sidebar labels clipped after a session switch
AssertionError: expected 'sidebar-recent-session__name hover-ma…' not to contain 'hover-marquee--scrolling'
Expected: "hover-marquee--scrolling"
Received: "sidebar-recent-session__name hover-marquee hover-marquee--scrolling"
 Test Files  1 failed (1)
      Tests  1 failed | 10 passed (11)

After (this PR, same 400ms delay injected):

 Test Files  1 passed (1)
      Tests  11 passed (11)
  • Codex autoreview (gpt-5.6-sol, xhigh): clean, "patch is correct (0.94)".

@steipete
steipete marked this pull request as ready for review July 28, 2026 13:11
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XS maintainer Maintainer-authored PR labels Jul 28, 2026
@steipete
steipete merged commit dca5b66 into main Jul 28, 2026
132 of 137 checks passed
@steipete
steipete deleted the steipete/e2e-virtual-clock-pause branch July 28, 2026 13:59
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to christian-lallo/openclaw that referenced this pull request Jul 28, 2026
* origin/main: (150 commits)
  fix: preserve skill proposals across apply crashes and workspace moves (openclaw#114535)
  fix(qa): run maturity Docker scenarios through the aggregate scheduler (openclaw#114447)
  refactor(cli): unify configured model rows onto the shared row pipeline (openclaw#115239)
  fix(ui): stop modal autofocus steal after the open animation (openclaw#115168)
  fix(process): preserve long supervisor timeout deadlines (openclaw#115230)
  fix(slack): preserve pasted inbound tables (openclaw#115163)
  fix(codex): restore trajectory capture for canonical session targets (openclaw#115220)
  refactor(qa): make scenario selection taxonomy-owned (openclaw#114055)
  feat(plugins): match shared models across vendor-namespaced catalog ids (openclaw#115210)
  fix(ios): forgetting a paired gateway does nothing (openclaw#114083)
  test(ui): share pauseVirtualClock e2e helper and de-flake marquee hover-delay asserts (openclaw#115203)
  fix(docs): preserve pure fenced translation chunks (openclaw#115204)
  fix: keep shared web and TUI chats synchronized under load (openclaw#115191)
  fix(auto-reply): require a directed turn for the no-visible-reply fallback
  fix(auto-reply): attest source-routed message-tool sends via the dedupe route matcher
  fix(auto-reply): attest message-tool source replies in every delivery mode and gate eligibility on resolved settlement
  fix(auto-reply): bound turn-ledger settlement and treat started sends as conservatively visible
  fix(auto-reply): abort-aware fallback settlement and straggler drain in turn ledger
  fix(auto-reply): keep turn-ledger types module-local
  test(auto-reply): fix type-check errors in turn-ledger corner tests
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant