role= selector vocabulary diverges from snapshot kind
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 45/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- testing
Research direction
Read packages/kernel/src/snapshot.ts and the selector paths in packages/selectors/src/internal/match.ts and find.ts first. Decide the compatibility approach before changing behavior; if a cutover is chosen, update the selectors, the snapshot and client API documentation, and affected recorded-selector fixtures. Done means the rollout decision is documented and role= behavior and vocabulary are consistent with kind.
Written by the indexing model from the issue text.
Description
Context
#2656 added kind: string to structured snapshot nodes — the presenter's platform-neutral role vocabulary (button, text-field, text, switch, ...), computed by formatRole in packages/kernel/src/snapshot.ts and shared by every backend/projection.
Adversarial review of #2656 found that role= selector matching does not use that same vocabulary today, so the two completion conditions below cannot be satisfied without a separate, behavior-changing migration:
packages/selectors/src/internal/match.ts(roleselector term) andpackages/selectors/src/internal/find.ts(find role=...locator) each normalizenode.typeby strippingXCUIElementType/leaf-segment prefixes and lowercasing — producing raw leaf class names (statictext,edittext,textfield) rather thanformatRole's coarse vocabulary (text,text-field).packages/provider-webdriver/src/webdriver-source.ts(roleFromWebDriverType) independently falls back to a similarly-stripped type name when WebDriver'sclassattribute is absent, to populate the (iOS AX-derived)rolefield — a different field thankind, but the same kind of ad hoc normalization.packages/contracts/src/snapshot-text.ts(normalizeType) strips the same prefixes for a different purpose (fillable-type/keyboard-occlusion detection), so it is a distinct concern from role classification but shares the pattern.
Why this is its own issue, not folded into #2656
role= selector matching is a released, public selector feature (shipped before 0.21.x). Switching it to formatRole's vocabulary would change matching results for existing selectors and recorded scripts (e.g. role=statictext and role=edittext would stop matching; role=text/role=text-field would start). That is a breaking change to a versioned surface and needs an explicit compatibility/rollout decision (hard fail vs. an aliasing period), which is out of scope for a PR whose job is adding the kind field.
Proposed work
- Decide whether
role=(both the main selector term and thefindlocator) should match againstformatRole(node.type)instead of raw leaf-class normalization, and whether that is a hard cutover or needs a deprecation window. - If cutover: update
packages/selectors/src/internal/match.tsandpackages/selectors/src/internal/find.tsto import and useformatRolefrom@agent-device/kernel/snapshot, delete the now-redundantnormalizeRoleinfind.ts, updatewebsite/docs/docs/snapshots.mdandwebsite/docs/docs/client-api.mdto state role= shares kind's vocabulary, and sweep recorded-selector/doc fixtures that assume the old raw vocabulary. - Leave
packages/contracts/src/snapshot-text.ts#normalizeType(fillable/occlusion detection) andpackages/provider-webdriver/src/webdriver-source.ts#roleFromWebDriverType(the iOSrolefield fallback) alone unless the decision above says otherwise — they serve different fields/purposes thankind.
References
- #2656
- Dominant language
- TypeScript
- Stars
- 4.7k
- Forks
- 304
- Avg merge
- 11h 6m
- Merged PRs (30d)
- 521
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from callstack/agent-device
-
ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
callstack/agent-device#2995 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
callstack/agent-device#1869 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 75/100
callstack/agent-device#3047 ·
Maintainers usually reply within 1 day
-
ready-for-agent
Difficulty 3/5 1-2 days Newbie friendliness 68/100
callstack/agent-device#3004 ·
Maintainers usually reply within 1 day
-
Maestro `eraseText` fails on real Android devices: `test` and `replay` cannot opt in to the test IMEOpenready-for-agent
Difficulty 3/5 1-2 days Newbie friendliness 74/100
callstack/agent-device#2997 ·
Maintainers usually reply within 1 day
All issues in callstack/agent-device
Similar issues
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
inu-appcenter/memorIN-frontend#106 ·
Maintainers usually reply within 1 day
-
kind/bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 7 days
-
[Bug] @deck.gl/arcgis dist import resolves to unpublished @deck.gl/core source path (9.3.11, 9.4.0)Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
CSCfi/sd-search-ui#145 ·
Maintainers usually reply within 1 day
-
Add: Cbeebies pl SDOpencheck:passed streams:add
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day