fix(android): carry accessibility selected state into snapshots - #2515
Merged
Conversation
The snapshot helper never serialized `selected`, and the host reads only the
helper's XML, so no later layer could recover it: `get attrs` had no `selected`
field, no snapshot node was marked selected, `is selected` could not match, and
a Maestro `assertVisible {id, selected: true}` failed with "Maestro visible
condition did not match" for a visible element while `selected: false` matched
every Android node (#2462).
The helper now emits both answers, like `enabled` and `password`, so an
unselected control answers `false` and a helper older than the attribute answers
nothing. The parser, the Android hierarchy node, and the published snapshot node
carry it to `get attrs` and the `[selected]` marker.
Snapshot lines render that marker on the default formatter path too: `--settle`
and `diff` already compared selection, and a line that weighs a fact it cannot
print turns a tab tap into a changed pair whose two lines look identical.
Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
|
Size Report
Startup median (7 runs, lower is better):
|
Member
Author
|
No code findings at 602b731. Android selected state now reaches attrs, selectors and Maestro while preserving false versus unknown, and selection-only snapshot diffs have visible markers. The reported Pixel 7 run covers the changed path, current-head checks pass and there are no conflicts; ready for human review and merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Android never carried the accessibility
selectedstate. The snapshot helper did not serialize it, and the host reads only the helper's XML, so no later layer could recover it:get attrshad no field, no snapshot node was marked,is selectedcould not match, andassertVisible {id, selected: true}failed with "Maestro visible condition did not match" on a visible element — whileselected: falsematched every Android node.The helper now emits both answers, like
enabledandpassword: an unselected control answersfalse, a helper older than the attribute answers nothing. Parser, Android hierarchy node, and published node carry it toget attrs, the[selected]marker, selectors, and Maestro qualifiers.Smaller second fix: snapshot lines render
[selected]on the default formatter path too.--settle/diffalready compared selection, so a tab tap produced a changed pair whose two lines looked identical.13 files. Deliberately not here:
checked/checkable/long-clickable(still #1832 residue), Androidfocused's omitted-false encoding, and Apple's true-or-absentselected— on Apple aselected: falseassertion still passes for a selected control.Validation
Commit
602b731.pnpm check:affected --runpassed (3715 selected tests + command-docs);pnpm test:unit9753 passed; lint and typecheck clean. Regression evidence: the 5 platform selection tests, the selector-read test, and the new diff test fail with the mapping or the line marker rendered inert.Manual device evidence, Android 16 / Pixel 7 CI AVD (not an automated lane): on the Dialer tab bar,
get attrs @e31reports"selected": true, andpress 'id=…tab_call_history' --settleprints- @e40 [group] "Keypad" [selected]/+ @e31 [group] "Home" [selected]. A flow assertingassertVisible {id, selected: true}passes; with a helper APK built fromHEADthe same flow fails with the issue's exact message and noselectedfield. Provider integration and coverage remain with GitHub CI.Closes #2462