Skip to content

fix(FOSTestingUI): native dispatch uses the platform's pointer verb — macOS taps land - #139

Merged
foscomputerservices merged 3 commits into
mainfrom
fix/uitesting-tap-macos-coordinates
Aug 22, 2026
Merged

fix(FOSTestingUI): native dispatch uses the platform's pointer verb — macOS taps land#139
foscomputerservices merged 3 commits into
mainfrom
fix/uitesting-tap-macos-coordinates

Conversation

@foscomputerservices

Copy link
Copy Markdown
Owner

The failure

On macOS, uiTestingElement(_:).tap() dispatches without failure and the control's action silently never fires. Surfaced by a generated FOSMVVM client-server app: every interaction UI test (tap → stub-op recorded) failed on the macOS destination while the identical tests were green on the iOS simulator.

Root cause — measured one variable at a time

Via the probe's new composite-row scenario (RowResolutionMacTests), on macOS 27 beta:

  • native tap() on the live, hittable, resolved control — action never fired
  • app-anchored coordinate tap — never fired
  • overlay-anchored coordinate tap — never fired
  • click() on the same control — green

The verb, not the aim, was the failure. Two supporting measurements: XCUIApplication.frame.origin is (inf, inf) on macOS (so app-anchored offset arithmetic must guard for a non-finite origin), and the aimed path's XCUIElementSnapshot has geometry but no gestures (so a live element must be resolved to receive the native gesture).

The fix

  • Every native dispatch goes through nativeTap(_:)click() on macOS, tap() elsewhere.
  • tap()'s aimed branch resolves its snapshot back to a live element (liveElement(matching:), by type and frame); the app-anchored coordinate remains the iOS-measured fallback only.
  • appCoordinate(at:) subtracts only a finite origin.

iOS behavior is unchanged: its verb remains tap(), its origin is zero, and its measured-green app-anchored fallbacks are untouched.

This also cures the "synthesized taps on native-bridged bar items do not land" regression recorded in the probe README on this beta — the macOS tab and toolbar tap tests pass again; the README's measurement record is updated.

New probe coverage

RowResolutionTests proved the aimed dispatch only via keyboard arrival, which cannot run on macOS — the coverage hole this bug lived in. The new keyboard-free proof (caption + untagged-button composite; the fired count is the landing evidence) runs in both harnesses: RowResolutionTests (iOS) and RowResolutionMacTests (macOS). The macOS test falsified two earlier fix designs before click() was measured as the landing verb.

Verification

  • macOS probe: 9/9 — including the previously-failing tab/toolbar tap tests
  • iOS probe (full suite): 56 tests — 48 passed, 0 failed, 5 version-gated skips, 3 expected (teaching) failures
  • Real app: the generated client-server app's diagnostic (raw click()) fired where tap() did not, in the same run — the originating evidence
  • Pre-existing on this beta, unrelated: the bannerToggle pair failed identically with and without the fix on stale simulators, and passed on fresh ones

Release note

Target: 0.13.3. Generated projects reference FOSUtilities with from:, so they pick this up on a package update without regeneration.

… macOS taps land

On macOS, XCUIElement.tap() and every coordinate-synthesized tap
dispatch without failure and never land. Measured one variable at a
time on 27 beta via the probe's composite row: native tap() on the
live, hittable, resolved control — action never fired; app-anchored
coordinate tap — never fired; overlay-anchored coordinate tap — never
fired; click() on the same control — green. The verb, not the aim, was
the failure.

Every native dispatch now goes through nativeTap(_:) — click() on
macOS, tap() elsewhere — and tap()'s aimed branch resolves its
XCUIElementSnapshot back to a live element (liveElement(matching:), by
type and frame) so there is an element to receive the native gesture;
the app-anchored coordinate remains the iOS-measured fallback only.
Also measured: XCUIApplication.frame.origin is (inf, inf) on macOS, so
appCoordinate(at:) subtracts only a finite origin.

Cures both measured macOS failures: the generated client-server app's
interaction tests (tap -> stub-op recorded), and the probe README's
'synthesized taps on native-bridged bar items do not land' regression —
the probe's macOS tab + toolbar tap tests pass again (9/9).
RowResolutionTests proved the aimed dispatch only via keyboard arrival,
which cannot run on macOS — the coverage hole the macOS tap failure
lived in. actionRow is a caption + untagged-button composite (the row
tag is the button's only route, midpoint in the caption, forcing the
aimed path everywhere); the fired count is the landing proof,
keyboard-free. The claim now runs in both harnesses: RowResolutionTests
(iOS) and RowResolutionMacTests (macOS) — the macOS one is the test
that falsified two earlier fix designs before click() was measured as
the landing verb.

Measured while here (Xcode 27 beta -> iOS 27 sim): the bannerToggle
conditional-branch pair fails identically with and without the fix —
pre-existing on this beta, not a regression.
@foscomputerservices
foscomputerservices merged commit bd3bf3e into main Aug 22, 2026
13 checks passed
@foscomputerservices
foscomputerservices deleted the fix/uitesting-tap-macos-coordinates branch August 22, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant