fix(ios): stop a fill's post-focus reads from recording an XCTest failure (#3238)

Merged
TH
2mo ago
+111-18

Summary

fill/type still read the element they resolved before their own focus tap, after the tap: textEntryRefreshPoint(for:) read element.frame to build the target's refresh point, and moveCaretToEnd(element:) read it before the caret edge-tap reached from clearTextInput. A field that stops answering its resolving query once focused (#3060's Flutter shape) turns either read into a recorded No matches found for …, which the dispatch path converts to XCTEST_RECORDED_FAILURE plus an invalidated target — the report's fill @e6 row at 4.5 s.

Both frames now come from textEntrySnapshotFrame, which reads through snapshot() — the throwing channel that records nothing, already how probeTextEntryInput and withElement reach an element. Where no frame can be answered the call sites degrade instead of dispatching a stale point: the refresh point drops to no point (the target is not yet identity-bound, so the pre-focus point could name a field that moved into it — the fill fails closed with a typed reason), and the caret edge-tap skips to the point-free delete burst.

Runner-only; 3 files. Absence-vs-failure reads stay on probeTextEntryInput. Closes #3238.

Validation

Tested at 2c9588332. New regression test on --agent-device-text-entry-unqueryable-on-focus drives fill through execute(command:): red before the change at the refresh-point read (RunnerTests+TextEntryFocus.swift:169), green after with didRecordXCTestFailure == false and the app-side focus witness proving the gesture landed. Moves-on-focus, both #3237 tap tests, and the fill/synthesized-replacement suites pass on an iPhone 18 Pro simulator; iOS and macOS build-for-testing succeed. pnpm check:xctest-selection and check:packaged-runner-swift pass; remaining check:affected items (swift-runner builds, replay lanes) are GitHub-authoritative. The moveCaretToEnd hunk is defensive-only — every clearTextInput caller passes an element that already passed the snapshot-probing resolve — and is pinned by no new test.