fix(mobile): bound reads by operation budget with last-read grace
Merged
OK
17d ago+812+812+012345678901234567890123456789-230-230-012345678901234567890123456789
Takes over #1112 by Totopo27 (closed unmerged after approval), rebased on current main with authorship credited.
@e2e-dev/mobilebounds every snapshot and screenshot by the operation's budget (oneInputBudgetper operation, including relocation and keyboard-dismiss snapshots), so a hung read fails the step instead of holding it until the test timeout.- Core's waits run reads through one
ReadWindow(packages/e2e/src/internal/time.ts): the last read may run past the deadline by the slowest read the wait has finished, capped by the phase deadline, so a slow last read still finishes and is classed asLOCATOR_NOT_FOUND/ASSERTION_FAILED, notACTION_FAILED. - Reads past the deadline share that extra time instead of each getting it again (
toHaveScreenshotwith masks makes several reads per sample). - A timed-out read is judged by when that read started, not when its sample did, and a negation counts as held only until the deadline.
- An action whose target resolved past its deadline is never sent: it fails as
ACTION_FAILED. - Peer floor: mobile requires
e2e >=0.22.0 <1. Publishede2eis 0.21.3 and a pendinge2e: minorchangeset (#1437) makes the next release 0.22.0, which ships this. If a release goes out before this merges, the floor needs bumping again. - Restored main's
expect(calls).toMatchObject({ resolve: 1, read: 2 })inlocator-engine.test.ts(kept).
Issue
Closes #1099
Verified
Ran it locally: yes
- mobile benchmark, iOS 26.5 sim,
e2e run tests/controls.e2e.ts --target ios-simulator, built packages.a missing locator fails as not found once its timeout passes(1 s timeout) isLOCATOR_NOT_FOUNDon every run, main and branch. - Last branch run: 23 passed, 1 skipped. Earlier runs on this sim were flaky on main too (1 and 4 failures in different tests: long press, pointer verbs, focus), so they are local sim noise, not this change.
✓ refusals > a missing locator fails as not found once its timeout passes 1.10s
Tests 23 passed | 1 skipped (24)
Not covered: a slow last read on a real device. The unit tests cover it, and fail without the grace.