fix(locator): include deadline setup in waitFor elapsed time
What and why
- Start measuring
waitForbefore constructing its deadline. Previously, crossing a millisecond boundary during setup made a 300 ms wait report 299 ms. - Keep polling, timeout values, and existing assertions unchanged. Add a deterministic regression that forces the boundary, plus documentation and a patch changeset.
Issue
Addresses the Node 22.22.3 failure in https://github.com/tester-army/e2e/actions/runs/42445682374/job/128623992220 on main a016b3e4e99f0ad09a2466221740d244241f602f. Reproduced against main c9783a0666ffea9af4d156d1154657fb94b4af1b, whose latest CI passed. The separate screenshot-navigation failure is covered by existing PR #1614.
Verified
Ran it locally: yes
| main | this branch |
|---|---|
Deterministic regression reports waitedMs: 299 instead of 300 | Reports 300; all 22 locator-wait unit tests pass |
pnpm --filter e2e exec vitest run tests/unit/locator-wait-for.test.ts
Before: 1 failed, 21 passed
After: 22 passed
pnpm --filter e2e exec vitest run --project integration tests/integration/failure-evidence.test.ts --reporter verbose
Test Files 1 passed (1)
Tests 8 passed (8)
The integration suite uses the built runner and validates the emitted failure evidence and reports. The deterministic regression ran against unchanged main source before the fix. Independent T3 review found no issues and independently reran the 22 unit tests. The final post-review run passed all 30 focused unit and integration tests.
The built CLI also passed the Chromium testbed forms suite:
cd apps/testbed
node node_modules/e2e/dist/cli/bin.js run tests/forms.e2e.ts
Test Files 1 passed (1)
Tests 4 passed (4)
Full pnpm test passed, including 4,307 core tests, 723 web tests, the remaining packages, and 140 script tests. Core and web each retain one existing skip.
Full pnpm check passed, including lint, dead-code, builds, all package typechecks, documentation, changesets, plugins, and MCP metadata.
Full pnpm --filter @e2e-dev/testbed test also passed before opening this PR.
Checklist
- Patch changeset added for
e2e. - Breaking change: not applicable.
- Docs updated in
docs/reference/screen.mdx; the consumer skill does not describewaitedMs. - Public API or wire contract change: not applicable.
- Engine contract change: not applicable.
Verification after merging #1614
Merged main at f6aba97257700339b60fb67722178d23ee2c5f93 into this branch without rewriting published history. The previous web-agent failure matched #1614's infinite-scroll bug: scrolling stopped at item 60 while more items were loading.
The unchanged committed recording now passes locally with strict replay:
CI=1 E2E_CACHE_DIR= node node_modules/e2e/dist/cli/bin.js run --config e2e.agent.config.ts --grep '^act completes infinite-scroll$' --strict-cache --reporter list
Tests 1 passed (1)
Cache 1 replayed
Rebuilt all packages and the benchmark app. All 50 focused core tests passed across locator waits, failure evidence, and scroll behavior; all 6 screenshot-navigation tests passed. No recording was replaced. CI has finished for the merge commit; see the remaining failure below.
Remaining CI failure
The Node 22.22.3 job passed all 314 core test files, including the original failure-evidence case, then failed packages/acp/tests/executor.test.ts:522: retries the session directory removal after the agent exits when the first try fails. Its fake agent had already exited at the 500 ms liveness check (kill ESRCH). This ACP code is unchanged by this PR and came from #1626.
The focused ACP test passes locally on both Node 24.19.0 and Node 22.22.3. The full ACP suite also passes locally on Node 22.22.3, all 39 tests. These runs were on macOS; the CI failure was on Linux. The cause of the early child exit has not been reproduced or established. No assertion was weakened and no CI retry was requested to hide it. This PR is not yet green.
All web and mobile benchmark jobs passed on 1b8e421: web 91, web agent 33, Android 57 plus one documented skip, Android agent 20, iOS 55 plus one documented skip, and iOS agent 21 plus one documented skip. No checks remain pending. The Node 22.22.3 ACP cleanup test and its dependent spec gate are the only failed checks. No review threads are open. The PR has not been labeled Ready for Human Review because that failure remains unresolved.