Skip to content

test: cover #148 (android)#186

Open
latekvo wants to merge 5 commits intofeat/android-emulator-supportfrom
feat/android-emulator-support-tests
Open

test: cover #148 (android)#186
latekvo wants to merge 5 commits intofeat/android-emulator-supportfrom
feat/android-emulator-support-tests

Conversation

@latekvo
Copy link
Copy Markdown
Member

@latekvo latekvo commented May 4, 2026

This PR adds tests for #148.

Summary

Moves the Android emulator branch's test coverage out of #148 so that PR can be reviewed without the test churn. This branch adds the test files back on top of the (now test-stripped) base branch.

Tests inseparable from source changes (describe-tool, workspace-reader, workspace-reader-integration) and the boot-simulator.test.ts deletion stayed on #148 - base PR's CI passes on its own.

Test plan

  • npx tsc --build — clean
  • npx prettier --check . — clean
  • npm test --workspaces --if-present — 585/585 tool-server tests pass; all other workspaces green

@latekvo latekvo changed the title test: cover Android emulator support and review-fix surface test: cover #148 (android) May 4, 2026
@latekvo latekvo marked this pull request as ready for review May 4, 2026 22:15
@latekvo latekvo force-pushed the feat/android-emulator-support-tests branch 5 times, most recently from 3c89bef to 9bc0eef Compare May 5, 2026 15:26
latekvo and others added 5 commits May 5, 2026 17:45
Coverage moved out of feat/android-emulator-support so that branch's
PR can be reviewed without the test churn. This stacked PR adds:

- 19 new test files covering the Android dispatch path (adb hardening,
  describe-screen, injection hardening, simulator-server blueprint,
  uiautomator parser, ax-service / ios-only blueprint gating,
  list-devices, boot-device hot/cold boot + spawn-error + general,
  http dep gate, check-deps, describe missing xcrun, native-profiler
  missing trace, etc.)
- Touch-ups to skills/update/auto-screenshot/native-devtools-status
  unit tests where main's existing assertions stayed compatible.
…r and ensureDep

Cover `resolveAndroidBinary` across the lookup chain — PATH preference,
$ANDROID_HOME-only, $ANDROID_SDK_ROOT-only, both unset, non-executable
file at the canonical SDK path — plus `ensureDep("emulator")` end-to-end
to confirm an SDK-installed-but-off-PATH emulator binary now passes the
dep check and a missing one surfaces a `DependencyMissingError` whose
hint mentions $ANDROID_HOME, not just PATH.

Each test sandboxes its env vars via beforeEach/afterEach so a vitest
worker can't leak ANDROID_HOME state into surrounding suites.
Two upstream changes broke a chunk of the Android test surface:

1. `runAdb` / `listAvds` / `boot-device` now route adb / emulator
   invocations through `resolveAndroidBinary` (PATH → \$ANDROID_HOME →
   \$ANDROID_SDK_ROOT), so existing test mocks that match `cmd === "adb"`
   never fired on real hosts — the resolver returned an absolute path.

2. The uiautomator parser's v2 trim flattens layout-only wrappers,
   drops decorative ImageViews, and surfaces interactivity as flags on
   `DescribeNode` rather than as role promotion. Tests asserting the
   pre-trim tree shape no longer matched.

For (1): stub `resolveAndroidBinary` per-file so the bare-name matchers
keep firing — `vi.mock("../src/utils/android-binary", ...)` next to the
existing `vi.mock("node:child_process", ...)`. The check-deps and
http-dep-gate suites also need a controllable mock so each test can
declare per-dep availability without fighting the host's real
\$ANDROID_HOME.

For (2): rewrite `android-describe-screen.test.ts` traversals against
the flattened tree (FrameLayout passthrough → 3 widgets at
`tree.children[0..2]` instead of nested under `children[0].children`).
Add interactivity-flag assertions for the new contract. The "zero
screen size" defensive test now expects an empty tree (the v2 trim's
visibility check drops nodes that fail the screen-area check, which is
a stronger and more useful invariant than the prior zero-frame leak).
Drop the `convertUiAutomatorNode`-direct test from
`uiautomator-parser-hardening.test.ts` — that helper no longer exists;
its 10k-deep stack-safety check is preserved via the
`parseUiAutomatorDump` and `parseUiAutomatorXml` calls in the same
suite.

622/622 tests green on the test branch after this update.
…croll-clip, SVG, system chrome

Inline-XML coverage for every trim rule landed in the v2 parser
refactor (commit 0128919, ported from #190):

- duplicate-wrapper collapse (clickable parent + clickable child with
  identical bounds → keep inner)
- password redaction (label="[password]", value never set, password
  flag true)
- WebView opacity (DOM-side accessibility scaffold under the WebView
  must not bleed through as siblings)
- compound-clickable label aggregation ("Alice / @alice" for a row
  whose own content-desc is empty)
- EditText label/value separation (content-desc → label, text → value)
- scroll-clip filtering with `scrollHidden` count (descendant outside
  ancestor scroll's viewport gets dropped, parent records the count)
- com.android.systemui drop by default + `includeSystem` opt-in
- React Native SVG sub-paths (com.horcrux.svg.{Path,Group,Svg}View)
  stripped wholesale
- off-screen rect drop

The fixture-based "Bluesky thread" sanity suite from #190 isn't ported
because the dump it depends on (`research/android-ui-inspection/
artifacts/02_uiautomator_compressed.xml`) doesn't ship in this repo.
The inline cases above cover every trim rule that suite exercises
without needing an external artifact.

Co-authored-by: Paweł Fornagiel <pawel.fornagiel2@gmail.com>
- uiautomator-parser-hardening.test.ts: rename two `describe()` titles
  and one inline comment off the removed internal `convertUiAutomatorNode`
  symbol; the public API under test is `parseUiAutomatorDump`.
- uiautomator-parser-v2-trim.test.ts: drop the comment block that named
  a research artifact path that doesn't ship in this repo, plus the
  source-PR / commit-hash breadcrumb.
- boot-device.test.ts: drop the `(previously boot-simulator)` historical
  breadcrumb from the iOS-path describe title.
@latekvo latekvo force-pushed the feat/android-emulator-support-tests branch from 9bc0eef to 8aad6c9 Compare May 5, 2026 15:46
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