|
| 1 | +--- |
| 2 | +name: devicedeck-authoring |
| 3 | +description: Use when authoring a mobile UI test or flow against an iOS simulator or Android emulator through DeviceDeck — picking a device, launching an app fresh, and driving it by durable selector so the test is reviewable and runs on real hardware unchanged. |
| 4 | +metadata: |
| 5 | + short-description: Author a reviewable mobile UI test with DeviceDeck |
| 6 | +--- |
| 7 | + |
| 8 | +# Authoring mobile tests with DeviceDeck |
| 9 | + |
| 10 | +DeviceDeck mirrors a simulator/emulator's native UI tree as real DOM, so you drive it |
| 11 | +by accessibility identifier — a durable selector, never a coordinate. What you author |
| 12 | +here runs unchanged on real hardware (that is the whole point). |
| 13 | + |
| 14 | +**Prerequisite:** a `devicedeck serve` is running (default `http://127.0.0.1:8787`). If a |
| 15 | +tool reports a connection error, start it in a terminal first. |
| 16 | + |
| 17 | +## Workflow |
| 18 | + |
| 19 | +1. **Find a device** — `mcp__devicedeck__list_devices`. Note the `udid` (iOS) or serial (Android). |
| 20 | +2. **Boot it if needed** — `mcp__devicedeck__boot_device`. |
| 21 | +3. **Launch the app fresh** — `mcp__devicedeck__launch_app` with the bundle id / package. It |
| 22 | + wipes app data by default, starting at a first-run screen (pass `fresh: false` to resume). |
| 23 | +4. **See what's on screen** — `mcp__devicedeck__ui_tree` for structure, or |
| 24 | + `mcp__devicedeck__screenshot` when you need pixels. Choose elements by their `identifier`. |
| 25 | +5. **Act by selector** — `mcp__devicedeck__tap` with the element's `testid`, and |
| 26 | + `mcp__devicedeck__assert_visible` (by testid or visible text) to check each step landed. |
| 27 | +6. **Type** — the MCP does not type (keeping it reliable). Get the page with |
| 28 | + `mcp__devicedeck__device_page_url`, open it with your browser tools (Playwright/Puppeteer), |
| 29 | + and `fill()`/type there — they verify each keystroke against the device's read-back. |
| 30 | +7. **Emit the test** — write it in the caller's framework using the same `data-testid` selectors |
| 31 | + (`getByTestId('login-button')`). Assert against the device tree, not a guess. |
| 32 | + |
| 33 | +## Rules that keep a test durable |
| 34 | + |
| 35 | +- **Selectors, never coordinates.** Tap and assert by identifier; a captured flow that used |
| 36 | + pixels reviews as noise and breaks on the first layout change. |
| 37 | +- **Wait for the device to echo a typed value before submitting.** Keys land a moment after the |
| 38 | + DOM has them; a submit fired too early acts on a half-typed form. |
| 39 | +- **Reset between independent tests.** A native app stays logged in across relaunch; `launch_app` |
| 40 | + fresh (the default) is the clean slate. |
| 41 | +- **One driver per device.** A device serves one client at a time; run with a single worker. |
0 commit comments