Repository navigation
test: observe the service restart and the phone calendar tap deterministically - #567
Conversation
…as seen it The service simulator's restart reported ready again two seconds after it began, while the shell reloads half a second in and the widget then needs its frame, bridge handshake and availability before it disables a button. On a slow runner that pipeline outlasts the remaining window, so the disabled state was never drawn and "restart disables the add binding" timed out. The dev host now takes serviceRestart: "held", which keeps the services loading until finishServiceRestart() is called. The real-browser test holds the restart, waits for both bindings to be disabled, then finishes it and waits for recovery. The default stays a two-second restart.
…settled The phone week-view test tapped the offsite event right after centring it, while the transcript could still be moving: the follow-bottom smooth scroll can continue or restart after the instant scroll, and the calendar's row and card enter with a bounce that can look stable at its turn and then move again. In the failing CI trace the content moved about 39px under the tap point and the touch selected the next event down (evt_deploy). The test now waits for the entrance animations around the event to finish, then re-centres the event until the transcript stays still and sits beyond the follow-bottom slack, and only then hit-tests and taps.
|
Review attestation: ready to merge at A push to this PR makes this attestation stale; the new head needs its own review. |
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
Review attestation: ready to merge at A push to this PR makes this attestation stale; the new head needs its own review. |
|
Review attestation: ready to merge at A push to this PR makes this attestation stale; the new head needs its own review. |
Refs #543
Makes two of the flaky tests listed in #543 watch their transient state reliably. Each cause was shown from code and a reproduction before the fix. No retries, timeouts or assertions were loosened.
1. Service simulator: "timed out waiting for restart disables the add binding"
packages/widget-cli/test/service-simulator-real-browser.e2e.spec.ts(CI run 37560419435, job 112596164161)Cause. A simulated service restart set the services to loading, and a fixed 2 s timer then set them ready again. The browser has to do several steps inside that window before the widget shows the disabled state:
On a slow runner those steps outlast the window, so the disabled state is never drawn. A MutationObserver recorder at 8x CPU throttle confirmed this: the widget never rendered the disabled state before the timer fired. Polling harder cannot see a state that never exists.
Fix.
startDevHosttakes a new option,serviceRestart: "held", which keeps the restarted services loading untilDevHost.finishServiceRestart()is called. The option is test-only and defaults to the existing 2 s timed restart, so dev-host behaviour is unchanged. The real-browser test holds the restart, waits for both bindings to be disabled, finishes the restart, and then waits for recovery. A unit test indev-host.spec.tscovers the held restart.Evidence (local Windows, with Chromium CPU throttled through CDP
Emulation.setCPUThrottlingRate):Load alone does not reproduce the failure: the old test also passed 40/40 unthrottled.
2. Calendar phone tap: the tap selected the wrong event
apps/web/e2e/calendar-views.spec.ts, "the week view is usable at phone width…" (was line 422)Cause. The test is from the CI trace of run 37495565659 (artifact
e2e-test-results). The tap went to (213, 383.78), the centre of the offsite event's box. Screencast frames show the content moving about 39 px up during the tap. The touch then selectedevt_deploy, the next event down, and the widget action POST carried that event too. The scroller went 216 → 316 → 503, and Playwright logged "element is not stable" several times before "stable". Two motions can still be running after the test centres the event:.cc-scroll(scroll-behavior: smooth) toward the bottom, and can keep going or start again after the instantscrollIntoView. One local run saw 55 px of extra scroll..cc-rowand.cc-cardplay thecc-enterentrance with a bounce easing. It can pause at its turning point long enough for Playwright's stability check to pass, and then move the event again.Locally the old test passed, but in 12 instrumented runs the event still moved 4–25 px after it was positioned. A scroll-still check alone left 17–25 px of movement, all of it from the entrance animation.
Fix. Before tapping, the test now:
animation.finished);BOTTOM_FOLLOW_SLACK_PX, so the client no longer follows it;elementFromPointhit test, then taps.Evidence:
--repeat-each=5Not covered here
Verification
pnpm typecheckpasses.pnpm invariantspasses all 13 checks.vitest.widget-dev-host.config.ts: the held-restart test passes.