Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Use the task-bound Harness for compact tool discovery in Recipe Cook. Verify the adapter and checkout at setup, then look up only the recipe or action needed. For a dev or fix-bug debrief requested directly in chat, identify the instruction or tool output that would have saved the most time. ([#311](https://github.com/MetaMask/skills/pull/311))
- Record Recipe Cook's final PR proof from the clean commit proposed for publication. Preserve the selected attempt's screenshot paths when Pretty PR packages evidence. ([#311](https://github.com/MetaMask/skills/pull/311))
- Update `testing/visual-testing` for `@metamask/client-mcp-core` 0.16.1. `mm screenshot --selector` or `--frame` with `--timeout` waits that long for a missing element (without it, the command still fails after 2 s with `MM_TARGET_NOT_FOUND`), and the TradingView chart notes say that its canvas is in a nested iframe that `--frame` does not enter. ([#328](https://github.com/MetaMask/skills/pull/328))
- Update `testing/visual-testing` for `@metamask/client-mcp-core` 0.16.0. An unknown command or a bad `launch` value exits 2 with `MM_INVALID_INPUT`, a target that matches several elements fails with `MM_TARGET_NOT_FOUND`, `mm screenshot --selector` takes `--timeout` and fails after 2 s with `MM_TARGET_NOT_FOUND` when nothing matches, a `--frame` wrapper with one iframe resolves to that iframe, `mm mock-network requests` redacts URLs, and daemon log lines name the call's target. ([#316](https://github.com/MetaMask/skills/pull/316))
- Update `testing/visual-testing` for `@metamask/client-mcp-core` 0.15.0. Add `mm events mark`, `mm logs` and `mm network` with a per-flow recipe in place of `console.error` hooks and CDP network capture, `mm cdp --target sw` and `--fresh`, iframe refs and `--frame`, `mm screenshot --selector`, mock-network request bodies and service-worker, offscreen and snap matching, the hidden-checkbox `clickedLabel` click, the `ref` shorthand in `run-steps`, and the one timeout budget with `MM_QUEUE_TIMEOUT`. ([#297](https://github.com/MetaMask/skills/pull/297))
- Update `testing/mobile-visual-testing` for `@metamask/client-mcp-core` 0.15.0 and `@metamask/device-mcp` 0.9.0. Android taps on a covered target now fail with `MM_TARGET_OBSCURED`, `visible: false` now marks off-screen elements on Android too, `mm type <field> ""` clears a field, and `mm cdp` reuses the launch Metro port over one persistent connection. The "Android `visible` is always `true`", "pass `--metro-port` on every `cdp` call" and `press-button back` keyboard workarounds are removed. The skill adds the slow-first-screen recipe (`wait-for` the new screen, do not tap again), the `run-steps` `ref` shorthand, the shared timeout budget with `MM_QUEUE_TIMEOUT`, the iOS tab bar that is not in the tree, and a warning that a mobile ref is resolved again at tap time and can tap another element with the same test ID or label ([#298](https://github.com/MetaMask/skills/pull/298)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ All interaction commands accept `--timeout <ms>` (default 15000). This is a **si
| Target found but not clickable | `MM_CLICK_TIMEOUT`, exit 5, after the full timeout (15 s by default). The message ends with Playwright's last step |
| Target matches several elements | `MM_TARGET_NOT_FOUND`, exit 4, at once: `strict mode violation … resolved to <n> elements`. Nothing is clicked. Scope it with `--within` or use a ref |

On a target that matches nothing, only `mm click` and `mm screenshot --selector` fail fast. `wait-for`, `type`, `hover`, `inspect` and `scroll-to-element` wait the full timeout. A missing `--within` parent also waits the full timeout. A target that matches several elements fails at once with `MM_TARGET_NOT_FOUND` in every command that takes a target.
On a target that matches nothing, only `mm click` and `mm screenshot --selector` (or `--frame`) fail fast, and only without `--timeout`. `wait-for`, `type`, `hover`, `inspect` and `scroll-to-element` wait the full timeout. A missing `--within` parent also waits the full timeout. A target that matches several elements fails at once with `MM_TARGET_NOT_FOUND` in every command that takes a target.

A `MM_CLICK_TIMEOUT` message ends with `(last Playwright step: …)`, which says why:

Expand Down Expand Up @@ -205,7 +205,7 @@ mm screenshot --name chart --frame e13
mm run-steps '{"steps":[{"tool":"screenshot","args":{"name":"viewport","fullPage":false}}],"observe":"none"}'
```

The result has the file `path`, `width` and `height`. A selector that matches no element within 2 s fails with `MM_TARGET_NOT_FOUND` (exit 4), also with a longer `--timeout`; to capture an element that appears later, `mm wait-for` it first. An element that is in the page waits up to `--timeout` (default 15000) to become visible; if it stays hidden, the command fails with `MM_SCREENSHOT_FAILED` (exit 1).
The result has the file `path`, `width` and `height`. Without `--timeout`, a selector or frame that matches no element fails after 2 s with `MM_TARGET_NOT_FOUND` (exit 4). With `--timeout`, the command waits that long for it to appear, so pass one when the screen is still loading. An element that is in the page waits up to `--timeout` (default 15000) to become visible; if it stays hidden, the command fails with `MM_SCREENSHOT_FAILED` (exit 1).

### Iframes

Expand All @@ -220,7 +220,7 @@ mm wait-for --frame testid:advanced-chart-iframe --selector body # the wrapper
- A `testid:` or `selector:` frame that is not an iframe but holds exactly one iframe resolves to that iframe; the command waits for it like any target. On the Extension asset page the `advanced-chart-iframe` testId is on such a wrapper `<div>`. A wrapper with several iframes fails at once with `MM_TARGET_NOT_FOUND`; one with no iframe fails with it after the wait.
- A missing frame on `describe-screen --frame` fails after 5 s with `MM_TARGET_NOT_FOUND` (`Frame not found: no iframe matches …`); on `get-text` / `wait-for` it waits for the full `--timeout`.
- `--frame` with a ref target is `MM_INVALID_INPUT` (exit 2): `f1e*` refs already point into their iframe. `scroll-to-element` and `long-press` reject `--frame`.
- A canvas-only iframe (the TradingView chart) has no accessibility nodes, so `describe-screen --frame` returns `nodes: []`. Use `mm screenshot --frame` and `get-text --frame … --selector body`.
- `--frame` enters one iframe level. The TradingView chart draws its canvas in an iframe nested inside the chart iframe, so `describe-screen --frame` returns `nodes: []` and `--selector canvas` matches nothing. Target the nested iframe element (`--selector iframe`) or `#tv_chart_container`, and use `mm screenshot --frame` and `get-text --frame … --selector body`.
- `mm inspect --frame` on the chart iframe failed with `MM_INSPECT_FAILED` (`Playwright did not report the element it resolved`). Use `get-text` or a screenshot there.
- `list-testids` and the `testIds` list cover the page only. Iframes inside iframes are not read.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Success has no `ok` field, and `mm stop` prints plain text. For the exact JSON s
| `MM_NO_ACTIVE_SESSION` | No session — `mm launch` first |
| `MM_LAUNCH_FAILED` | Browser launch failed |
| `MM_INVALID_INPUT` | Invalid parameters or flag; nothing ran |
| `MM_TARGET_NOT_FOUND` | Element not found, or a selector or testId matches several elements (strict mode violation, at once); a click without `--timeout` and `screenshot --selector` fail after 2 s, a stale ref at once — `mm describe-screen` |
| `MM_TARGET_NOT_FOUND` | Element not found, or a selector or testId matches several elements (strict mode violation, at once); a click or `screenshot --selector` without `--timeout` fails after 2 s, a stale ref at once — `mm describe-screen` |
| `MM_TAB_NOT_FOUND` | Tab not found |
| `MM_CLICK_FAILED` | Click failed (post-find) |
| `MM_CLICK_TIMEOUT` | Click timed out; state unknown; the message ends with Playwright's last step — `mm describe-screen` before retrying |
Expand Down Expand Up @@ -92,7 +92,7 @@ Success has no `ok` field, and `mm stop` prints plain text. For the exact JSON s
| A ref clicks the wrong element | After `--observe none`: a fallback `role=`/`text=` or icon-button ref | `mm describe-screen`, or target by `--testid` |
| Ref click fails at once with `MM_TARGET_NOT_FOUND` | Removed, re-mounted or changed text after the snapshot | Expected; `mm describe-screen` and re-target |
| `MM_TARGET_NOT_FOUND`: strict mode violation (exit 4) | A fallback ref or an explicit selector/testId matches several elements; nothing was done | Target by `--testid`/`--selector`; scope it with `--within` |
| `MM_TARGET_NOT_FOUND` after 2 s on `mm screenshot --selector` | No element matches the selector | Check `mm describe-screen`; if it appears later, `mm wait-for` it before the screenshot |
| `MM_TARGET_NOT_FOUND` after 2 s on `mm screenshot --selector` | No element matches the selector (wrong or not rendered yet) | Check `mm describe-screen`; if the screen is still loading, retry with `--timeout <ms>` |
| `MM_QUEUE_TIMEOUT`: `The daemon stopped the request after 30000ms` (exit 5) | A command with no action timeout ran past the queue limit, for example `run-steps` without `batchTimeoutMs` whose steps take longer | `mm describe-screen` before retry; add `batchTimeoutMs` or split the batch |
| `MM_TARGET_NOT_FOUND`: `Frame not found: …` or `strict mode violation` on `--frame` (exit 4) | The `--frame` ref is not an iframe, or the testId/selector is not an iframe and holds zero or several iframes | Use the iframe's ref from `mm describe-screen`, or a selector that matches one iframe |
| `MM_INVALID_INPUT`: `frame cannot be used with a ref` (exit 2) | `--frame` plus a ref target | Drop `--frame` (`f1e*` refs point into the iframe), or target by `--testid` / `--selector` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Phase-specific error codes on timeout:
- `MM_GETTEXT_TIMEOUT` — the element did not appear or `textContent()` hung. `retryable: true`.
- `MM_PAGE_CLOSED` — page closed during action (expected for some confirmation flows); exits 3.
- `MM_QUEUE_TIMEOUT` — the daemon stopped a command that has no action timeout after about 30 s, for example a `run-steps` batch without `batchTimeoutMs` whose steps take longer. State unknown.
- `MM_SCREENSHOT_FAILED` — the `mm screenshot --selector` element is in the page but stays hidden for `--timeout` (default 15000); exit 1. A selector that matches nothing fails after 2 s with `MM_TARGET_NOT_FOUND`, even with a longer `--timeout`: `mm wait-for` an element that appears late first.
- `MM_SCREENSHOT_FAILED` — the `mm screenshot --selector` element is in the page but stays hidden for `--timeout` (default 15000); exit 1. Without `--timeout`, a selector that matches nothing fails after 2 s with `MM_TARGET_NOT_FOUND`; pass `--timeout` to wait for an element that appears late.

For the full error code and exit code tables, see [references/error-recovery.md](references/error-recovery.md).

Expand Down Expand Up @@ -292,7 +292,7 @@ The review page shows `confirm-send-amount` and `recipient-address`. While it lo

## Iframes

The asset page shows the TradingView chart in a cross-origin iframe when the `tokenDetailsAdvancedCharts` remote flag is on and the candle chart is selected. Both are off in the e2e fixture. To show it there: mock the candles with `mm mock-network add` on `GET https://price.api.cx.metamask.io/v3/ohlcv-chart/**` (JSON `{"data":[{"timestamp":<ms>,"open":…,"high":…,"low":…,"close":…,"volume":…},…],"hasNext":false,"nextCursor":null}`), `mm click --testid multichain-token-list-button`, then write Redux state ([operation 3](references/state-manipulation.md#five-operations)) with `next.remoteFeatureFlags.tokenDetailsAdvancedCharts = true` and `next.preferences.tdpChartType = 1`, and `mm wait-for --testid advanced-chart-iframe`. Without the mock the chart shows no data. `mm describe-screen` lists it as `{"role":"iframe","name":"Advanced Chart"}`. The `advanced-chart-iframe` testId is on a wrapper `<div>` that holds the iframe, so `--frame testid:advanced-chart-iframe` resolves to that iframe. The chart draws on a canvas, so it has no accessibility nodes: use `mm screenshot --frame <ref>`. See [Iframes](references/cli-reference.md#iframes).
The asset page shows the TradingView chart in a cross-origin iframe when the `tokenDetailsAdvancedCharts` remote flag is on and the candle chart is selected. Both are off in the e2e fixture. To show it there: mock the candles with `mm mock-network add` on `GET https://price.api.cx.metamask.io/v3/ohlcv-chart/**` (JSON `{"data":[{"timestamp":<ms>,"open":…,"high":…,"low":…,"close":…,"volume":…},…],"hasNext":false,"nextCursor":null}`), `mm click --testid multichain-token-list-button`, then write Redux state ([operation 3](references/state-manipulation.md#five-operations)) with `next.remoteFeatureFlags.tokenDetailsAdvancedCharts = true` and `next.preferences.tdpChartType = 1`, and `mm wait-for --testid advanced-chart-iframe`. Without the mock the chart shows no data. `mm describe-screen` lists it as `{"role":"iframe","name":"Advanced Chart"}`. The `advanced-chart-iframe` testId is on a wrapper `<div>` that holds the iframe, so `--frame testid:advanced-chart-iframe` resolves to that iframe. The chart draws on a canvas in a nested iframe, which `--frame` does not enter, so it has no accessibility nodes: use `mm screenshot --frame <ref>`, and target the nested iframe with `--selector iframe`. See [Iframes](references/cli-reference.md#iframes).

## Batching with mm run-steps

Expand Down