Skip to content

feat(cli): nativeproof inspect — selector discovery for the current screen#74

Merged
BenSheridanEdwards merged 1 commit into
mainfrom
feat/inspect
Jul 2, 2026
Merged

feat(cli): nativeproof inspect — selector discovery for the current screen#74
BenSheridanEdwards merged 1 commit into
mainfrom
feat/inspect

Conversation

@BenSheridanEdwards

Copy link
Copy Markdown
Owner

Summary

  • Implements step 2 of DX: failure triage + selector discovery (kill the read-the-XML-and-guess loop) #23: nativeproof inspect (with --ios/--android/--project selection) starts a session with the configured project (noReset so app state survives), reads the current page source, and prints the candidate native.* locators a spec author would write — semantic roles with accessible names first, then every visible text (the exact alternation getByText matches), then test ids. The authoring-time counterpart of the did-you-mean failure hint: nobody reads XML and guesses strings.
  • The extraction is a pure, unit-tested function (selectorSuggestions in src/inspect.ts); values are decoded, deduplicated, capped at 60 chars, and iOS names that merely mirror the label are dropped. Session capabilities are shared with the runner via a new projectCapabilities() (pure refactor of buildWdioConfig's spread).

Proof

  • npm run check
    • Passed on feat/inspect.
  • npm test
    • Passed: 158/158 (new: Android and iOS suggestion extraction — including the placeholderValue trap and label-mirroring names — dedupe/length rules, parseArgs/help wiring).
  • Generated project/device proof, or N/A:
    • Device proof ran: nativeproof inspect --android against a live Android 15 emulator on the Settings home screen printed 41 candidate locators; the verbatim output is committed at docs/proof/inspect/android-settings-inspect.log. Sample:

      nativeproof inspect — 41 candidate locators on the current android screen
        native.getByRole("image", { name: "Profile picture, double tap to open Google Account" })
        native.getByText("Network & internet")
        native.getByTestId("com.android.settings:id/homepage_title")
      
    • Screenshots: Not applicable; the deliverable is terminal text, committed verbatim as the log above.

Risk

  • Low. Additive command; the only shared-code change is extracting projectCapabilities() from buildWdioConfig (same spread, covered by existing config tests).

Notes

PR Proof Law

  • I followed .agents/DEFINITION_OF_DONE.md and .agents/skills/pr-inline-screenshot-proof/SKILL.md.
  • Screenshots are committed and embedded inline with ![alt](...png?raw=1), or the proof section says Not applicable with the technical reason.
  • The PR body has no bare screenshot links, local paths, relative paths, or proof placeholders.

…creen

Selector discovery (issue #23, step 2): nativeproof inspect starts a
session with the configured project (noReset), reads the page source,
and prints the candidate native.* locators a spec author would write —
semantic roles with accessible names first, then visible text (the same
alternation getByText matches), then test ids. Kills the
read-the-XML-and-guess authoring loop.

The extraction is a pure, tested function (src/inspect.ts); session
capabilities are shared with the runner via projectCapabilities().
Device-proven against a live Android 15 Settings screen
(docs/proof/inspect/).
@BenSheridanEdwards BenSheridanEdwards merged commit e4fe59c into main Jul 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant