feat(driver-mobilecli): surface isSelected/isChecked/isFocused from dump.ui - #252
feat(driver-mobilecli): surface isSelected/isChecked/isFocused from dump.ui#252sjy wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe mobile CLI element interface now supports optional 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The
The change is additive (three optional fields + guarded mapping), so it's a no-op until the on-device agent emits |
|
@sjy hey! thanks for the pull request! I can't believe it was missing tbh. thank you for finding this. Can you please sign your commit so I can merge? |
…ump.ui The `ViewNode` protocol already declares `isSelected` / `isChecked` / `isFocused`, and `@mobilewright/core`'s `expect` ships `toBeSelected()` / `toBeChecked()`, but `elementToViewNode` never populated them — so those matchers read `false` for every node. Map the fields through from the mobilecli element (guarded on `typeof === 'boolean'`, so they stay `undefined` when the agent omits them — no behavior change until the agent emits them). The on-device agent must still include `selected`/`checked`/`focused` (and ideally Android `stateDescription`) in each `device.dump.ui` element for these to be non-undefined; tracking that separately. Refs mobile-next#250
738b36b to
4e3eda8
Compare
|
Done — the commit is now SSH-signed and shows Verified. Ready to merge whenever you are. Thanks for the quick look! 🙏 |
Summary
ViewNodealready declaresisSelected/isChecked/isFocused, and@mobilewright/core'sexpectshipstoBeSelected()/toBeChecked()— butelementToViewNodenever populated those fields, so the matchers readfalsefor every node.This maps the three flags through from the mobilecli element. Reads are guarded on
typeof === 'boolean', so they stayundefinedwhen the agent omits them — no behavior change until the on-device agent emits them.Diff
MobilecliElement: add optionalselected/checked/focused.elementToViewNode: map them toisSelected/isChecked/isFocused.Scope / follow-up
This is the driver half only. For the values to become non-
undefined, the on-device agent must includeselected/checked/focused(fromAccessibilityNodeInfo) in eachdevice.dump.uielement — and ideally AndroidstateDescription, which Jetpack Compose populates for aselectedsemantic on non-Role.Tabnodes. Tracking that separately.Refs #250
Test
elementToViewNodeis a private function with no unit-test seam today (only the live-serverintegration.test.ts), so no unit test is added here to avoid exporting internals.tsc -bbuilds clean. Happy to add a fixture/test if you'd prefer to expose it.