Skip to content

fix(android): carry accessibility selected state into snapshots - #2515

Merged
thymikee merged 1 commit into
mainfrom
t3code/fix-2462-root-cause
Sep 12, 2026
Merged

fix(android): carry accessibility selected state into snapshots#2515
thymikee merged 1 commit into
mainfrom
t3code/fix-2462-root-cause

Conversation

@thymikee

Copy link
Copy Markdown
Member

Summary

Android never carried the accessibility selected state. The snapshot helper did not serialize it, and the host reads only the helper's XML, so no later layer could recover it: get attrs had no field, no snapshot node was marked, is selected could not match, and assertVisible {id, selected: true} failed with "Maestro visible condition did not match" on a visible element — while selected: false matched every Android node.

The helper now emits both answers, like enabled and password: an unselected control answers false, a helper older than the attribute answers nothing. Parser, Android hierarchy node, and published node carry it to get attrs, the [selected] marker, selectors, and Maestro qualifiers.

Smaller second fix: snapshot lines render [selected] on the default formatter path too. --settle/diff already 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), Android focused's omitted-false encoding, and Apple's true-or-absent selected — on Apple a selected: false assertion still passes for a selected control.

Validation

Commit 602b731. pnpm check:affected --run passed (3715 selected tests + command-docs); pnpm test:unit 9753 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 @e31 reports "selected": true, and press 'id=…tab_call_history' --settle prints - @e40 [group] "Keypad" [selected] / + @e31 [group] "Home" [selected]. A flow asserting assertVisible {id, selected: true} passes; with a helper APK built from HEAD the same flow fails with the issue's exact message and no selected field. Provider integration and coverage remain with GitHub CI.

Closes #2462

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>
@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-12 18:18 UTC

@github-actions

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
Installed (including dependencies) 4.50 MB 4.50 MB +68 B
Package (unpacked) 4.50 MB 4.50 MB +68 B
Package (download) 1.32 MB 1.32 MB +47 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 28.5 ms 28.9 ms +0.4 ms
CLI --help 80.6 ms 79.7 ms -1.0 ms

@thymikee

Copy link
Copy Markdown
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.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Sep 12, 2026
@thymikee
thymikee merged commit 37d67de into main Sep 12, 2026
20 checks passed
@thymikee
thymikee deleted the t3code/fix-2462-root-cause branch September 12, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android: the selected state is dropped from snapshots, so the selected Maestro selector never matches

1 participant