You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a79dad6
Browse filesBrowse the repository at this point in the historyBrowse files
feat(interaction): surface targetHittable/hint for non-hittable press/fill targets (#1040)
When a resolved press/fill/click selector or ref target lands on a node
that reports hittable: false (after any hittable-ancestor promotion), the
success response now carries targetHittable: false and a hint suggesting
the interaction may have had no visible effect. Resolution semantics are
unchanged: no failing, no filtering, no strict-unique matching — iOS AX
hittable flags are unreliable on deep RN trees, and react-navigation's
maestro suite depends on today's auto-disambiguation behavior (#1037).
Also documents the selector disambiguation policy (deepest node, then
smallest area, exact ties fail) in `help workflow`, including that
replay/replay-heal apply the same policy for touch/fill/get-text.
Copy file name to clipboardExpand all lines: src/cli/parser/cli-help.ts
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -189,6 +189,8 @@ Selectors:
189
189
agent-device press 'id="submit-order"'
190
190
agent-device is visible 'label="Online"'
191
191
agent-device get text 'id="quantity-value"'
192
+
Ambiguous selector disambiguation: a selector on an interactive command (press/click/fill/focus/longpress/scroll/swipe/pinch) that matches multiple elements does not fail by default. It auto-resolves deepest node first (largest depth in the tree), then smallest on-screen area; only an exact tie on both depth and area fails with "Selector did not resolve uniquely". replay and replay-heal apply the same depth-then-area policy for touch/fill/get-text, so recorded flows and live commands pick the same candidate. This exists because short/reused labels (tab + header + button with the same text, or a duplicated list-row label) are common in real apps; add id="..." or a longer/more specific text to force a different match instead of assuming ambiguous selectors always fail.
193
+
Selector match can still land on a non-interactive node (for example an off-screen map annotation that exact-matches text= while the real control has a longer label). Success responses for press/fill/click/ref targets carry targetHittable: false and a hint when the resolved element reports hittable: false, since the tap may have had no visible effect; treat that as a signal to verify with a snapshot or re-target by @ref/longer text, not as a command failure.
* iOS AX `hittable` flags are unreliable on deep React Native trees (see #1037:
169
+
* a map-pin annotation exact-matched a longer recents row label and reported tap
170
+
* success while doing nothing visible). We deliberately do NOT fail or filter on
171
+
* this signal — that would break selectors that only ever resolve to nodes the
172
+
* platform marks non-hittable. Instead, surface it so the caller can notice a
173
+
* likely no-op tap and re-target with a ref or a more specific selector/longer text.
174
+
*/
175
+
functiondescribeNonHittableTarget(
176
+
node: SnapshotNode,
177
+
action: InteractionAction,
178
+
): {targetHittable?: boolean;hint?: string}{
179
+
if(node.hittable!==false)return{};
180
+
return{
181
+
targetHittable: false,
182
+
hint: `The resolved element reports hittable: false, so this ${action} may have had no visible effect. Verify with a snapshot, or prefer a @ref or a longer/more specific selector to target the intended element.`,
0 commit comments