…6.1 and @metamask/device-mcp 0.10.0 (#329)
## Description
> **Summary:** Updates `testing/mobile-visual-testing` for
`@metamask/client-mcp-core`
[0.16.1](https://github.com/MetaMask/client-mcp-core/releases/tag/v0.16.1)
and `@metamask/device-mcp` 0.10.0. Five claims in the skill are now
wrong, the most important being that an ambiguous ref can tap another
element. Each fix was checked against the `v0.16.1` code and a live run.
Companion Mobile PR: MetaMask/metamask-mobile#41237. Previous update:
#298 (Mobile #40496).
### Problem
An agent that follows the current skill expects the wrong outcome in
five places:
- An `ambiguous` or label-only ref "can tap another element" ([core
#127](MetaMask/client-mcp-core#127)). A `click`
now taps the listed node at its bounds. The other target commands refuse
such a ref.
- An unknown command with no daemon "exits 3"
([#126](MetaMask/client-mcp-core#126)). It exits
2 before any daemon starts.
- `--timeout abc` "is dropped without an error" (#126). It exits 2 once
a daemon runs, and 3 without one.
- iOS `mm type <field> ""` "exits 4 with `MM_TYPE_FAILED`"
([#134](MetaMask/client-mcp-core#134),
device-mcp 0.10.0). It exits 0.
- The daemon log line "ends with the outcome"
([#133](MetaMask/client-mcp-core#133)). It now
also names the target.
The `cdp` port order also gains the port that the consumer's launch
resolved ([#128](MetaMask/client-mcp-core#128)).
```mermaid
flowchart TD
S["describe-screen: node ref"] --> Q{"unique testId,<br/>label or text?"}
Q -->|yes| ANY["every target command"]
Q -->|"no: unnamed or ambiguous: true"| T{"command?"}
T -->|click| B["tap at bounds, target ends in (bounds)"]
B -->|element moved| NF["MM_TARGET_NOT_FOUND, nothing tapped"]
T -->|"type, wait-for, get-text,<br/>scroll-to-element, long-press"| R["MM_TARGET_NOT_FOUND, exit 4, hint"]
classDef new fill:#fff3cd,stroke:#d39e00
classDef stop fill:#f8d7da,stroke:#c82333
class B new
class NF,R stop
```
Yellow boxes are new. Red boxes stop the command.
### What changes
| Area | Before | After |
|---|---|---|
| Refs (`repos/metamask-mobile.md`, `cli-reference.md`,
`error-recovery.md`) | Resolved again at tap time; ambiguous or
label-only refs can tap another element; unnamed refs are `Unknown
a11yRef` | Unnamed and `ambiguous` refs work only with `click` (bounds
tap, `(bounds)` target, `MM_TARGET_NOT_FOUND` when moved); other
commands refuse them with a `hint` |
| "The tap opened another screen" row | Cause: an ambiguous ref | Cause:
a substring `--testid` match or a stale ref |
| Expo dev menu close | `tap-coordinates` only; the button "has no
usable ref" | `mm click <ref>` of the unnamed button, or
`tap-coordinates` |
| Bad input | Unknown command exits 3 without a daemon; non-numeric flag
dropped | Unknown command or bad `launch` value: exit 2, no daemon;
`--timeout abc`: exit 2, or 3 without a daemon |
| iOS `type ""` | Exit 4 `MM_TYPE_FAILED`, field cleared | Exit 0,
`textLength: 0` |
| `cdp` port | Launch `--metro-port` or `MM_METRO_PORT` | Launch
`--metro-port`, else the port the launch resolved from `MM_METRO_PORT`,
then `HERMES_METRO_PORT`, then 8081 |
| Daemon log | Outcome only | Outcome and target (`testid=`, `ref=`,
`method=`, …) |
[#137](MetaMask/client-mcp-core#137) (`mm
<command> --help`) needs no change: the skill never told agents to avoid
`--help`. The browser-only changes (#125, #129, #130, #131, #138, #139)
do not apply.
Review: start with "Which refs work where" in
`repos/metamask-mobile.md`.
## Type of Change
- [ ] New skill
- [x] Skill improvement/update
- [ ] Bug fix
- [ ] Documentation update
- [ ] Other (please describe):
## Checklist
- [x] I have read the
[CONTRIBUTING.md](https://github.com/MetaMask/skills/blob/main/CONTRIBUTING.md)
guidelines
- [x] My skill follows the
[SKILL_TEMPLATE.md](https://github.com/MetaMask/skills/blob/main/.github/SKILL_TEMPLATE.md)
format
- [x] I have tested this skill with an AI agent
- [x] My skill does not contain any secrets, private keys, or sensitive
data
- [x] I have added appropriate documentation
- [x] My changes don't break existing skills
## Testing
<details>
<summary>Sources and live run</summary>
- Code: core tag `v0.16.1` (`src/platform/mobile-platform-driver.ts`
bounds refs and `boundsRefError`, `src/cli/mm.ts` `parseIntFlag` and the
help check, `src/tools/launch.ts` `applyHermesDefaults`,
`src/server/request-log.ts`), core `SKILL.md` at the tag, and the
device-mcp 0.10.0 CHANGELOG.
- Live, read only, real-funds wallet, Metro 8085, npm core 0.16.1 and
device-mcp 0.10.0 with MetaMask/metamask-mobile#41237, following only
this skill. iPhone 17 Pro simulator: launch with `MM_METRO_PORT=8085`
and no `--metro-port`, then `hermes-targets` and `cdp`
(`sessionMetroPort: 8085`, `connected: true`); unlock; hamburger menu,
About, back; Explore search, `type` and `type ""` (exit 0, `textLength:
0`), back. Ambiguous and unnamed refs refused by `get-text`, `wait-for`,
`type`, `scroll-to-element`, `long-press` and `run-steps` (exit 4 with a
`hint`); `click` on an unnamed ref returned `target: "a11yRef:e17
(bounds)"`; error paths (exit 2, 3 and 0 for `--help`); daemon log
targets. Android emulator `Medium_Phone_API_36.1`, login screen: the
same `cdp` port, bounds `click`, refusals, `type ""` and `--timeout
abc`.
- Not run live: a bounds `click` after the element moved (code and core
tests only).
- `yarn lint` pass, `yarn test` 106/106 pass, `yarn audit:skills` 0
errors and 134 warnings (same as `main`).
</details>
<details>
<summary>Known gaps (not in this PR)</summary>
- The iOS wallet home tree is 64 levels deep and its full read fails.
device-mcp falls back to a partial tree, and `wait-for --testid
wallet-screen` times out on the right screen. The skill already points
iOS agents to `account-picker`. Fixes: core #141, device-mcp #67 and
#68.
- `explore-safe-area` is not in the iOS tree (the skill names it as the
Android Explore marker only).
</details>
## Additional Context
Merge this after MetaMask/metamask-mobile#41237.
Part of the mm CLI v2 effort.
Problem
Core pins
^0.9.0. On 0.x, a caret range does not pick up a new minor, so core does not get 0.10.0. With device-mcp 0.9.0 on iOS,mm type <field> ""clears the field, then runsidb ui text "", which exits 1. The field is empty, but the call fails, so a script cannot tell this expected case from a real failure.Solution
Bump the range to
^0.10.0. Core's code and API do not change. The fix is in device-mcp'sIdbBackend.typeText: empty text returns after the select-all and Backspace clear. Non-empty text takes the same path as before.flowchart TD A["typeText(text)"] --> B["ui key 4 (select all)"] B --> C["ui key 42 (backspace)"] C --> D{"text empty?"} D -->|yes| E["return. Field is empty."] D -->|no| F["idb ui text text"] F --> G["return. Field has text."] classDef new fill:#fff3cd,stroke:#d39e00 class D,E newYellow boxes are new.
What changes
mm type <field> ""MM_TYPE_FAILED; field emptytextLength: 0mm type <field> "text"mm type <field> ""Decisions for reviewers
chore:, notfeat:CHANGELOG.mdentry^0.10.0HermesClient.Consumer changes
Mobile and Extension bump
@metamask/device-mcpto^0.10.0with this core. On Mobile, core alone does not fixtype "": the consumer's own device-mcp copy must be 0.10.0 too.Review guide
package.json,yarn.lock^0.10.0.yarn dedupeleaves one device-mcp entry, at 0.10.0.README.mdTesting
yarn buildexits 0.yarn lintexits 0.CI=1 yarn testexits 0: 76 files, 2914 tests. Coverage 98.14 / 95.5 / 97.51 / 98.23. The floors do not change.mm type --testid multichain-account-selector-search-input "zz"textLength: 2textLength: 2mm type --testid multichain-account-selector-search-input ""MM_TYPE_FAILEDtextLength: 0Before:
After:
Release contents (device-mcp v0.9.0...v0.10.0)
ed2cc13fix: allow typing empty text on iOS (perf: settle only on visible finite animations; collect testIds in one call #65).IdbBackend.typeTextreturns after the clear whentextis empty. Thedevice_typedescription now says an empty string only clears the field.776e6bc0.10.0 (fix: make each Extension ref resolve to exactly one element #66). Version and CHANGELOG only.No export, type or signature that core uses changed:
HermesClient,TargetObscuredError, the backend types andHermesCdpResultare unchanged. #65 is the only behavioural change.