From 584d517c411a72a783c3b0c75d3b9d76aa05aff5 Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Mon, 16 Nov 2026 13:58:45 +0500
Subject: [PATCH 01/23] feat: add no setup test recording
---
.github/workflows/ci.yml | 2 +
.github/workflows/dependency-updates.yml | 2 +
.github/workflows/release.yml | 2 +
apps/codex-plugin/tooling/smoke-package.mjs | 4 +
docs/telemetry.md | 7 +
docs/testing-panel.md | 37 +-
package-lock.json | 27 -
package.json | 1 +
packages/core/src/e2e-runtime.ts | 77 +
packages/core/src/telemetry.ts | 11 +
packages/core/src/testing-device.ts | 16 +-
packages/core/src/testing-projects.ts | 66 +-
packages/core/src/testing-run.ts | 107 +-
packages/core/src/testing-setup.ts | 304 +++
packages/core/src/testing-target-discovery.ts | 75 +
packages/core/src/testing-tools.ts | 80 +-
packages/core/test/testing-projects.test.ts | 39 +-
packages/core/test/testing-run.test.ts | 26 +-
.../core/test/testing-setup-telemetry.test.ts | 23 +
packages/core/test/testing-setup.test.ts | 100 +
.../test/testing-target-discovery.test.ts | 45 +
packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt | 2315 +++++++++++++++++
packages/runtimes/e2e/package-lock.json | 1150 ++++++++
packages/runtimes/e2e/package.json | 19 +
packages/runtimes/e2e/release.json | 56 +
packages/ui/src/components/testing-view.tsx | 117 +-
packages/ui/src/testing-panel.ts | 97 +-
tooling/build.mjs | 13 +
tooling/dependency-lanes.mjs | 6 +-
tooling/host-runtime.mjs | 2 +
tooling/test/e2e-runtime-package.test.ts | 27 +
tooling/update-dependencies.mjs | 4 +-
tooling/vendor-e2e.mjs | 39 +
33 files changed, 4807 insertions(+), 89 deletions(-)
create mode 100644 packages/core/src/e2e-runtime.ts
create mode 100644 packages/core/src/testing-setup.ts
create mode 100644 packages/core/src/testing-target-discovery.ts
create mode 100644 packages/core/test/testing-setup-telemetry.test.ts
create mode 100644 packages/core/test/testing-setup.test.ts
create mode 100644 packages/core/test/testing-target-discovery.test.ts
create mode 100644 packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt
create mode 100644 packages/runtimes/e2e/package-lock.json
create mode 100644 packages/runtimes/e2e/package.json
create mode 100644 packages/runtimes/e2e/release.json
create mode 100644 tooling/test/e2e-runtime-package.test.ts
create mode 100644 tooling/vendor-e2e.mjs
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bcf38c74..18bcb602 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -34,12 +34,14 @@ jobs:
cache-dependency-path: |
package-lock.json
packages/runtimes/agent-device/package-lock.json
+ packages/runtimes/e2e/package-lock.json
packages/runtimes/serve-emu/package-lock.json
- name: Install dependencies and device runtimes
run: |
npm ci --no-audit --no-fund
npm run vendor:agent-device
+ npm run vendor:e2e
npm run vendor:serve-emu
# macOS-only paths skip themselves here; the release build runs the full suite on macOS.
diff --git a/.github/workflows/dependency-updates.yml b/.github/workflows/dependency-updates.yml
index 6e9c3aff..6d9845eb 100644
--- a/.github/workflows/dependency-updates.yml
+++ b/.github/workflows/dependency-updates.yml
@@ -77,6 +77,7 @@ jobs:
cache-dependency-path: |
package-lock.json
packages/runtimes/agent-device/package-lock.json
+ packages/runtimes/e2e/package-lock.json
packages/runtimes/serve-emu/package-lock.json
# Same toolchain as the release build, so rebuilt helpers match what ships.
@@ -94,6 +95,7 @@ jobs:
run: |
npm ci --no-audit --no-fund
npm run vendor:agent-device
+ npm run vendor:e2e
npm run vendor:serve-emu
# Applies, prepares and commits each lane on the update branch, then runs the
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7722692d..b1018cce 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -44,6 +44,7 @@ jobs:
cache-dependency-path: |
package-lock.json
packages/runtimes/agent-device/package-lock.json
+ packages/runtimes/e2e/package-lock.json
packages/runtimes/serve-emu/package-lock.json
- name: Validate release version and tag
@@ -82,6 +83,7 @@ jobs:
npm ci --no-audit --no-fund
npm run lint:commits -- --last --verbose
npm run vendor:agent-device
+ npm run vendor:e2e
npm run vendor:serve-emu
- name: Restore or build native helpers with matching symbols
diff --git a/apps/codex-plugin/tooling/smoke-package.mjs b/apps/codex-plugin/tooling/smoke-package.mjs
index 949e0735..0717207c 100644
--- a/apps/codex-plugin/tooling/smoke-package.mjs
+++ b/apps/codex-plugin/tooling/smoke-package.mjs
@@ -121,6 +121,10 @@ try {
for (const name of ["mobile_list_ios_devices", "mobile_list_android_devices", "mobile_boot_android_emulator", "mobile_android_stream_session", "mobile_ios_mirror_session", "mobile_ios_mirror_reset", "mobile_ios_mirror_close"]) assert.ok(tools.tools.some(tool => tool.name === name));
for (const name of ["device_open", "device_snapshot", "device_press", "device_screenshot"]) assert.ok(tools.tools.some(tool => tool.name === name), name);
await access(join(plugin, "dist/agent-device/tools.json"));
+ await access(join(plugin, "dist/e2e/node_modules/e2e/dist/cli/bin.js"));
+ await access(join(plugin, "dist/e2e/node_modules/@e2e-dev/mobile/dist/nodes.js"));
+ await access(join(plugin, "dist/e2e/release.json"));
+ await access(join(plugin, "dist/e2e/THIRD_PARTY_NOTICES.txt"));
const physicalMirror = tools.tools.find(tool => tool.name === "mobile_ios_mirror_session");
assert.deepEqual(physicalMirror._meta.ui.visibility, ["app"]);
await access(join(plugin, "dist/serve-emu/src/cli.mjs"));
diff --git a/docs/telemetry.md b/docs/telemetry.md
index 37179a16..145675ba 100644
--- a/docs/telemetry.md
+++ b/docs/telemetry.md
@@ -87,6 +87,13 @@ The panel UI sends nothing to Mixpanel, and its CSP is unchanged.
## Volume policy
+Testing setup adds `testing.setup.operation.samples`. Its attributes are limited to `component`,
+`surface`, `operation` (`plan`, `apply`, `login`, `preference`), bounded `outcome`, and a supported
+provider id (unknown values become `other`). It never includes project paths, bundle identifiers,
+model ids, endpoints, prompts, test/source text, OAuth codes, API keys or tokens. The existing UI
+Testing timings and outcome counters likewise carry no user content. Cancellation and partial failure
+are outcomes, not error payloads, and telemetry opt-out applies unchanged.
+
Since 0.1.164, application metrics in the UI, Node servers and native helpers use
independent 0.5% point sampling before SDK buffering and network transmission.
This reduces metric point volume by 99.5% on average, including automatic Node
diff --git a/docs/testing-panel.md b/docs/testing-panel.md
index 5001915f..5467cc7f 100644
--- a/docs/testing-panel.md
+++ b/docs/testing-panel.md
@@ -1,5 +1,30 @@
# Testing panel — record e2e tests from the mirror
+## Zero-setup runtime and optional project setup
+
+Testing Studio no longer requires `e2e.config.ts`. Every panel build ships a pinned, integrity-checked
+runtime containing `e2e`, `@e2e-dev/mobile`, the supported AI SDK/provider packages, license notices
+and release metadata. A compatible project-local config and runtime remain authoritative. With no
+config, no compatible mobile target, no local packages, or an incompatible API line, Studio switches
+to **Bundled runtime** and keeps generated config plus saved tests in Mobile Dev's private state. Record,
+Save, Run, Play until here, manual recording and agent recording therefore do not modify the project.
+
+Bundled targets are discovered in this order: the project's local Expo CLI (`expo config --json`, never
+network `npx`), non-executing `app.json`/`app.config.*` data, then the mirrored foreground app. Both iOS
+and Android targets are retained when known and are editable in the setup wizard.
+
+Deterministic tests use no model. The first bundled run containing `agent.act`, `agent.assert`,
+`agent.waitFor` or `agent.extract` opens the provider/model chooser. Subscription sign-in is driven by
+E2E's OAuth callbacks; Mobile Dev persists only the non-secret provider, model id and optional endpoint.
+Hosts may preselect a choice only through advertised `configuration.mobileDev.testing.defaultModel` (or
+the equivalent experimental capability); no host-name branch exists.
+
+**Set up project** is the opt-in GUI equivalent of `e2e init`: targets and provider are editable, then
+an immutable plan lists every create/update/skip action. Apply revalidates the plan for stale files,
+preserves existing configs/tests/skills/MCP entries, uses the detected package manager, reports progress,
+supports cancellation and reports partial failures without pretending already-written files were rolled
+back. Setup is the only zero-setup Studio path that writes configuration into the selected project.
+
Status: Android emulators are supported alongside iOS simulators — the device is identified by
`deviceId` plus an explicit `platform`, and the e2e run is pinned with `--target`. The Android path
is not yet verified on a real emulator, including the pixel space below. Steps 1-6 of the build
@@ -11,9 +36,10 @@ mirror still records nothing (step 7), and the Maestro emitter (step 8) is still
A test can also be recorded by the user's own coding agent, which drives the same recorder from
the server — see [docs/agent-recording.md](agent-recording.md).
-A new workspace tool, **Testing**, that turns the existing simulator mirror into a
+A workspace tool, **Testing**, that turns the existing simulator mirror into a
Maestro-Studio-style recorder: pick a project, launch its app, tap the mirror, and watch the test
-source grow one step per interaction. The file is written to the project when the user clicks Save.
+source grow one step per interaction. In project mode Save writes to the project; in bundled mode it
+writes to Studio's private state until the user explicitly runs project setup.
First pass targets the **iOS simulator** (and now the **Android emulator**) and the **e2e** runner (`@e2e-dev/mobile`).
Maestro YAML is a second emitter behind the same recorder.
@@ -46,9 +72,8 @@ Almost every primitive is in place; the panel is mostly wiring.
Two things do **not** exist:
-1. **No path writes into the user's project.** Every `writeFile` in the server targets its own
- state (recordings, tracesift, clipboard temp files). The server does not know a project root.
-2. **No codegen of any kind.**
+The original implementation lacked project writes and code generation; both are now present behind
+the explicit project selection and the storage boundary described above.
## Unsaved recordings
@@ -83,7 +108,7 @@ it holds **two groups**:
| Group | Holds | Starts |
|---|---|---|
| **Not stored** | The drafts: a kept flow with its step count, how long ago it was touched and whether the user or an agent recorded it. **New recording** is at its foot | Expanded — it is what is being worked on |
-| **In the project** | The `.e2e.ts` files in the project's own `tests/` folder, newest first | Collapsed — it is the archive |
+| **In the project / Studio** | Project `.e2e.ts` files in project mode; private Studio tests in bundled mode | Collapsed — it is the archive |
The second group exists because deleting the draft on save had an effect nobody asked for: the
test the user had just saved **left the list**. There was nowhere for it to go. Now it moves from
diff --git a/package-lock.json b/package-lock.json
index 080fd135..5bb0098d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2192,7 +2192,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4145,7 +4144,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4159,7 +4157,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4173,7 +4170,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4187,7 +4183,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4201,7 +4196,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4215,7 +4209,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4229,7 +4222,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4243,7 +4235,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4257,7 +4248,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4271,7 +4261,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4285,7 +4274,6 @@
"cpu": [
"loong64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4299,7 +4287,6 @@
"cpu": [
"loong64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4313,7 +4300,6 @@
"cpu": [
"ppc64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4327,7 +4313,6 @@
"cpu": [
"ppc64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4341,7 +4326,6 @@
"cpu": [
"riscv64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4355,7 +4339,6 @@
"cpu": [
"riscv64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4369,7 +4352,6 @@
"cpu": [
"s390x"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4383,7 +4365,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4397,7 +4378,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4411,7 +4391,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4425,7 +4404,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4439,7 +4417,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4453,7 +4430,6 @@
"cpu": [
"ia32"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4467,7 +4443,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -4481,7 +4456,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -7315,7 +7289,6 @@
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
- "dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
diff --git a/package.json b/package.json
index 334d2cfa..a0b58c89 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,7 @@
"vendor:baguette": "node tooling/vendor-baguette.mjs",
"vendor:resource-saving": "node tooling/vendor-resource-saving.mjs",
"vendor:agent-device": "npm ci --prefix packages/runtimes/agent-device --ignore-scripts --no-audit --no-fund",
+ "vendor:e2e": "node tooling/vendor-e2e.mjs",
"catalog:agent-device": "node tooling/agent-device-catalog.mjs",
"rebuild:baguette": "node tooling/rebuild-baguette.mjs",
"rebuild:ios-fps": "node tooling/build-fps.mjs ios",
diff --git a/packages/core/src/e2e-runtime.ts b/packages/core/src/e2e-runtime.ts
new file mode 100644
index 00000000..e0cb3b09
--- /dev/null
+++ b/packages/core/src/e2e-runtime.ts
@@ -0,0 +1,77 @@
+import { createHash } from "node:crypto";
+import { existsSync } from "node:fs";
+import { readFile } from "node:fs/promises";
+import { dirname, join, resolve } from "node:path";
+import { fileURLToPath } from "node:url";
+import { ExpectedOperationError } from "@mobile-dev/shared/error-reporting.ts";
+
+export type TestingRuntimeMode = "project" | "bundled";
+
+export interface TestingRuntimeDescriptor {
+ mode: TestingRuntimeMode;
+ root: string;
+ e2eVersion: string;
+ mobileVersion: string;
+ reason?: string;
+}
+
+const sourceRuntime = resolve("packages/runtimes/e2e");
+
+/** The shipped runtime beside server.mjs, with the source tree fallback used by unit tests. */
+export function bundledE2eRoot(): string {
+ const configured = process.env.MOBILE_DEV_E2E_RUNTIME?.trim();
+ const besideServer = join(dirname(fileURLToPath(import.meta.url)), "e2e");
+ for (const candidate of [configured, besideServer, sourceRuntime]) {
+ if (candidate && existsSync(join(candidate, "node_modules/e2e/package.json"))) return candidate;
+ }
+ throw new ExpectedOperationError("app_unavailable", "The bundled e2e runtime is missing. Reinstall Mobile Dev.");
+}
+
+async function version(root: string, name: string): Promise {
+ const metadata = JSON.parse(await readFile(join(root, "node_modules", name, "package.json"), "utf8"));
+ return typeof metadata.version === "string" ? metadata.version : "unknown";
+}
+
+export async function bundledRuntimeDescriptor(reason?: string): Promise {
+ const root = bundledE2eRoot();
+ return {
+ mode: "bundled",
+ root,
+ e2eVersion: await version(root, "e2e"),
+ mobileVersion: await version(root, "@e2e-dev/mobile"),
+ ...(reason ? { reason } : {}),
+ };
+}
+
+export async function projectRuntimeDescriptor(projectPath: string): Promise {
+ const root = projectPath;
+ if (!existsSync(join(root, "node_modules/.bin/e2e"))
+ || !existsSync(join(root, "node_modules/@e2e-dev/mobile/dist/nodes.js"))) return;
+ const [e2eVersion, mobileVersion, bundled] = await Promise.all([
+ version(root, "e2e"), version(root, "@e2e-dev/mobile"), bundledRuntimeDescriptor(),
+ ]);
+ const apiLine = (value: string) => value.split(".").slice(0, 2).join(".");
+ // Studio imports the runner's public CLI and mobile projection. Keep the project authoritative
+ // only on the API lines the shipped Studio was tested against; a newer or older local install
+ // remains untouched and Studio falls back to its pinned runtime.
+ if (apiLine(e2eVersion) !== apiLine(bundled.e2eVersion)
+ || apiLine(mobileVersion) !== apiLine(bundled.mobileVersion)) return;
+ return {
+ mode: "project",
+ root,
+ e2eVersion,
+ mobileVersion,
+ };
+}
+
+export async function verifyBundledE2eRuntime(): Promise {
+ const root = bundledE2eRoot();
+ const lock = await readFile(join(root, "package-lock.json"), "utf8");
+ const release = JSON.parse(await readFile(join(root, "release.json"), "utf8"));
+ const actual = createHash("sha256").update(lock).digest("hex");
+ if (release.lockfileSHA256 !== actual) throw new Error("Bundled e2e runtime lockfile integrity check failed.");
+ for (const name of Object.keys(release.packages ?? {})) {
+ const installed = await version(root, name);
+ if (release.packages?.[name]?.version !== installed) throw new Error(`Bundled ${name} version does not match release metadata.`);
+ }
+}
diff --git a/packages/core/src/telemetry.ts b/packages/core/src/telemetry.ts
index e4ab0d36..a2c6a853 100644
--- a/packages/core/src/telemetry.ts
+++ b/packages/core/src/telemetry.ts
@@ -94,6 +94,17 @@ export function recordTestingAgentRead(outcome: "success" | "failed", duration:
if (outcome === "success") Sentry.metrics.gauge("testing.agent.screen.elements", elements, { attributes });
}
+/**
+ * Setup telemetry is deliberately structural: operation, bounded outcome and provider id only.
+ * It never includes prompts, source, project paths, app identifiers, model ids, URLs or tokens.
+ */
+export function recordTestingSetupOperation(operation: "plan" | "apply" | "login" | "preference", outcome: "started" | "succeeded" | "failed" | "cancelled", provider: string = "none") {
+ if (process.env.MOBILE_DEV_TELEMETRY === "off") return;
+ const allowed = ["none", "vercel", "openrouter", "openai-compatible", "chatgpt", "copilot", "opencode-console", "grok"];
+ const attributes = { component: "server", surface: "testing", operation, outcome, provider: allowed.includes(provider) ? provider : "other" };
+ Sentry.metrics.count("testing.setup.operation.samples", 1, { attributes });
+}
+
export function recordTraceSiftOperation(operation: "ready" | "analyze" | "remember" | "restore" | "handoff" | "task" | "payload" | "pick" | "project", outcome: "success" | "failed", duration: number) {
if (process.env.MOBILE_DEV_TELEMETRY === "off") return;
const attributes = { component: "server", surface: "tracesift", operation, outcome };
diff --git a/packages/core/src/testing-device.ts b/packages/core/src/testing-device.ts
index e5f5140e..c1e6b2c3 100644
--- a/packages/core/src/testing-device.ts
+++ b/packages/core/src/testing-device.ts
@@ -54,6 +54,8 @@ export interface TestingDeviceTarget {
platform: "ios" | "android";
/** The e2e project whose `@e2e-dev/mobile` projects the snapshot; its build, not ours. */
projectPath: string;
+ /** The project root in project mode, or Mobile Dev's pinned artifact in bundled mode. */
+ runtimeRoot?: string;
/** The app to attach to, from the project's config. Never launched fresh — see `attach`. */
bundleId: string;
}
@@ -230,13 +232,13 @@ export class TestingDevices {
return this.client;
}
- private projection(projectPath: string): Promise {
- let pending = this.projections.get(projectPath);
+ private projection(runtimeRoot: string): Promise {
+ let pending = this.projections.get(runtimeRoot);
if (!pending) {
- pending = loadProjection(projectPath);
+ pending = loadProjection(runtimeRoot);
// A failed load must not be cached: the user installs the dependency and records again.
- pending.catch(() => this.projections.delete(projectPath));
- this.projections.set(projectPath, pending);
+ pending.catch(() => this.projections.delete(runtimeRoot));
+ this.projections.set(runtimeRoot, pending);
}
return pending;
}
@@ -271,7 +273,7 @@ export class TestingDevices {
/** Every input that decides which app/session is attached and how its tree is projected. */
private key(target: TestingDeviceTarget): string {
- return `${target.platform}\u0000${target.deviceId}\u0000${target.projectPath}\u0000${target.bundleId}`;
+ return `${target.platform}\u0000${target.deviceId}\u0000${target.projectPath}\u0000${target.runtimeRoot ?? target.projectPath}\u0000${target.bundleId}`;
}
async read(target: TestingDeviceTarget): Promise {
@@ -281,7 +283,7 @@ export class TestingDevices {
}
private async readOnce(target: TestingDeviceTarget): Promise {
- const [client, projection] = await Promise.all([this.connect(), this.projection(target.projectPath)]);
+ const [client, projection] = await Promise.all([this.connect(), this.projection(target.runtimeRoot ?? target.projectPath)]);
if (this.attached !== this.key(target)) await this.attach(client, target);
let snapshot: { nodes?: unknown };
try {
diff --git a/packages/core/src/testing-projects.ts b/packages/core/src/testing-projects.ts
index 2afa2fce..be99691f 100644
--- a/packages/core/src/testing-projects.ts
+++ b/packages/core/src/testing-projects.ts
@@ -5,6 +5,10 @@ import { basename, dirname, isAbsolute, join, relative, resolve } from "node:pat
import { ExpectedOperationError } from "@mobile-dev/shared/error-reporting.ts";
import { chooseProjectFolder } from "./project-folder-dialog.ts";
import { recordProjectDialog } from "./telemetry.ts";
+import { bundledRuntimeDescriptor, projectRuntimeDescriptor } from "./e2e-runtime.ts";
+import type { TestingRuntimeDescriptor } from "./e2e-runtime.ts";
+import { discoverTestingTargets } from "./testing-target-discovery.ts";
+import type { ForegroundTestingTarget } from "./testing-target-discovery.ts";
/**
* The projects the Testing panel can record against: folders holding an `e2e.config.ts`. The user
@@ -40,6 +44,11 @@ export interface TestingProjectConfig {
/** Absolute path of the config file that was read. */
configPath: string;
targets: TestingTarget[];
+ runtimeMode: "project" | "bundled";
+ runtime: TestingRuntimeDescriptor;
+ setupState: "configured" | "available";
+ targetSource: "project" | "expo-cli" | "static-expo" | "foreground" | "none";
+ warning?: string;
}
interface Choice { path: string; lastPickedAt: string }
@@ -107,15 +116,29 @@ export function parseTargets(source: string): TestingTarget[] {
return targets;
}
-/** Reads one project's e2e config. Throws when the folder is not an e2e project. */
-export async function inspectProject(projectPath: string): Promise {
+/** Reads one selected project and chooses its compatible project-local or bundled runtime. */
+export async function inspectProject(projectPath: string, foreground?: ForegroundTestingTarget): Promise {
const path = normalize(projectPath.trim());
if (!isAbsolute(path)) throw new ExpectedOperationError("invalid_input", "Choose the project folder.");
if (!(await isDirectory(path))) throw new ExpectedOperationError("invalid_input", "That project folder no longer exists.");
const configPath = await findConfig(path);
- if (!configPath) throw new ExpectedOperationError("invalid_input", "That folder has no e2e.config.ts. Run `npx e2e init` in it first.");
- const source = await readFile(configPath, "utf-8").catch(() => "");
- return { path, name: basename(path) || path, configPath, targets: parseTargets(source) };
+ const source = configPath ? await readFile(configPath, "utf-8").catch(() => "") : "";
+ const configuredTargets = parseTargets(source);
+ const compatibleTargets = configuredTargets.filter(target => (target.platform === "ios" || target.platform === "android") && target.bundleId);
+ const projectRuntime = configPath && compatibleTargets.length ? await projectRuntimeDescriptor(path) : undefined;
+ if (projectRuntime) return {
+ path, name: basename(path) || path, configPath: configPath!, targets: compatibleTargets,
+ runtimeMode: "project", runtime: projectRuntime, setupState: "configured", targetSource: "project",
+ };
+ const discovered = await discoverTestingTargets(path, foreground);
+ const reason = !configPath ? "No e2e config is present."
+ : compatibleTargets.length === 0 ? "The project config has no compatible mobile target."
+ : "The project-local e2e runtime is missing or incompatible with this Studio version.";
+ return {
+ path, name: basename(path) || path, configPath: configPath ?? "", targets: discovered.targets,
+ runtimeMode: "bundled", runtime: await bundledRuntimeDescriptor(reason), setupState: "available",
+ targetSource: discovered.source, warning: [reason, discovered.warning].filter(Boolean).join(" "),
+ };
}
export class TestingProjectChoices {
@@ -174,10 +197,10 @@ export class TestingProjectChoices {
return await next;
}
- /** Recorded folders that still exist and still hold an e2e config, newest first. */
+ /** Recorded folders that still exist, including zero-setup projects without an e2e config. */
async list(): Promise {
const projects = TestingProjectChoices.clean(await this.read());
- const available = await Promise.all(projects.map(async entry => ((await findConfig(entry.path)) ? entry : null)));
+ const available = await Promise.all(projects.map(async entry => ((await isDirectory(entry.path)) ? entry : null)));
return available.filter((entry): entry is TestingProjectChoice => entry !== null);
}
@@ -220,6 +243,21 @@ const MAX_TEST_BYTES = 256 * 1024;
export interface WrittenTest { path: string; written: boolean; existed: boolean }
+/**
+ * Project mode stores tests in the project. Bundled mode deliberately does not: its saved tests
+ * live under Mobile Dev's private state, keyed by a digest so telemetry, logs and directory names
+ * never contain the selected project's path.
+ */
+function bundledProjectDirectory(projectPath: string): string {
+ const stateRoot = process.env.MOBILE_DEV_TESTING_DIRECTORY?.trim() || TESTING_DIRECTORY;
+ return join(stateRoot, "bundled", sourceHash(normalize(projectPath)));
+}
+
+async function testStorage(projectPath: string): Promise<{ project: TestingProjectConfig; root: string }> {
+ const project = await inspectProject(projectPath);
+ return { project, root: project.runtimeMode === "project" ? project.path : bundledProjectDirectory(project.path) };
+}
+
/**
* Resolves the absolute path a recorded test may be written to.
*
@@ -271,8 +309,8 @@ export async function resolveTestRunPaths(projectPath: string, relativePath: str
relativePath: string;
configPath?: string;
}> {
- const project = await inspectProject(projectPath);
- const testPath = await resolveTestPath(project.path, relativePath);
+ const { project, root } = await testStorage(projectPath);
+ const testPath = await resolveTestPath(root, relativePath);
if (!(await isFile(testPath))) throw new ExpectedOperationError("invalid_input", "That test file is no longer there.");
if (configPath !== undefined) {
const requestedConfig = normalize(configPath.trim());
@@ -281,7 +319,7 @@ export async function resolveTestRunPaths(projectPath: string, relativePath: str
}
return {
projectPath: project.path,
- relativePath: relative(project.path, testPath).split(/[\\/]/).join("/"),
+ relativePath: [TESTS_DIRECTORY, ...relative(resolve(root, TESTS_DIRECTORY), testPath).split(/[\\/]/).filter(Boolean)].join("/"),
...(configPath === undefined ? {} : { configPath: project.configPath }),
};
}
@@ -291,7 +329,7 @@ export async function resolveTestRunPaths(projectPath: string, relativePath: str
* rather than replaced, so the panel can ask before it destroys someone's test.
*/
export async function writeTestFile(projectPath: string, relativePath: string, contents: string, overwrite = false): Promise {
- const { path: root } = await inspectProject(projectPath);
+ const { root } = await testStorage(projectPath);
if (Buffer.byteLength(contents, "utf-8") > MAX_TEST_BYTES) throw new ExpectedOperationError("invalid_input", "That test is too large to write.");
const target = await resolveTestPath(root, relativePath);
const existed = await isFile(target);
@@ -333,7 +371,7 @@ const MAX_LISTED_TESTS = 200;
* A project with no `tests/` folder yet is an empty list, not an error: nothing has been saved.
*/
export async function listTestFiles(projectPath: string): Promise {
- const { path: root } = await inspectProject(projectPath);
+ const { root } = await testStorage(projectPath);
const testsRoot = resolve(root, TESTS_DIRECTORY);
const found: StoredTest[] = [];
const walk = async (directory: string, depth: number): Promise => {
@@ -362,7 +400,7 @@ export async function listTestFiles(projectPath: string): Promise
/** Reads a listed test for the panel's read-only source preview. */
export async function readTestFile(projectPath: string, relativePath: string): Promise {
- const { path: root } = await inspectProject(projectPath);
+ const { root } = await testStorage(projectPath);
const target = await resolveTestPath(root, relativePath);
const info = await stat(target).catch(() => undefined);
if (!info?.isFile()) throw new ExpectedOperationError("invalid_input", "That test file is no longer there.");
@@ -435,7 +473,7 @@ export async function discardStagedTestFile(projectPath: string, relativePath: s
* this removes a file from the user's repository, which nothing here can put back.
*/
export async function deleteTestFile(projectPath: string, relativePath: string): Promise<{ path: string; removed: boolean }> {
- const { path: root } = await inspectProject(projectPath);
+ const { root } = await testStorage(projectPath);
const target = await resolveTestPath(root, relativePath);
const removed = await unlink(target).then(() => true, () => false);
return { path: target, removed };
diff --git a/packages/core/src/testing-run.ts b/packages/core/src/testing-run.ts
index 85735c38..cb37552f 100644
--- a/packages/core/src/testing-run.ts
+++ b/packages/core/src/testing-run.ts
@@ -1,7 +1,8 @@
import { spawn } from "node:child_process";
import { existsSync } from "node:fs";
-import { rm, writeFile } from "node:fs/promises";
-import { join } from "node:path";
+import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { dirname, join } from "node:path";
import { pathToFileURL } from "node:url";
import { ExpectedOperationError } from "@mobile-dev/shared/error-reporting.ts";
@@ -246,8 +247,16 @@ export interface TestRunRequest {
untilSource?: string;
/** The e2e target to run against; without it the runner takes the config's first, whatever platform that is. */
target?: string;
+ /** Explicit runner/projection runtime. Project mode remains authoritative when compatible. */
+ runtime?: { mode: "project" | "bundled"; root: string };
+ /** Required only for a bundled run, whose ephemeral config cannot read a project target. */
+ bundledTarget?: { platform: "ios" | "android"; bundleId: string };
+ /** Non-secret preference for a bundled test containing agent.* calls. */
+ model?: { provider: BundledModelProvider; model: string; endpoint?: string };
}
+export type BundledModelProvider = "vercel" | "openrouter" | "openai-compatible" | "chatgpt" | "copilot" | "opencode-console" | "grok";
+
/**
* Where the generated config goes: beside the project's own, at the project root.
*
@@ -339,6 +348,7 @@ function refusedTheConfig(result: TestRunResult): boolean {
}
export async function runRecordedTest(request: TestRunRequest, deps: TestRunDeps = {}): Promise {
+ if (request.runtime?.mode === "bundled") return runBundledTest(request, deps);
const result = await runOnce(request, deps);
if (!refusedTheConfig(result) || !request.configPath || !deps.onProgress) return result;
// Without the progress sink nothing is generated, so this is the plain run.
@@ -348,6 +358,99 @@ export async function runRecordedTest(request: TestRunRequest, deps: TestRunDeps
return retried.steps.length > 0 || retried.status !== result.status ? retried : result;
}
+function quoted(value: string): string { return JSON.stringify(value); }
+
+function bundledModelSource(model: TestRunRequest["model"]): { imports: string[]; field: string } | undefined {
+ if (!model) return;
+ const id = quoted(model.model);
+ switch (model.provider) {
+ case "vercel": return { imports: ["import { gateway } from 'ai';"], field: `gateway(${id})` };
+ case "openrouter": return { imports: ["import { openrouter } from '@openrouter/ai-sdk-provider';"], field: `openrouter(${id})` };
+ case "openai-compatible": return {
+ imports: ["import { createOpenAICompatible } from '@ai-sdk/openai-compatible';"],
+ field: `createOpenAICompatible({ name: 'openai-compatible', baseURL: ${quoted(model.endpoint ?? "http://127.0.0.1:11434/v1")}, apiKey: process.env.LLM_API_KEY }).chatModel(${id})`,
+ };
+ case "chatgpt": return { imports: ["import { chatgpt } from 'e2e/oauth/chatgpt';"], field: `chatgpt(${id})` };
+ case "copilot": return { imports: ["import { copilot } from 'e2e/oauth/copilot';"], field: `copilot(${id})` };
+ case "opencode-console": return { imports: ["import { opencodeConsole } from 'e2e/oauth/opencode-console';"], field: `opencodeConsole(${id})` };
+ case "grok": return { imports: ["import { grok } from 'e2e/oauth/grok';"], field: `grok(${id})` };
+ }
+}
+
+export function bundledConfigSource(target: NonNullable, model?: TestRunRequest["model"]): string {
+ const selected = bundledModelSource(model);
+ return [
+ "import { mobile } from '@e2e-dev/mobile';",
+ ...(selected?.imports ?? []),
+ "",
+ "export default {",
+ ...(selected ? [" agents: { default: {", ` model: ${selected.field},`, " system: 'You are a thorough QA agent. Verify every outcome.',", " } },"] : []),
+ ` targets: [{ name: ${quoted(target.platform)}, engine: mobile({ platform: ${quoted(target.platform)} }), app: { bundleId: ${quoted(target.bundleId)} } }],`,
+ " workers: 1,",
+ "};",
+ "",
+ ].join("\n");
+}
+
+export function requiresModel(source: string): boolean { return /\bagent\s*\.\s*(act|assert|waitFor|extract)\s*\(/.test(source); }
+
+/** Runs from an isolated workspace; only the saved test source crosses out of the user's project. */
+async function runBundledTest(request: TestRunRequest, deps: TestRunDeps): Promise {
+ if (!request.runtime || !request.bundledTarget) throw new ExpectedOperationError("invalid_input", "Choose the mirrored app before running in bundled mode.");
+ const source = request.untilSource ?? await readFile(join(request.projectPath, request.relativePath), "utf8");
+ if (requiresModel(source) && !request.model)
+ throw new ExpectedOperationError("invalid_input", "This test contains agent steps. Choose a provider and model in Testing, then run it again.");
+ const requiredKey = request.model?.provider === "vercel" ? "AI_GATEWAY_API_KEY" : request.model?.provider === "openrouter" ? "OPENROUTER_API_KEY" : undefined;
+ if (requiredKey && !process.env[requiredKey]) throw new ExpectedOperationError("invalid_input", `${requiredKey} is not set. Add it to Mobile Dev's environment, then run again.`);
+ await deps.release?.();
+ const workspace = await mkdtemp(join(tmpdir(), "mobile-dev-e2e-run-"));
+ const runPath = request.untilSource === undefined ? request.relativePath : untilTestPath(request.relativePath);
+ const config = join(workspace, "e2e.config.mts");
+ const progressConfig = join(workspace, PROGRESS_CONFIG);
+ try {
+ await mkdir(dirname(join(workspace, runPath)), { recursive: true, mode: 0o700 });
+ await writeFile(join(workspace, runPath), source, { mode: 0o600 });
+ await writeFile(config, bundledConfigSource(request.bundledTarget, request.model), { mode: 0o600 });
+ if (deps.onProgress) await writeFile(progressConfig, progressConfigSource(config), { mode: 0o600 });
+ await symlink(join(request.runtime.root, "node_modules"), join(workspace, "node_modules"), "dir");
+ return await spawnRun({
+ command: process.execPath,
+ commandArgs: [join(request.runtime.root, "node_modules/e2e/dist/cli/bin.js")],
+ cwd: workspace, runPath, configName: deps.onProgress ? PROGRESS_CONFIG : "e2e.config.mts",
+ target: request.bundledTarget.platform, timeoutMs: request.timeoutMs, spawner: deps.spawner ?? spawn,
+ onProgress: deps.onProgress,
+ });
+ } finally {
+ await rm(workspace, { recursive: true, force: true });
+ }
+}
+
+async function spawnRun(input: { command: string; commandArgs?: string[]; cwd: string; runPath: string; configName?: string; target?: string; timeoutMs?: number; spawner: Spawner; onProgress?: (progress: TestRunProgress) => void }): Promise {
+ const child = input.spawner(input.command, [
+ ...(input.commandArgs ?? []), "run", input.runPath, "--reporter", "json",
+ ...(input.target ? ["--target", input.target] : []), ...(input.configName ? ["--config", input.configName] : []),
+ ], { cwd: input.cwd, stdio: ["ignore", "pipe", "pipe"], env: runnerEnv() });
+ let stdout = "", stderr = "", pending = "";
+ child.stdout?.setEncoding("utf8"); child.stderr?.setEncoding("utf8");
+ child.stdout?.on("data", chunk => { stdout += chunk; });
+ child.stderr?.on("data", chunk => {
+ stderr += chunk;
+ if (!input.onProgress) return;
+ pending += chunk;
+ const lines = pending.split("\n"); pending = lines.pop() ?? "";
+ for (const line of lines) { const progress = parseProgressLine(line); if (progress) input.onProgress(progress); }
+ });
+ const timeoutMs = input.timeoutMs ?? 10 * 60_000;
+ const exitCode = await new Promise((resolve, reject) => {
+ const timer = setTimeout(() => { child.kill("SIGTERM"); reject(new ExpectedOperationError("resource_limit", `The test run did not finish within ${Math.round(timeoutMs / 1000)}s.`)); }, timeoutMs);
+ timer.unref?.(); child.on("error", error => { clearTimeout(timer); reject(error); }); child.on("close", code => { clearTimeout(timer); resolve(code ?? 1); });
+ });
+ const report = parseReport(stdout);
+ const steps = report ? reportSteps(report, input.runPath) : [];
+ const durationMs = report ? reportDuration(report) : undefined;
+ return { status: reportStatus(report, exitCode), exitCode, steps, ...(durationMs === undefined ? {} : { durationMs }), ...(steps.length === 0 ? { output: tail(`${stdout}\n${stderr}`) } : {}) };
+}
+
async function runOnce(request: TestRunRequest, deps: TestRunDeps): Promise {
const spawner = deps.spawner ?? spawn;
// Before the binary is even resolved: a project with no runner installed must not cost the user
diff --git a/packages/core/src/testing-setup.ts b/packages/core/src/testing-setup.ts
new file mode 100644
index 00000000..c03bf528
--- /dev/null
+++ b/packages/core/src/testing-setup.ts
@@ -0,0 +1,304 @@
+import { spawn } from "node:child_process";
+import { createHash, randomUUID } from "node:crypto";
+import { existsSync } from "node:fs";
+import { lstat, mkdir, readFile, readdir, rename, symlink, unlink, writeFile } from "node:fs/promises";
+import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
+import { pathToFileURL } from "node:url";
+import { ExpectedOperationError } from "@mobile-dev/shared/error-reporting.ts";
+import { bundledE2eRoot } from "./e2e-runtime.ts";
+import { TESTING_DIRECTORY } from "./testing-projects.ts";
+import type { BundledModelProvider } from "./testing-run.ts";
+
+export type SetupProvider = BundledModelProvider | "none";
+export type SetupTarget = { name: string; platform: "ios" | "android"; bundleId: string };
+export type SetupOptions = {
+ targets: SetupTarget[];
+ provider: SetupProvider;
+ model?: string;
+ endpoint?: string;
+ installDependencies: boolean;
+ installSkill: boolean;
+ registerMcp: boolean;
+};
+
+export const SETUP_PROVIDERS: readonly { id: SetupProvider; label: string; subscription?: "openai" | "github-copilot" | "opencode-console" | "spacexai"; defaultModel?: string }[] = [
+ { id: "none", label: "None (deterministic tests)" },
+ { id: "vercel", label: "Vercel AI Gateway", defaultModel: "openai/gpt-6-luna-fast" },
+ { id: "openrouter", label: "OpenRouter", defaultModel: "openai/gpt-6-luna-fast" },
+ { id: "openai-compatible", label: "OpenAI-compatible endpoint", defaultModel: "gpt-6-luna" },
+ { id: "chatgpt", label: "ChatGPT Plus/Pro", subscription: "openai", defaultModel: "gpt-6-luna" },
+ { id: "copilot", label: "GitHub Copilot", subscription: "github-copilot", defaultModel: "claude-sonnet-5" },
+ { id: "opencode-console", label: "OpenCode Console", subscription: "opencode-console", defaultModel: "deepseek-v4.1-flash" },
+ { id: "grok", label: "SuperGrok", subscription: "spacexai", defaultModel: "grok-4" },
+] as const;
+
+type PlannedWrite = { path: string; relativePath: string; content: string; existing: boolean; kind: "file" | "skill" };
+export type SetupPlanAction = { action: "create" | "update" | "skip"; path: string; detail: string };
+export type SetupPlan = {
+ id: string;
+ projectPath: string;
+ options: SetupOptions;
+ packageManager: "npm" | "pnpm" | "yarn" | "bun";
+ installCommand: string;
+ actions: SetupPlanAction[];
+ createdAt: string;
+};
+type InternalPlan = SetupPlan & { writes: PlannedWrite[]; observed: Record; skillLink?: { path: string; target: string } };
+
+export type TestingModelPreference = { provider: BundledModelProvider; model: string; endpoint?: string };
+const PREFERENCE_FILE = join(TESTING_DIRECTORY, "model-preference.json");
+
+function hash(value: string | Buffer): string { return createHash("sha256").update(value).digest("hex"); }
+async function fileHash(path: string): Promise {
+ const info = await lstat(path).catch(() => undefined);
+ if (!info) return "missing";
+ if (!info.isFile()) return `blocked:${info.isSymbolicLink() ? "symlink" : "other"}`;
+ return hash(await readFile(path));
+}
+function cleanText(value: string | undefined): string | undefined { const next = value?.trim(); return next ? next : undefined; }
+function provider(id: SetupProvider) { return SETUP_PROVIDERS.find(entry => entry.id === id); }
+
+export async function readTestingModelPreference(): Promise {
+ try {
+ const parsed = JSON.parse(await readFile(PREFERENCE_FILE, "utf8")) as Partial;
+ const providerId = parsed.provider as string | undefined;
+ if (!provider(providerId as SetupProvider) || providerId === "none" || !cleanText(parsed.model)) return;
+ return { provider: providerId as BundledModelProvider, model: parsed.model!.trim(), ...(cleanText(parsed.endpoint) ? { endpoint: parsed.endpoint!.trim() } : {}) };
+ } catch { return; }
+}
+
+export async function saveTestingModelPreference(preference?: TestingModelPreference): Promise {
+ await mkdir(TESTING_DIRECTORY, { recursive: true, mode: 0o700 });
+ if (!preference) { await unlink(PREFERENCE_FILE).catch(() => undefined); return; }
+ if (!provider(preference.provider) || !cleanText(preference.model)) throw new ExpectedOperationError("invalid_input", "Choose a supported provider and model.");
+ const temporary = `${PREFERENCE_FILE}.${randomUUID()}.tmp`;
+ try {
+ await writeFile(temporary, JSON.stringify({ provider: preference.provider, model: preference.model.trim(), ...(cleanText(preference.endpoint) ? { endpoint: preference.endpoint!.trim() } : {}) }, null, 2) + "\n", { mode: 0o600 });
+ await rename(temporary, PREFERENCE_FILE);
+ } finally { await unlink(temporary).catch(() => undefined); }
+}
+
+function modelSource(options: SetupOptions): { imports: string[]; field?: string; dependencies: Record } {
+ const id = JSON.stringify(cleanText(options.model) ?? provider(options.provider)?.defaultModel ?? "");
+ switch (options.provider) {
+ case "none": return { imports: [], dependencies: {} };
+ case "vercel": return { imports: ["import { gateway } from 'ai';"], field: `gateway(${id})`, dependencies: {} };
+ case "openrouter": return { imports: ["import { openrouter } from '@openrouter/ai-sdk-provider';"], field: `openrouter(${id})`, dependencies: { "@openrouter/ai-sdk-provider": "^3.0.0" } };
+ case "openai-compatible": return { imports: ["import { createOpenAICompatible } from '@ai-sdk/openai-compatible';"], field: `createOpenAICompatible({ name: 'openai-compatible', baseURL: ${JSON.stringify(cleanText(options.endpoint) ?? "http://127.0.0.1:11434/v1")}, apiKey: process.env.LLM_API_KEY }).chatModel(${id})`, dependencies: { "@ai-sdk/openai-compatible": "^3.0.0" } };
+ case "chatgpt": return { imports: ["import { chatgpt } from 'e2e/oauth/chatgpt';"], field: `chatgpt(${id})`, dependencies: { "@ai-sdk/openai": "^4.0.0" } };
+ case "copilot": return { imports: ["import { copilot } from 'e2e/oauth/copilot';"], field: `copilot(${id})`, dependencies: { "@ai-sdk/openai-compatible": "^3.0.0", "@ai-sdk/openai": "^4.0.0" } };
+ case "opencode-console": return { imports: ["import { opencodeConsole } from 'e2e/oauth/opencode-console';"], field: `opencodeConsole(${id})`, dependencies: { "@ai-sdk/openai-compatible": "^3.0.0", "@ai-sdk/openai": "^4.0.0", "@ai-sdk/anthropic": "^4.0.0", "@ai-sdk/google": "^4.0.0" } };
+ case "grok": return { imports: ["import { grok } from 'e2e/oauth/grok';"], field: `grok(${id})`, dependencies: { "@ai-sdk/xai": "^5.0.0" } };
+ }
+}
+
+export function setupConfigSource(options: SetupOptions): string {
+ const model = modelSource(options);
+ const targets = options.targets.map(target => ` { name: ${JSON.stringify(target.name)}, engine: mobile({ platform: ${JSON.stringify(target.platform)} }), app: { bundleId: ${JSON.stringify(target.bundleId)} } },`).join("\n");
+ return [
+ "import type { E2EConfig } from 'e2e';",
+ "import { mobile } from '@e2e-dev/mobile';",
+ ...model.imports,
+ "", "export default {",
+ ...(model.field ? [" agents: { default: {", ` model: ${model.field},`, " system: 'You are a thorough QA agent. Verify every outcome.',", " } },"] : []),
+ " targets: [", targets, " ],", " workers: 1,", "} satisfies E2EConfig;", "",
+ ].join("\n");
+}
+
+const EXAMPLE = `import { test } from 'e2e';\n\ntest('the app opens', async ({ app }) => {\n await app.open();\n});\n`;
+const IGNORE = ["node_modules/", ".e2e/artifacts/", ".e2e/cache/", ".e2e/sessions/", ".e2e/report.json", ".e2e/ai-trace.json", ".e2e/junit.xml", ".e2e/summary.md", ".e2e/failures/", ".e2e/logs/", ".e2e/videos/"];
+
+function packageManager(root: string, manifest: Record): SetupPlan["packageManager"] {
+ const declared = typeof manifest.packageManager === "string" ? manifest.packageManager.split("@")[0] : "";
+ if (declared === "pnpm" || declared === "yarn" || declared === "bun" || declared === "npm") return declared;
+ if (existsSync(join(root, "pnpm-lock.yaml"))) return "pnpm";
+ if (existsSync(join(root, "yarn.lock"))) return "yarn";
+ if (existsSync(join(root, "bun.lock")) || existsSync(join(root, "bun.lockb"))) return "bun";
+ return "npm";
+}
+
+async function skillFiles(): Promise<{ relative: string; content: string }[]> {
+ const root = join(bundledE2eRoot(), "node_modules/e2e/skills/e2e");
+ const files: { relative: string; content: string }[] = [];
+ const walk = async (directory: string) => {
+ for (const entry of await readdir(directory, { withFileTypes: true })) {
+ const child = join(directory, entry.name);
+ if (entry.isDirectory()) await walk(child);
+ else if (entry.isFile()) files.push({ relative: relative(root, child), content: await readFile(child, "utf8") });
+ }
+ };
+ await walk(root);
+ return files;
+}
+
+const plans = new Map();
+
+function keepMapBounded(map: Map, maximum = 32): void {
+ while (map.size >= maximum) {
+ const oldest = map.keys().next().value as string | undefined;
+ if (!oldest) break;
+ map.delete(oldest);
+ }
+}
+
+export async function planTestingSetup(projectPath: string, input: SetupOptions): Promise {
+ const root = resolve(projectPath.trim());
+ if (!isAbsolute(projectPath.trim()) || !(await lstat(root).then(value => value.isDirectory(), () => false))) throw new ExpectedOperationError("invalid_input", "Choose an existing project folder.");
+ if (!provider(input.provider)) throw new ExpectedOperationError("invalid_input", "Choose a provider supported by the bundled e2e runtime.");
+ const targets = input.targets.map(target => ({ ...target, name: target.name.trim(), bundleId: target.bundleId.trim() }))
+ .filter(target => target.name && target.bundleId);
+ if (targets.length === 0) throw new ExpectedOperationError("invalid_input", "Add at least one iOS or Android target.");
+ if (input.provider === "openai-compatible") {
+ const endpoint = new URL(cleanText(input.endpoint) ?? "http://127.0.0.1:11434/v1");
+ if (endpoint.protocol !== "https:" && !(endpoint.protocol === "http:" && ["127.0.0.1", "localhost", "::1"].includes(endpoint.hostname))) throw new ExpectedOperationError("invalid_input", "Use HTTPS unless the model endpoint is loopback.");
+ }
+ const options: SetupOptions = { ...input, targets, ...(cleanText(input.model) ? { model: input.model!.trim() } : {}), ...(cleanText(input.endpoint) ? { endpoint: input.endpoint!.trim() } : {}) };
+ const packagePath = join(root, "package.json");
+ const originalPackage = await readFile(packagePath, "utf8").catch(() => "{}\n");
+ let manifest: Record;
+ try { manifest = JSON.parse(originalPackage); } catch { throw new ExpectedOperationError("invalid_input", "Fix package.json before applying e2e setup."); }
+ const model = modelSource(options);
+ const devDependencies = { ...((manifest.devDependencies && typeof manifest.devDependencies === "object") ? manifest.devDependencies as Record : {}), e2e: "^0.17.0", "@e2e-dev/mobile": "^0.9.2", ...(options.provider === "none" ? {} : { ai: "^7.0.0", zod: "^4.1.8", ...model.dependencies }) };
+ const scripts = { ...((manifest.scripts && typeof manifest.scripts === "object") ? manifest.scripts as Record : {}) };
+ if (scripts["test:e2e"] === undefined) scripts["test:e2e"] = "e2e run";
+ const nextPackage = JSON.stringify({ ...manifest, scripts, devDependencies: Object.fromEntries(Object.entries(devDependencies).sort(([a], [b]) => a.localeCompare(b))) }, null, 2) + "\n";
+ const writes: PlannedWrite[] = [];
+ const actions: SetupPlanAction[] = [];
+ const add = async (relativePath: string, content: string, kind: PlannedWrite["kind"] = "file", preserve = false) => {
+ const path = join(root, relativePath);
+ const existing = await fileHash(path);
+ if (existing.startsWith("blocked:")) throw new ExpectedOperationError("invalid_input", `${relativePath} is not a regular file; setup will not replace it.`);
+ if (preserve && existing !== "missing") { actions.push({ action: "skip", path: relativePath, detail: "Existing file is preserved." }); return; }
+ if (existing === hash(content)) { actions.push({ action: "skip", path: relativePath, detail: "Already up to date." }); return; }
+ writes.push({ path, relativePath, content, existing: existing !== "missing", kind });
+ actions.push({ action: existing === "missing" ? "create" : "update", path: relativePath, detail: kind === "skill" ? "Install the e2e agent skill." : "Apply e2e setup." });
+ };
+ await add("package.json", nextPackage);
+ await add("e2e.config.ts", setupConfigSource(options), "file", true);
+ await add("tests/example.e2e.ts", EXAMPLE, "file", true);
+ const ignorePath = join(root, ".gitignore");
+ const ignore = await readFile(ignorePath, "utf8").catch(() => "");
+ const missing = IGNORE.filter(entry => !ignore.split(/\r?\n/).includes(entry));
+ if (missing.length) await add(".gitignore", `${ignore}${ignore && !ignore.endsWith("\n") ? "\n" : ""}${missing.join("\n")}\n`);
+ else actions.push({ action: "skip", path: ".gitignore", detail: "E2E outputs are already ignored." });
+ if (options.installSkill) {
+ const skillRoot = join(root, ".agents/skills/e2e");
+ const existing = await lstat(skillRoot).catch(() => undefined);
+ if (existing) actions.push({ action: "skip", path: ".agents/skills/e2e", detail: "Existing skill is preserved." });
+ else for (const file of await skillFiles()) await add(join(".agents/skills/e2e", file.relative), file.content, "skill");
+ }
+ if (options.registerMcp) {
+ const mcpPath = join(root, ".mcp.json");
+ const source = await readFile(mcpPath, "utf8").catch(() => "{}");
+ let mcp: Record;
+ try { mcp = JSON.parse(source); } catch { throw new ExpectedOperationError("invalid_input", "Fix .mcp.json before registering the e2e server."); }
+ const servers = mcp.mcpServers && typeof mcp.mcpServers === "object" ? mcp.mcpServers as Record : {};
+ if (servers.e2e) actions.push({ action: "skip", path: ".mcp.json", detail: "Existing e2e MCP registration is preserved." });
+ else await add(".mcp.json", JSON.stringify({ ...mcp, mcpServers: { ...servers, e2e: { command: "npx", args: ["e2e", "mcp"] } } }, null, 2) + "\n");
+ }
+ const manager = packageManager(root, manifest);
+ const installCommand = manager === "npm" ? "npm install" : `${manager} install`;
+ if (options.installDependencies) actions.push({ action: "update", path: manager === "npm" ? "package-lock.json" : manager === "pnpm" ? "pnpm-lock.yaml" : manager === "yarn" ? "yarn.lock" : "bun.lock", detail: `Run ${installCommand}.` });
+ const observed: Record = {};
+ for (const write of writes) observed[write.relativePath] = await fileHash(write.path);
+ const id = hash(JSON.stringify({ root, options, observed, actions, manager, nonce: randomUUID() }));
+ const plan: InternalPlan = { id, projectPath: root, options, packageManager: manager, installCommand, actions, createdAt: new Date().toISOString(), writes, observed };
+ keepMapBounded(plans);
+ plans.set(id, plan);
+ return { id, projectPath: root, options, packageManager: manager, installCommand, actions, createdAt: plan.createdAt };
+}
+
+export type SetupOperation = {
+ id: string;
+ kind: "apply" | "login";
+ status: "running" | "waiting" | "succeeded" | "failed" | "cancelled";
+ message: string;
+ completed: number;
+ total: number;
+ applied: string[];
+ auth?: { url: string; instructions: string; userCode?: string };
+ prompt?: { message: string; placeholder?: string };
+};
+type InternalOperation = SetupOperation & { abort: AbortController; answer?: (value: string) => void };
+const operations = new Map();
+
+function publicOperation(operation: InternalOperation): SetupOperation {
+ const { abort: _abort, answer: _answer, ...result } = operation;
+ return result;
+}
+export function testingSetupProgress(id: string): SetupOperation | undefined { const operation = operations.get(id); return operation ? publicOperation(operation) : undefined; }
+export function cancelTestingSetup(id: string): boolean { const operation = operations.get(id); if (!operation || !["running", "waiting"].includes(operation.status)) return false; operation.abort.abort(); operation.status = "cancelled"; operation.message = "Cancelled."; operation.answer?.(""); return true; }
+export function answerTestingSetup(id: string, value: string): boolean { const operation = operations.get(id); if (!operation?.answer) return false; const answer = operation.answer; operation.answer = undefined; operation.prompt = undefined; operation.status = "running"; answer(value); return true; }
+
+async function atomicWrite(write: PlannedWrite): Promise {
+ await mkdir(dirname(write.path), { recursive: true, mode: write.kind === "skill" ? 0o755 : undefined });
+ const temporary = `${write.path}.${randomUUID()}.tmp`;
+ try { await writeFile(temporary, write.content, "utf8"); await rename(temporary, write.path); }
+ finally { await unlink(temporary).catch(() => undefined); }
+}
+
+export function applyTestingSetup(planId: string): SetupOperation {
+ const plan = plans.get(planId);
+ if (!plan) throw new ExpectedOperationError("invalid_input", "Preview setup again; that plan is no longer available.");
+ const operation: InternalOperation = { id: randomUUID(), kind: "apply", status: "running", message: "Validating setup plan…", completed: 0, total: plan.writes.length + (plan.options.installDependencies ? 1 : 0), applied: [], abort: new AbortController() };
+ keepMapBounded(operations);
+ operations.set(operation.id, operation);
+ void (async () => {
+ try {
+ for (const write of plan.writes) {
+ if (operation.abort.signal.aborted) throw operation.abort.signal.reason ?? new Error("Cancelled");
+ if (await fileHash(write.path) !== plan.observed[write.relativePath]) throw new ExpectedOperationError("invalid_input", `${write.relativePath} changed after the preview. Preview setup again.`);
+ }
+ for (const write of plan.writes) {
+ operation.message = `${write.existing ? "Updating" : "Creating"} ${write.relativePath}…`;
+ await atomicWrite(write);
+ operation.applied.push(write.relativePath); operation.completed += 1;
+ }
+ if (plan.options.installDependencies) {
+ operation.message = `Running ${plan.installCommand}…`;
+ await new Promise((resolvePromise, rejectPromise) => {
+ const child = spawn(plan.packageManager, ["install"], { cwd: plan.projectPath, stdio: ["ignore", "ignore", "pipe"], shell: process.platform === "win32" });
+ let error = "";
+ child.stderr?.setEncoding("utf8"); child.stderr?.on("data", chunk => { error = `${error}${chunk}`.slice(-4000); });
+ const abort = () => child.kill("SIGTERM"); operation.abort.signal.addEventListener("abort", abort, { once: true });
+ child.on("error", rejectPromise); child.on("close", code => { operation.abort.signal.removeEventListener("abort", abort); code === 0 ? resolvePromise() : rejectPromise(new Error(error.trim() || `${plan.installCommand} exited ${code ?? 1}`)); });
+ });
+ operation.completed += 1;
+ }
+ operation.status = "succeeded"; operation.message = "E2E setup is ready.";
+ if (plan.options.provider !== "none") await saveTestingModelPreference({ provider: plan.options.provider, model: cleanText(plan.options.model) ?? provider(plan.options.provider)!.defaultModel!, ...(cleanText(plan.options.endpoint) ? { endpoint: plan.options.endpoint!.trim() } : {}) });
+ } catch (error) {
+ if (operation.abort.signal.aborted) { operation.status = "cancelled"; operation.message = `Cancelled after ${operation.applied.length} change${operation.applied.length === 1 ? "" : "s"}.`; }
+ else { operation.status = "failed"; operation.message = `${error instanceof Error ? error.message : String(error)}${operation.applied.length ? ` ${operation.applied.length} change${operation.applied.length === 1 ? " was" : "s were"} already applied; they were not rolled back.` : ""}`; }
+ }
+ })();
+ return publicOperation(operation);
+}
+
+type OAuthProvider = "openai" | "github-copilot" | "opencode-console" | "spacexai";
+type LoginCallbacks = { signal: AbortSignal; onAuth(auth: { url: string; instructions: string; userCode?: string }): void; onProgress(message: string): void; onPrompt(prompt: { message: string; placeholder?: string }): Promise };
+type LoginRunner = (provider: OAuthProvider, callbacks: LoginCallbacks) => Promise;
+async function e2eLogin(providerId: OAuthProvider, callbacks: LoginCallbacks) {
+ const module = await import(pathToFileURL(join(bundledE2eRoot(), "node_modules/e2e/dist/oauth/login.js")).href) as { login(provider: string, input: Record): Promise };
+ return module.login(providerId, { callbacks });
+}
+export function startTestingLogin(id: OAuthProvider, runLogin: LoginRunner = e2eLogin): SetupOperation {
+ const operation: InternalOperation = { id: randomUUID(), kind: "login", status: "running", message: "Starting sign-in…", completed: 0, total: 1, applied: [], abort: new AbortController() };
+ keepMapBounded(operations);
+ operations.set(operation.id, operation);
+ void (async () => {
+ try {
+ await runLogin(id, {
+ signal: operation.abort.signal,
+ onAuth: (auth: { url: string; instructions: string; userCode?: string }) => { operation.auth = auth; operation.status = "waiting"; operation.message = auth.instructions; },
+ onProgress: (message: string) => { operation.message = message; },
+ onPrompt: (prompt: { message: string; placeholder?: string }) => new Promise(resolvePrompt => { operation.prompt = prompt; operation.answer = resolvePrompt; operation.status = "waiting"; operation.message = prompt.message; }),
+ });
+ operation.status = "succeeded"; operation.completed = 1; operation.prompt = undefined; operation.message = "Signed in.";
+ } catch (error) {
+ operation.status = operation.abort.signal.aborted ? "cancelled" : "failed";
+ operation.message = operation.abort.signal.aborted ? "Sign-in cancelled." : error instanceof Error ? error.message : String(error);
+ }
+ })();
+ return publicOperation(operation);
+}
diff --git a/packages/core/src/testing-target-discovery.ts b/packages/core/src/testing-target-discovery.ts
new file mode 100644
index 00000000..cd39fc72
--- /dev/null
+++ b/packages/core/src/testing-target-discovery.ts
@@ -0,0 +1,75 @@
+import { execFile } from "node:child_process";
+import { existsSync } from "node:fs";
+import { readFile } from "node:fs/promises";
+import { join } from "node:path";
+import { promisify } from "node:util";
+import type { TestingTarget } from "./testing-projects.ts";
+
+const execute = promisify(execFile);
+
+export interface ForegroundTestingTarget { platform: "ios" | "android"; bundleId: string }
+export interface DiscoveredTestingTargets { targets: TestingTarget[]; source: "expo-cli" | "static-expo" | "foreground" | "none"; warning?: string }
+
+function expoObject(value: unknown): Record | undefined {
+ if (!value || typeof value !== "object" || Array.isArray(value)) return;
+ const root = value as Record;
+ const candidate = root.expo && typeof root.expo === "object" && !Array.isArray(root.expo) ? root.expo : root;
+ return candidate as Record;
+}
+
+function text(value: unknown): string | undefined { return typeof value === "string" && value.trim() ? value.trim() : undefined; }
+
+export function expoTargets(config: unknown): TestingTarget[] {
+ const root = expoObject(config);
+ if (!root) return [];
+ const ios = root.ios && typeof root.ios === "object" ? text((root.ios as Record).bundleIdentifier) : undefined;
+ const android = root.android && typeof root.android === "object" ? text((root.android as Record).package) : undefined;
+ return [
+ ...(ios ? [{ name: "ios", platform: "ios", bundleId: ios }] : []),
+ ...(android ? [{ name: "android", platform: "android", bundleId: android }] : []),
+ ];
+}
+
+async function localExpoConfig(projectPath: string): Promise {
+ const bin = join(projectPath, "node_modules/.bin/expo");
+ if (!existsSync(bin)) return;
+ const { stdout } = await execute(bin, ["config", "--json", "--type", "public"], {
+ cwd: projectPath, timeout: 20_000, maxBuffer: 2 * 1024 * 1024,
+ env: { ...process.env, FORCE_COLOR: "0", NO_COLOR: "1" },
+ });
+ return JSON.parse(stdout);
+}
+
+async function staticExpoConfig(projectPath: string): Promise {
+ for (const name of ["app.json", "app.config.json"]) {
+ const source = await readFile(join(projectPath, name), "utf8").catch(() => undefined);
+ if (!source) continue;
+ try { return JSON.parse(source); } catch { continue; }
+ }
+ // Dynamic configs must never be executed as a fallback. Expo's common object-literal form can
+ // still be read safely: only the two quoted identifier properties are projected, everything
+ // else (functions, environment reads and plugins included) is ignored.
+ for (const name of ["app.config.ts", "app.config.js", "app.config.mjs", "app.config.cjs"]) {
+ const source = await readFile(join(projectPath, name), "utf8").catch(() => undefined);
+ if (!source) continue;
+ const bundleIdentifier = source.match(/\bbundleIdentifier\s*:\s*["'`]([^"'`]+)["'`]/)?.[1];
+ const packageName = source.match(/\bpackage\s*:\s*["'`]([^"'`]+)["'`]/)?.[1];
+ if (bundleIdentifier || packageName) return { ios: { bundleIdentifier }, android: { package: packageName } };
+ }
+}
+
+/** Expo 57 target discovery: local CLI, then non-executing JSON, then the mirrored foreground app. */
+export async function discoverTestingTargets(projectPath: string, foreground?: ForegroundTestingTarget): Promise {
+ try {
+ const targets = expoTargets(await localExpoConfig(projectPath));
+ if (targets.length) return { targets, source: "expo-cli" };
+ } catch (error) {
+ const fallback = expoTargets(await staticExpoConfig(projectPath));
+ if (fallback.length) return { targets: fallback, source: "static-expo", warning: `Expo CLI config failed; using static JSON (${error instanceof Error ? error.message : String(error)}).` };
+ }
+ const targets = expoTargets(await staticExpoConfig(projectPath));
+ if (targets.length) return { targets, source: "static-expo" };
+ if (foreground?.bundleId) return { targets: [{ name: foreground.platform, platform: foreground.platform, bundleId: foreground.bundleId }], source: "foreground",
+ warning: "No static Expo app identifier was found; using the foreground app. You can edit it before setup." };
+ return { targets: [], source: "none", warning: "No mobile app identifier was found. Open the app in the mirror or enter one in setup." };
+}
diff --git a/packages/core/src/testing-tools.ts b/packages/core/src/testing-tools.ts
index eeca1299..96f58006 100644
--- a/packages/core/src/testing-tools.ts
+++ b/packages/core/src/testing-tools.ts
@@ -3,9 +3,10 @@ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
import { registerAppTool } from "@modelcontextprotocol/ext-apps/server";
import { z } from "zod";
import { errorMessage } from "@mobile-dev/shared/protocol.ts";
-import { captureServerError } from "./telemetry.ts";
+import { ExpectedOperationError } from "@mobile-dev/shared/error-reporting.ts";
+import { captureServerError, recordTestingSetupOperation } from "./telemetry.ts";
import type { TestingProjectChoices } from "./testing-projects.ts";
-import { deleteTestFile, discardStagedTestFile, inspectProject, listTestFiles, previewTestFile, resolveTestRunPaths, saveStagedTestFile, stageTestFile, writeTestFile } from "./testing-projects.ts";
+import { deleteTestFile, discardStagedTestFile, inspectProject, listTestFiles, previewTestFile, readTestFile, resolveTestRunPaths, saveStagedTestFile, stageTestFile, writeTestFile } from "./testing-projects.ts";
import { TestDraftStore } from "./testing-drafts.ts";
import { MAX_DRAFT_STEPS, recordedStepSchema, testDraftIdSchema } from "@mobile-dev/shared/test-drafts.ts";
import type { TestDraft } from "@mobile-dev/shared/test-drafts.ts";
@@ -13,6 +14,9 @@ import { TestingDevices } from "./testing-device.ts";
import { runRecordedTest } from "./testing-run.ts";
import type { TestRunProgress } from "./testing-run.ts";
import { deviceIdSchema } from "@mobile-dev/shared/panel-target.ts";
+import type { BundledModelProvider } from "./testing-run.ts";
+import { answerTestingSetup, applyTestingSetup, cancelTestingSetup, planTestingSetup, readTestingModelPreference, saveTestingModelPreference, SETUP_PROVIDERS, startTestingLogin, testingSetupProgress } from "./testing-setup.ts";
+import type { SetupOptions } from "./testing-setup.ts";
const read = { readOnlyHint: true, destructiveHint: false, openWorldHint: false };
const write = { readOnlyHint: false, destructiveHint: false, openWorldHint: false };
@@ -84,8 +88,10 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
annotations: destructive,
_meta: appVisibility,
}, safe(async ({ projectPath: selected, relativePath, contents, overwrite }: { projectPath: string; relativePath: string; contents: string; overwrite?: boolean }) => {
+ const project = await inspectProject(selected);
const result = await writeTestFile(selected, relativePath, contents, overwrite ?? false);
- return dataResult({ ...result }, result.written ? `Saved ${result.path}` : `${result.path} already exists.`);
+ const shownPath = project.runtimeMode === "bundled" ? `Studio/${relativePath}` : result.path;
+ return dataResult({ ...result, path: shownPath, storageMode: project.runtimeMode }, result.written ? `Saved ${shownPath}` : `${shownPath} already exists.`);
}));
/**
@@ -223,11 +229,51 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
registerAppTool(server, "mobile_testing_project_config", {
title: "Read a testing project's config",
description: "Read the targets of a project's e2e config: the target names, their platforms, and the bundle ids to launch.",
- inputSchema: { projectPath },
+ inputSchema: { projectPath, foregroundPlatform: z.enum(["ios", "android"]).optional(), foregroundBundleId: z.string().min(1).max(512).optional() },
annotations: read,
_meta: appVisibility,
- }, safe(async ({ projectPath: selected }: { projectPath: string }) =>
- dataResult({ ...await inspectProject(selected) })));
+ }, safe(async ({ projectPath: selected, foregroundPlatform, foregroundBundleId }: { projectPath: string; foregroundPlatform?: "ios" | "android"; foregroundBundleId?: string }) =>
+ dataResult({ ...await inspectProject(selected, foregroundPlatform && foregroundBundleId ? { platform: foregroundPlatform, bundleId: foregroundBundleId } : undefined), modelPreference: await readTestingModelPreference(), providers: SETUP_PROVIDERS })));
+
+ const setupTarget = z.object({ name: z.string().min(1).max(128), platform: z.enum(["ios", "android"]), bundleId: z.string().min(1).max(512) });
+ const setupOptions = z.object({
+ targets: z.array(setupTarget).min(1).max(8),
+ provider: z.enum(["none", "vercel", "openrouter", "openai-compatible", "chatgpt", "copilot", "opencode-console", "grok"]),
+ model: z.string().max(256).optional(), endpoint: z.string().max(2048).optional(),
+ installDependencies: z.boolean(), installSkill: z.boolean(), registerMcp: z.boolean(),
+ });
+ registerAppTool(server, "mobile_testing_setup_plan", {
+ title: "Preview e2e setup",
+ description: "Build an immutable, non-writing e2e init plan for the selected project. The plan must be confirmed and remains valid only while every affected file is unchanged.",
+ inputSchema: { projectPath, options: setupOptions }, annotations: read, _meta: appVisibility,
+ }, safe(async ({ projectPath: selected, options }: { projectPath: string; options: SetupOptions }) => {
+ try { const plan = await planTestingSetup(selected, options); recordTestingSetupOperation("plan", "succeeded", options.provider); return dataResult({ plan }); }
+ catch (error) { recordTestingSetupOperation("plan", "failed", options.provider); throw error; }
+ }));
+ registerAppTool(server, "mobile_testing_setup_apply", {
+ title: "Apply confirmed e2e setup", description: "Apply an unchanged preview plan and optionally install dependencies. Existing configs and example tests are preserved; progress is read separately.",
+ inputSchema: { planId: z.string().length(64) }, annotations: destructive, _meta: appVisibility,
+ }, safe(async ({ planId }: { planId: string }) => { const operation = applyTestingSetup(planId); recordTestingSetupOperation("apply", "started"); return dataResult({ operation }); }));
+ registerAppTool(server, "mobile_testing_setup_progress", {
+ title: "Read e2e setup progress", description: "Read setup or subscription-login progress without exposing credentials.",
+ inputSchema: { operationId: z.string().uuid() }, annotations: read, _meta: appVisibility,
+ }, safe(async ({ operationId }: { operationId: string }) => { const operation = testingSetupProgress(operationId); if (!operation) throw new ExpectedOperationError("invalid_input", "That setup operation is no longer available."); return dataResult({ operation }); }));
+ registerAppTool(server, "mobile_testing_setup_cancel", {
+ title: "Cancel e2e setup", description: "Cancel dependency installation or an in-progress E2E login. Files already applied are left in place and reported by progress.",
+ inputSchema: { operationId: z.string().uuid() }, annotations: write, _meta: appVisibility,
+ }, safe(async ({ operationId }: { operationId: string }) => dataResult({ cancelled: cancelTestingSetup(operationId) })));
+ registerAppTool(server, "mobile_testing_setup_login", {
+ title: "Sign in to an E2E subscription", description: "Start an OAuth login using the bundled E2E runtime's provider callbacks. The panel shows its URL, device code and prompts.",
+ inputSchema: { provider: z.enum(["openai", "github-copilot", "opencode-console", "spacexai"]) }, annotations: write, _meta: appVisibility,
+ }, safe(async ({ provider: selected }: { provider: "openai" | "github-copilot" | "opencode-console" | "spacexai" }) => { const operation = startTestingLogin(selected); recordTestingSetupOperation("login", "started"); return dataResult({ operation }); }));
+ registerAppTool(server, "mobile_testing_setup_answer", {
+ title: "Answer an E2E login prompt", description: "Return the pasted authorization code requested by E2E's OAuth callback. The answer is used in memory and never persisted by Mobile Dev.",
+ inputSchema: { operationId: z.string().uuid(), value: z.string().max(8192) }, annotations: write, _meta: appVisibility,
+ }, safe(async ({ operationId, value }: { operationId: string; value: string }) => dataResult({ accepted: answerTestingSetup(operationId, value) })));
+ registerAppTool(server, "mobile_testing_model_preference", {
+ title: "Save the Testing model preference", description: "Save or clear only the non-secret provider, model and endpoint preference used by bundled runs. Keys and OAuth credentials are never accepted.",
+ inputSchema: { preference: z.object({ provider: z.enum(["vercel", "openrouter", "openai-compatible", "chatgpt", "copilot", "opencode-console", "grok"]), model: z.string().min(1).max(256), endpoint: z.string().max(2048).optional() }).optional() }, annotations: write, _meta: appVisibility,
+ }, safe(async ({ preference }: { preference?: { provider: BundledModelProvider; model: string; endpoint?: string } }) => { await saveTestingModelPreference(preference); recordTestingSetupOperation("preference", "succeeded", preference?.provider); return dataResult({ saved: Boolean(preference) }); }));
registerAppTool(server, "mobile_testing_read_tree", {
title: "Read the runner's element tree",
@@ -242,9 +288,10 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
annotations: read,
_meta: appVisibility,
}, safe(async ({ deviceId, platform, projectPath: selected, bundleId }: { deviceId: string; platform: "ios" | "android"; projectPath: string; bundleId: string }) => {
+ const project = await inspectProject(selected, { platform, bundleId });
// The refs go no further than the server: the panel records selectors and drives the mirror,
// so an agent-device handle per element would be a few kilobytes a read that nothing reads.
- const { tree, screen } = await devices.read({ deviceId, platform, projectPath: selected, bundleId });
+ const { tree, screen } = await devices.read({ deviceId, platform, projectPath: selected, runtimeRoot: project.runtime.root, bundleId });
return dataResult({ tree, ...(screen ? { screen } : {}) });
}));
@@ -258,22 +305,35 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
configPath: z.string().min(1).max(4096).optional().describe("The project's e2e config, so the run can report live per-step progress."),
timeoutMs: z.number().int().min(10_000).max(30 * 60_000).optional(),
target: z.string().min(1).max(256).optional().describe("The e2e target name to run against, so a flow recorded on Android does not run on the config's first (iOS) target."),
+ platform: z.enum(["ios", "android"]).optional().describe("The mirrored platform for a bundled run."),
+ bundleId: z.string().min(1).max(512).optional().describe("The foreground app identifier for a bundled run."),
+ model: z.object({
+ provider: z.enum(["vercel", "openrouter", "openai-compatible", "chatgpt", "copilot", "opencode-console", "grok"]),
+ model: z.string().min(1).max(256), endpoint: z.string().url().max(2048).optional(),
+ }).optional(),
untilSource: z.string().min(1).max(400_000).optional().describe(
"Run this truncated copy of the test instead of the file itself, for \"play until here\": the same flow cut off after one step. It is written beside the test for the one run and removed afterwards; the file itself is not touched."),
},
// A test run drives the app on the device: it taps, types and changes the app's own state.
annotations: destructive,
_meta: appVisibility,
- }, safe(async ({ projectPath: selected, relativePath, configPath, timeoutMs, target, untilSource }: { projectPath: string; relativePath: string; configPath?: string; timeoutMs?: number; target?: string; untilSource?: string }) => {
+ }, safe(async ({ projectPath: selected, relativePath, configPath, timeoutMs, target, platform, bundleId, model, untilSource }: { projectPath: string; relativePath: string; configPath?: string; timeoutMs?: number; target?: string; platform?: "ios" | "android"; bundleId?: string; model?: { provider: BundledModelProvider; model: string; endpoint?: string }; untilSource?: string }) => {
// The release is a dependency of the run, not a step the caller is trusted to have taken: see
// `TestRunDeps`. The panel releases too, but a caller who forgets must not break the run.
progress = [];
running = true;
try {
- const paths = await resolveTestRunPaths(selected, relativePath, configPath);
+ const project = await inspectProject(selected, platform && bundleId ? { platform, bundleId } : undefined);
+ const paths = await resolveTestRunPaths(selected, relativePath, project.runtimeMode === "project" ? configPath : undefined);
+ const selectedTarget = project.targets.find(entry => entry.name === target)
+ ?? project.targets.find(entry => entry.platform === platform && (!bundleId || entry.bundleId === bundleId))
+ ?? project.targets[0];
+ const bundledSource = project.runtimeMode === "bundled" ? (untilSource ?? await readTestFile(selected, relativePath)) : untilSource;
const result = await runRecordedTest(
{ ...paths, ...(timeoutMs === undefined ? {} : { timeoutMs }), ...(target ? { target } : {}),
- ...(untilSource === undefined ? {} : { untilSource }) },
+ ...(bundledSource === undefined ? {} : { untilSource: bundledSource }), runtime: { mode: project.runtimeMode, root: project.runtime.root },
+ ...(project.runtimeMode === "bundled" && selectedTarget?.platform && selectedTarget.bundleId ? { bundledTarget: { platform: selectedTarget.platform as "ios" | "android", bundleId: selectedTarget.bundleId } } : {}),
+ ...(model ? { model } : {}) },
{ release: () => devices.release(), onProgress: entry => { progress.push(entry); } });
return dataResult({ ...result }, `${relativePath} ${result.status}.`);
} finally {
diff --git a/packages/core/test/testing-projects.test.ts b/packages/core/test/testing-projects.test.ts
index 1a8fdc62..622b801d 100644
--- a/packages/core/test/testing-projects.test.ts
+++ b/packages/core/test/testing-projects.test.ts
@@ -37,7 +37,17 @@ test("a config with no targets reads as none rather than throwing", () => {
assert.deepEqual(parseTargets("export default { workers: 1 };"), []);
});
-test("a project is the folder holding an e2e config, and one without is refused", async () => {
+async function installCompatibleRuntime(path: string) {
+ await mkdir(join(path, "node_modules/.bin"), { recursive: true });
+ await mkdir(join(path, "node_modules/e2e"), { recursive: true });
+ await mkdir(join(path, "node_modules/@e2e-dev/mobile/dist"), { recursive: true });
+ await writeFile(join(path, "node_modules/.bin/e2e"), "");
+ await writeFile(join(path, "node_modules/e2e/package.json"), JSON.stringify({ version: "0.17.0" }));
+ await writeFile(join(path, "node_modules/@e2e-dev/mobile/package.json"), JSON.stringify({ version: "0.9.2" }));
+ await writeFile(join(path, "node_modules/@e2e-dev/mobile/dist/nodes.js"), "export {};\n");
+}
+
+test("configured projects stay authoritative and folders without config use bundled mode", async () => {
const root = await mkdtemp(join(tmpdir(), "testing-projects-"));
try {
const project = join(root, "app");
@@ -45,6 +55,8 @@ test("a project is the folder holding an e2e config, and one without is refused"
await mkdir(project);
await mkdir(empty);
await writeFile(join(project, "e2e.config.ts"), CONFIG, "utf-8");
+ await installCompatibleRuntime(project);
+ await writeFile(join(empty, "app.json"), JSON.stringify({ expo: { ios: { bundleIdentifier: "com.example.empty" } } }));
assert.equal(await findConfig(project), join(project, "e2e.config.ts"));
assert.equal(await findConfig(empty), undefined);
@@ -52,12 +64,15 @@ test("a project is the folder holding an e2e config, and one without is refused"
const inspected = await inspectProject(project);
assert.equal(inspected.name, "app");
assert.equal(inspected.targets.at(-1)?.bundleId, "com.anonymous.expoapp57");
+ assert.equal(inspected.runtimeMode, "project");
- // A folder the recorder could not write a test for never reaches the panel's list.
const choices = new TestingProjectChoices(join(root, "state"), async () => empty);
- await assert.rejects(choices.record(empty), /no e2e.config.ts/);
+ const zeroSetup = await inspectProject(empty);
+ assert.equal(zeroSetup.runtimeMode, "bundled");
+ assert.equal(zeroSetup.targets[0]?.bundleId, "com.example.empty");
+ await choices.record(empty);
await choices.record(project);
- assert.deepEqual((await choices.list()).map(entry => entry.path), [project]);
+ assert.deepEqual(new Set((await choices.list()).map(entry => entry.path)), new Set([project, empty]));
} finally {
await rm(root, { recursive: true, force: true });
}
@@ -69,6 +84,7 @@ async function project(): Promise<{ root: string; path: string }> {
const path = join(root, "app");
await mkdir(path);
await writeFile(join(path, "e2e.config.ts"), CONFIG, "utf-8");
+ await installCompatibleRuntime(path);
return { root, path };
}
@@ -137,14 +153,23 @@ test("a symlinked tests folder is refused rather than followed", async () => {
} finally { await rm(root, { recursive: true, force: true }); }
});
-test("a folder that is not an e2e project cannot be written to", async () => {
+test("a folder without project setup saves into Studio state without modifying the project", async () => {
const { root, path } = await project();
+ const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
try {
+ process.env.MOBILE_DEV_TESTING_DIRECTORY = join(root, "studio-state");
const other = join(root, "not-a-project");
await mkdir(other);
- await assert.rejects(writeTestFile(other, "tests/flow.e2e.ts", SOURCE), /no e2e.config.ts/);
+ const saved = await writeTestFile(other, "tests/flow.e2e.ts", SOURCE);
+ assert.equal(saved.written, true);
+ assert.equal(await readFile(join(other, "tests/flow.e2e.ts"), "utf8").catch(() => undefined), undefined);
+ assert.equal(await readTestFile(other, "tests/flow.e2e.ts"), SOURCE);
assert.ok(path);
- } finally { await rm(root, { recursive: true, force: true }); }
+ } finally {
+ if (previous === undefined) delete process.env.MOBILE_DEV_TESTING_DIRECTORY;
+ else process.env.MOBILE_DEV_TESTING_DIRECTORY = previous;
+ await rm(root, { recursive: true, force: true });
+ }
});
test("the project's own tests are listed, newest first, and nothing else is", async () => {
diff --git a/packages/core/test/testing-run.test.ts b/packages/core/test/testing-run.test.ts
index 699d6bbe..2658e67b 100644
--- a/packages/core/test/testing-run.test.ts
+++ b/packages/core/test/testing-run.test.ts
@@ -7,7 +7,8 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import { existsSync } from "node:fs";
import { readFileSync } from "node:fs";
-import { parseProgressLine, parseReport, progressConfigSource, reportDuration, reportSteps, reportStatus, runRecordedTest, runnerBin, runnerEnv, untilTestPath } from "../src/testing-run.ts";
+import { bundledConfigSource, parseProgressLine, parseReport, progressConfigSource, reportDuration, reportSteps, reportStatus, runRecordedTest, runnerBin, runnerEnv, untilTestPath } from "../src/testing-run.ts";
+import { bundledE2eRoot } from "../src/e2e-runtime.ts";
const FILE = "tests/a-recorded-flow.e2e.ts";
@@ -308,3 +309,26 @@ test("the selected target reaches the runner, so an Android recording does not r
{ spawner: spawner(JSON.stringify(report([{ line: 8, status: "passed" }])), 0, seen) });
assert.deepEqual(seen.args, ["run", FILE, "--reporter", "json", "--target", "android"]);
});
+
+test("bundled mode runs and cleans an isolated Studio workspace", async () => {
+ const root = await project();
+ const seen: { command?: string; args?: readonly string[]; cwd?: string } = {};
+ const result = await runRecordedTest({
+ projectPath: root, relativePath: FILE, untilSource: 'test("x", async () => {});\n',
+ runtime: { mode: "bundled", root: bundledE2eRoot() },
+ bundledTarget: { platform: "ios", bundleId: "com.example.app" },
+ }, { spawner: spawner(JSON.stringify(report([{ line: 1, status: "passed" }])), 0, seen) });
+ assert.equal(result.status, "passed");
+ assert.match(seen.args?.[0] ?? "", /e2e\/dist\/cli\/bin\.js$/);
+ assert.ok(seen.args?.some((value, index) => value === "--target" && seen.args?.[index + 1] === "ios"));
+ assert.ok(seen.cwd?.includes("mobile-dev-e2e-run-"));
+ assert.equal(existsSync(seen.cwd!), false, "temporary config, test and node_modules link are cleaned");
+});
+
+test("bundled deterministic tests need no model and agent tests request one", async () => {
+ assert.doesNotMatch(bundledConfigSource({ platform: "android", bundleId: "com.example.app" }), /agents:/);
+ await assert.rejects(runRecordedTest({
+ projectPath: "/unused", relativePath: FILE, untilSource: 'test("x", async ({ agent }) => { await agent.extract("title"); });\n',
+ runtime: { mode: "bundled", root: bundledE2eRoot() }, bundledTarget: { platform: "android", bundleId: "com.example.app" },
+ }), /Choose a provider and model/);
+});
diff --git a/packages/core/test/testing-setup-telemetry.test.ts b/packages/core/test/testing-setup-telemetry.test.ts
new file mode 100644
index 00000000..b397b80d
--- /dev/null
+++ b/packages/core/test/testing-setup-telemetry.test.ts
@@ -0,0 +1,23 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+import * as Sentry from "@sentry/node";
+import type { Envelope } from "@sentry/core";
+import { recordTestingSetupOperation } from "../src/telemetry.ts";
+import { scrubMetric } from "../../shared/src/telemetry.ts";
+
+test("testing setup telemetry contains only bounded structural attributes", async t => {
+ const envelopes: Envelope[] = [];
+ Sentry.init({
+ dsn: "https://public@example.com/1", defaultIntegrations: false, beforeSendMetric: scrubMetric,
+ transport: () => ({ async send(envelope) { envelopes.push(envelope); return { statusCode: 200 }; }, async flush() { return true; } }),
+ });
+ t.after(async () => { await Sentry.close(); });
+ recordTestingSetupOperation("apply", "failed", "chatgpt");
+ recordTestingSetupOperation("login", "started", "/private/project?token=secret");
+ await Sentry.flush();
+ const encoded = JSON.stringify(envelopes);
+ assert.match(encoded, /testing\.setup\.operation\.samples/);
+ assert.match(encoded, /chatgpt/);
+ assert.match(encoded, /other/);
+ assert.doesNotMatch(encoded, /private\/project|token/);
+});
diff --git a/packages/core/test/testing-setup.test.ts b/packages/core/test/testing-setup.test.ts
new file mode 100644
index 00000000..c19a8c2b
--- /dev/null
+++ b/packages/core/test/testing-setup.test.ts
@@ -0,0 +1,100 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { mkdtemp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { answerTestingSetup, applyTestingSetup, cancelTestingSetup, planTestingSetup, setupConfigSource, startTestingLogin, testingSetupProgress } from "../src/testing-setup.ts";
+
+const options = {
+ targets: [
+ { name: "ios", platform: "ios" as const, bundleId: "com.example.app" },
+ { name: "android", platform: "android" as const, bundleId: "com.example.app" },
+ ],
+ provider: "none" as const,
+ installDependencies: false,
+ installSkill: false,
+ registerMcp: false,
+};
+
+async function project() {
+ const root = await mkdtemp(join(tmpdir(), "testing-setup-"));
+ await writeFile(join(root, "package.json"), JSON.stringify({ name: "fixture", private: true }, null, 2) + "\n");
+ return root;
+}
+
+async function terminal(id: string) {
+ for (let index = 0; index < 200; index++) {
+ const operation = testingSetupProgress(id)!;
+ if (!["running", "waiting"].includes(operation.status)) return operation;
+ await new Promise(resolve => setTimeout(resolve, 5));
+ }
+ throw new Error("operation did not finish");
+}
+
+test("the setup preview is immutable and apply creates a complete mobile scaffold", async () => {
+ const root = await project();
+ try {
+ const plan = await planTestingSetup(root, options);
+ assert.equal(await readFile(join(root, "e2e.config.ts"), "utf8").catch(() => undefined), undefined, "preview writes nothing");
+ assert.ok(plan.actions.some(action => action.path === "e2e.config.ts" && action.action === "create"));
+ const started = applyTestingSetup(plan.id);
+ const done = await terminal(started.id);
+ assert.equal(done.status, "succeeded");
+ const config = await readFile(join(root, "e2e.config.ts"), "utf8");
+ assert.match(config, /platform: "ios"/);
+ assert.match(config, /platform: "android"/);
+ const manifest = JSON.parse(await readFile(join(root, "package.json"), "utf8"));
+ assert.equal(manifest.scripts["test:e2e"], "e2e run");
+ assert.equal(manifest.devDependencies.e2e, "^0.17.0");
+ assert.match(await readFile(join(root, ".gitignore"), "utf8"), /\.e2e\/artifacts\//);
+ } finally { await rm(root, { recursive: true, force: true }); }
+});
+
+test("setup preserves an existing config and refuses a stale plan", async () => {
+ const root = await project();
+ try {
+ await writeFile(join(root, "e2e.config.ts"), "// user config\n");
+ const plan = await planTestingSetup(root, options);
+ assert.ok(plan.actions.some(action => action.path === "e2e.config.ts" && action.action === "skip"));
+ await writeFile(join(root, "package.json"), JSON.stringify({ name: "changed" }));
+ const done = await terminal(applyTestingSetup(plan.id).id);
+ assert.equal(done.status, "failed");
+ assert.match(done.message, /changed after the preview/);
+ assert.equal(await readFile(join(root, "e2e.config.ts"), "utf8"), "// user config\n");
+ } finally { await rm(root, { recursive: true, force: true }); }
+});
+
+test("a setup can be cancelled before writes and reports partial work instead of rolling it back", async () => {
+ const root = await project();
+ try {
+ const plan = await planTestingSetup(root, { ...options, installDependencies: true });
+ const started = applyTestingSetup(plan.id);
+ assert.equal(cancelTestingSetup(started.id), true);
+ const done = await terminal(started.id);
+ assert.equal(done.status, "cancelled");
+ assert.ok(Array.isArray(done.applied));
+ } finally { await rm(root, { recursive: true, force: true }); }
+});
+
+test("subscription login is driven through E2E callbacks and keeps prompt answers in memory", async () => {
+ let received = "";
+ const started = startTestingLogin("openai", async (_provider, callbacks) => {
+ callbacks.onAuth({ url: "https://example.test/login", instructions: "Open the browser", userCode: "ABCD" });
+ received = await callbacks.onPrompt({ message: "Paste the code", placeholder: "code" });
+ });
+ await new Promise(resolve => setTimeout(resolve, 0));
+ const waiting = testingSetupProgress(started.id)!;
+ assert.equal(waiting.status, "waiting");
+ assert.equal(waiting.auth?.userCode, "ABCD");
+ assert.equal(answerTestingSetup(started.id, "synthetic-code"), true);
+ const done = await terminal(started.id);
+ assert.equal(done.status, "succeeded");
+ assert.equal(received, "synthetic-code");
+});
+
+test("generated config includes only a chosen supported provider", () => {
+ const source = setupConfigSource({ ...options, provider: "chatgpt", model: "gpt-6-luna" });
+ assert.match(source, /e2e\/oauth\/chatgpt/);
+ assert.match(source, /chatgpt\("gpt-6-luna"\)/);
+ assert.doesNotMatch(source, /API_KEY/);
+});
diff --git a/packages/core/test/testing-target-discovery.test.ts b/packages/core/test/testing-target-discovery.test.ts
new file mode 100644
index 00000000..f0d5a5b5
--- /dev/null
+++ b/packages/core/test/testing-target-discovery.test.ts
@@ -0,0 +1,45 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { chmod, mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { discoverTestingTargets, expoTargets } from "../src/testing-target-discovery.ts";
+
+test("Expo config produces both iOS and Android targets when both identifiers are known", () => {
+ assert.deepEqual(expoTargets({ expo: { ios: { bundleIdentifier: "com.example.app" }, android: { package: "com.example.app" } } }), [
+ { name: "ios", platform: "ios", bundleId: "com.example.app" },
+ { name: "android", platform: "android", bundleId: "com.example.app" },
+ ]);
+});
+
+test("target discovery uses the project-local Expo CLI without npx", async () => {
+ const root = await mkdtemp(join(tmpdir(), "testing-expo-cli-"));
+ try {
+ const bin = join(root, "node_modules/.bin/expo");
+ await mkdir(join(root, "node_modules/.bin"), { recursive: true });
+ await writeFile(bin, `#!/usr/bin/env node\nprocess.stdout.write(JSON.stringify({ios:{bundleIdentifier:'com.cli.ios'},android:{package:'com.cli.android'}}));\n`);
+ await chmod(bin, 0o755);
+ await writeFile(join(root, "app.json"), JSON.stringify({ expo: { ios: { bundleIdentifier: "com.static.wrong" } } }));
+ const result = await discoverTestingTargets(root);
+ assert.equal(result.source, "expo-cli");
+ assert.deepEqual(result.targets.map(target => target.bundleId), ["com.cli.ios", "com.cli.android"]);
+ } finally { await rm(root, { recursive: true, force: true }); }
+});
+
+test("a failing local CLI falls back to non-executing app.config data, then foreground app", async () => {
+ const root = await mkdtemp(join(tmpdir(), "testing-expo-static-"));
+ try {
+ const bin = join(root, "node_modules/.bin/expo");
+ await mkdir(join(root, "node_modules/.bin"), { recursive: true });
+ await writeFile(bin, "#!/bin/sh\nexit 2\n"); await chmod(bin, 0o755);
+ await writeFile(join(root, "app.config.ts"), `export default { expo: { ios: { bundleIdentifier: 'com.static.ios' }, android: { package: 'com.static.android' } } };\n`);
+ const result = await discoverTestingTargets(root, { platform: "ios", bundleId: "com.foreground" });
+ assert.equal(result.source, "static-expo");
+ assert.deepEqual(result.targets.map(target => target.bundleId), ["com.static.ios", "com.static.android"]);
+
+ await rm(join(root, "app.config.ts"));
+ const foreground = await discoverTestingTargets(root, { platform: "android", bundleId: "com.foreground" });
+ assert.equal(foreground.source, "foreground");
+ assert.deepEqual(foreground.targets, [{ name: "android", platform: "android", bundleId: "com.foreground" }]);
+ } finally { await rm(root, { recursive: true, force: true }); }
+});
diff --git a/packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt b/packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt
new file mode 100644
index 00000000..f5348ab5
--- /dev/null
+++ b/packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt
@@ -0,0 +1,2315 @@
+@ai-sdk/anthropic 4.0.58 (LICENSE)
+
+Copyright 2023 Vercel, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+====================
+
+@ai-sdk/gateway 4.0.136 (LICENSE)
+
+Copyright 2023 Vercel, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+====================
+
+@ai-sdk/google 4.0.77 (LICENSE)
+
+Copyright 2023 Vercel, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+====================
+
+@ai-sdk/openai 4.0.109 (LICENSE)
+
+Copyright 2023 Vercel, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+====================
+
+@ai-sdk/openai-compatible 3.0.53 (LICENSE)
+
+Copyright 2023 Vercel, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+====================
+
+@ai-sdk/provider 4.0.17 (LICENSE)
+
+Copyright 2023 Vercel, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+====================
+
+@ai-sdk/xai 5.0.4 (LICENSE)
+
+Copyright 2023 Vercel, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+====================
+
+@clack/core 1.5.1 (LICENSE)
+
+MIT License
+
+MIT License Copyright (c) 2025-Present [Bombshell contributors](https://bomb.sh/team)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+====================
+
+@clack/prompts 1.8.1 (LICENSE)
+
+MIT License
+
+MIT License Copyright (c) 2025-Present [Bombshell contributors](https://bomb.sh/team)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+====================
+
+@e2e-dev/mobile 0.9.2 (LICENSE)
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+====================
+
+@e2e-dev/mobile 0.9.2 (NOTICE)
+
+@e2e-dev/mobile
+Copyright 2026 TesterArmy, Inc.
+
+This product includes software developed at TesterArmy, Inc.
+(https://tester.army).
+
+====================
+
+@modelcontextprotocol/core 2.2.0 (LICENSE)
+
+The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
+
+Contributions for which relicensing consent has been obtained are licensed under Apache-2.0. Contributions made by authors who originally licensed their work under the MIT License and who have not yet granted explicit permission to relicense remain licensed under the MIT License.
+
+No rights beyond those granted by the applicable original license are conveyed for such contributions.
+
+---
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to the Licensor for inclusion in the Work by the copyright
+ owner or by an individual or Legal Entity authorized to submit on behalf
+ of the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+---
+
+MIT License
+
+Copyright (c) 2024-2025 Model Context Protocol a Series of LF Projects, LLC.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+---
+
+Creative Commons Attribution 4.0 International (CC-BY-4.0)
+
+Documentation in this project (excluding specifications) is licensed under
+CC-BY-4.0. See https://creativecommons.org/licenses/by/4.0/legalcode for
+the full license text.
+
+====================
+
+@modelcontextprotocol/server 2.2.0 (LICENSE)
+
+The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
+
+Contributions for which relicensing consent has been obtained are licensed under Apache-2.0. Contributions made by authors who originally licensed their work under the MIT License and who have not yet granted explicit permission to relicense remain licensed under the MIT License.
+
+No rights beyond those granted by the applicable original license are conveyed for such contributions.
+
+---
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to the Licensor for inclusion in the Work by the copyright
+ owner or by an individual or Legal Entity authorized to submit on behalf
+ of the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+---
+
+MIT License
+
+Copyright (c) 2024-2025 Model Context Protocol a Series of LF Projects, LLC.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+---
+
+Creative Commons Attribution 4.0 International (CC-BY-4.0)
+
+Documentation in this project (excluding specifications) is licensed under
+CC-BY-4.0. See https://creativecommons.org/licenses/by/4.0/legalcode for
+the full license text.
+
+====================
+
+@openrouter/ai-sdk-provider 3.1.0 (LICENSE)
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2025 OpenRouter Inc,
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+====================
+
+@standard-schema/spec 1.1.0 (LICENSE)
+
+MIT License
+
+Copyright (c) 2024 Colin McDonnell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+@types/chai 5.2.3 (LICENSE)
+
+ MIT License
+
+ Copyright (c) Microsoft Corporation.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE
+
+====================
+
+@types/deep-eql 4.0.2 (LICENSE)
+
+ MIT License
+
+ Copyright (c) Microsoft Corporation.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE
+
+====================
+
+@vercel/oidc 3.2.0 (LICENSE)
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2017 Vercel, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+====================
+
+@vitest/expect 5.0.2 (LICENSE)
+
+MIT License
+
+Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+@vitest/pretty-format 5.0.2 (LICENSE)
+
+MIT License
+
+Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+@vitest/spy 5.0.2 (LICENSE)
+
+MIT License
+
+Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+@vitest/utils 5.0.2 (LICENSE)
+
+MIT License
+
+Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+@workflow/serde 4.1.0 (LICENSE.md)
+
+Apache License 2.0
+
+See the LICENSE file in the root of this repository.
+
+====================
+
+agent-device 0.21.20 (LICENSE)
+
+MIT License
+
+Copyright (c) 2026 Callstack
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+ai 7.0.163 (LICENSE)
+
+Copyright 2023 Vercel, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+====================
+
+assertion-error 2.0.1 (LICENSE)
+
+MIT License
+
+Copyright (c) 2013 Jake Luer jake@qualiancy.com (http://qualiancy.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+chai 6.3.0 (LICENSE)
+
+MIT License
+
+Copyright (c) 2017 Chai.js Assertion Library
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+commander 15.0.0 (LICENSE)
+
+(The MIT License)
+
+Copyright (c) 2011 TJ Holowaychuk
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+====================
+
+convert-source-map 2.0.0 (LICENSE)
+
+Copyright 2013 Thorsten Lorenz.
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+====================
+
+e2e 0.17.0 (LICENSE)
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+====================
+
+e2e 0.17.0 (NOTICE)
+
+e2e
+Copyright 2026 TesterArmy, Inc.
+
+This product includes software developed at TesterArmy, Inc.
+(https://tester.army).
+
+====================
+
+esbuild 0.28.2 (LICENSE.md)
+
+MIT License
+
+Copyright (c) 2020 Evan Wallace
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+eventsource-parser 3.1.1 (LICENSE)
+
+MIT License
+
+Copyright (c) 2026 Espen Hovlandsdal
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+fast-string-truncated-width 3.0.3 (license)
+
+The MIT License (MIT)
+
+Copyright (c) 2024-present Fabio Spampinato
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+====================
+
+fast-string-width 3.0.2 (license)
+
+The MIT License (MIT)
+
+Copyright (c) 2024-present Fabio Spampinato
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+====================
+
+fast-wrap-ansi 0.2.2 (LICENSE)
+
+MIT License
+
+Copyright (c) 2025 James Garbutt
+
+Copyright (c) Sindre Sorhus (https://sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+fsevents 2.3.3 (LICENSE)
+
+MIT License
+-----------
+
+Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+====================
+
+json-schema 0.4.0 (LICENSE)
+
+Dojo is available under *either* the terms of the BSD 3-Clause "New" License *or* the
+Academic Free License version 2.1. As a recipient of Dojo, you may choose which
+license to receive this code under (except as noted in per-module LICENSE
+files). Some modules may not be the copyright of the Dojo Foundation. These
+modules contain explicit declarations of copyright in both the LICENSE files in
+the directories in which they reside and in the code itself. No external
+contributions are allowed under licenses which are fundamentally incompatible
+with the AFL-2.1 OR and BSD-3-Clause licenses that Dojo is distributed under.
+
+The text of the AFL-2.1 and BSD-3-Clause licenses is reproduced below.
+
+-------------------------------------------------------------------------------
+BSD 3-Clause "New" License:
+**********************
+
+Copyright (c) 2005-2015, The Dojo Foundation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the Dojo Foundation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------------------
+The Academic Free License, v. 2.1:
+**********************************
+
+This Academic Free License (the "License") applies to any original work of
+authorship (the "Original Work") whose owner (the "Licensor") has placed the
+following notice immediately following the copyright notice for the Original
+Work:
+
+Licensed under the Academic Free License version 2.1
+
+1) Grant of Copyright License. Licensor hereby grants You a world-wide,
+royalty-free, non-exclusive, perpetual, sublicenseable license to do the
+following:
+
+a) to reproduce the Original Work in copies;
+
+b) to prepare derivative works ("Derivative Works") based upon the Original
+Work;
+
+c) to distribute copies of the Original Work and Derivative Works to the
+public;
+
+d) to perform the Original Work publicly; and
+
+e) to display the Original Work publicly.
+
+2) Grant of Patent License. Licensor hereby grants You a world-wide,
+royalty-free, non-exclusive, perpetual, sublicenseable license, under patent
+claims owned or controlled by the Licensor that are embodied in the Original
+Work as furnished by the Licensor, to make, use, sell and offer for sale the
+Original Work and Derivative Works.
+
+3) Grant of Source Code License. The term "Source Code" means the preferred
+form of the Original Work for making modifications to it and all available
+documentation describing how to modify the Original Work. Licensor hereby
+agrees to provide a machine-readable copy of the Source Code of the Original
+Work along with each copy of the Original Work that Licensor distributes.
+Licensor reserves the right to satisfy this obligation by placing a
+machine-readable copy of the Source Code in an information repository
+reasonably calculated to permit inexpensive and convenient access by You for as
+long as Licensor continues to distribute the Original Work, and by publishing
+the address of that information repository in a notice immediately following
+the copyright notice that applies to the Original Work.
+
+4) Exclusions From License Grant. Neither the names of Licensor, nor the names
+of any contributors to the Original Work, nor any of their trademarks or
+service marks, may be used to endorse or promote products derived from this
+Original Work without express prior written permission of the Licensor. Nothing
+in this License shall be deemed to grant any rights to trademarks, copyrights,
+patents, trade secrets or any other intellectual property of Licensor except as
+expressly stated herein. No patent license is granted to make, use, sell or
+offer to sell embodiments of any patent claims other than the licensed claims
+defined in Section 2. No right is granted to the trademarks of Licensor even if
+such marks are included in the Original Work. Nothing in this License shall be
+interpreted to prohibit Licensor from licensing under different terms from this
+License any Original Work that Licensor otherwise would have a right to
+license.
+
+5) This section intentionally omitted.
+
+6) Attribution Rights. You must retain, in the Source Code of any Derivative
+Works that You create, all copyright, patent or trademark notices from the
+Source Code of the Original Work, as well as any notices of licensing and any
+descriptive text identified therein as an "Attribution Notice." You must cause
+the Source Code for any Derivative Works that You create to carry a prominent
+Attribution Notice reasonably calculated to inform recipients that You have
+modified the Original Work.
+
+7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
+the copyright in and to the Original Work and the patent rights granted herein
+by Licensor are owned by the Licensor or are sublicensed to You under the terms
+of this License with the permission of the contributor(s) of those copyrights
+and patent rights. Except as expressly stated in the immediately proceeding
+sentence, the Original Work is provided under this License on an "AS IS" BASIS
+and WITHOUT WARRANTY, either express or implied, including, without limitation,
+the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU.
+This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No
+license to Original Work is granted hereunder except under this disclaimer.
+
+8) Limitation of Liability. Under no circumstances and under no legal theory,
+whether in tort (including negligence), contract, or otherwise, shall the
+Licensor be liable to any person for any direct, indirect, special, incidental,
+or consequential damages of any character arising as a result of this License
+or the use of the Original Work including, without limitation, damages for loss
+of goodwill, work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses. This limitation of liability shall not
+apply to liability for death or personal injury resulting from Licensor's
+negligence to the extent applicable law prohibits such limitation. Some
+jurisdictions do not allow the exclusion or limitation of incidental or
+consequential damages, so this exclusion and limitation may not apply to You.
+
+9) Acceptance and Termination. If You distribute copies of the Original Work or
+a Derivative Work, You must make a reasonable effort under the circumstances to
+obtain the express assent of recipients to the terms of this License. Nothing
+else but this License (or another written agreement between Licensor and You)
+grants You permission to create Derivative Works based upon the Original Work
+or to exercise any of the rights granted in Section 1 herein, and any attempt
+to do so except under the terms of this License (or another written agreement
+between Licensor and You) is expressly prohibited by U.S. copyright law, the
+equivalent laws of other countries, and by international treaty. Therefore, by
+exercising any of the rights granted to You in Section 1 herein, You indicate
+Your acceptance of this License and all of its terms and conditions.
+
+10) Termination for Patent Action. This License shall terminate automatically
+and You may no longer exercise any of the rights granted to You by this License
+as of the date You commence an action, including a cross-claim or counterclaim,
+against Licensor or any licensee alleging that the Original Work infringes a
+patent. This termination provision shall not apply for an action alleging
+patent infringement by combinations of the Original Work with other software or
+hardware.
+
+11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this
+License may be brought only in the courts of a jurisdiction wherein the
+Licensor resides or in which Licensor conducts its primary business, and under
+the laws of that jurisdiction excluding its conflict-of-law provisions. The
+application of the United Nations Convention on Contracts for the International
+Sale of Goods is expressly excluded. Any use of the Original Work outside the
+scope of this License or after its termination shall be subject to the
+requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et
+seq., the equivalent laws of other countries, and international treaty. This
+section shall survive the termination of this License.
+
+12) Attorneys Fees. In any action to enforce the terms of this License or
+seeking damages relating thereto, the prevailing party shall be entitled to
+recover its costs and expenses, including, without limitation, reasonable
+attorneys' fees and costs incurred in connection with such action, including
+any appeal of such action. This section shall survive the termination of this
+License.
+
+13) Miscellaneous. This License represents the complete agreement concerning
+the subject matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent necessary to
+make it enforceable.
+
+14) Definition of "You" in This License. "You" throughout this License, whether
+in upper or lower case, means an individual or a legal entity exercising rights
+under, and complying with all of the terms of, this License. For legal
+entities, "You" includes any entity that controls, is controlled by, or is
+under common control with you. For purposes of this definition, "control" means
+(i) the power, direct or indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (ii) ownership of fifty percent
+(50%) or more of the outstanding shares, or (iii) beneficial ownership of such
+entity.
+
+15) Right to Use. You may use the Original Work in all ways not otherwise
+restricted or conditioned by this License or by law, and Licensor promises not
+to interfere with or be responsible for such uses by You.
+
+This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved.
+Permission is hereby granted to copy and distribute this license without
+modification. This license may not be modified without the express written
+permission of its copyright owner.
+
+====================
+
+picocolors 1.1.1 (LICENSE)
+
+ISC License
+
+Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+====================
+
+pngjs 7.0.0 (LICENSE)
+
+pngjs original work Copyright (c) 2015 Luke Page & Original Contributors
+pngjs derived work Copyright (c) 2012 Kuba Niegowski
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+====================
+
+sisteransi 1.0.5 (license)
+
+MIT License
+
+Copyright (c) 2018 Terkel Gjervig Nielsen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+tinyrainbow 3.2.0 (LICENCE)
+
+MIT License
+
+Copyright (c) 2022 Tinylibs
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+tsx 4.23.14 (LICENSE)
+
+MIT License
+
+Copyright (c) Hiroki Osame
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+undici 7.30.2 (LICENSE)
+
+MIT License
+
+Copyright (c) Matteo Collina and Undici contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+zod 4.6.7 (LICENSE)
+
+MIT License
+
+Copyright (c) 2025 Colin McDonnell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/packages/runtimes/e2e/package-lock.json b/packages/runtimes/e2e/package-lock.json
new file mode 100644
index 00000000..9156bd74
--- /dev/null
+++ b/packages/runtimes/e2e/package-lock.json
@@ -0,0 +1,1150 @@
+{
+ "name": "@mobile-dev/e2e-runtime",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "@mobile-dev/e2e-runtime",
+ "version": "0.1.0",
+ "dependencies": {
+ "@ai-sdk/anthropic": "4.0.58",
+ "@ai-sdk/google": "4.0.77",
+ "@ai-sdk/openai": "4.0.109",
+ "@ai-sdk/openai-compatible": "3.0.53",
+ "@ai-sdk/xai": "5.0.4",
+ "@e2e-dev/mobile": "0.9.2",
+ "@openrouter/ai-sdk-provider": "3.1.0",
+ "ai": "7.0.163",
+ "e2e": "0.17.0",
+ "zod": "4.6.7"
+ }
+ },
+ "node_modules/@ai-sdk/anthropic": {
+ "version": "4.0.58",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/anthropic/-/anthropic-4.0.58.tgz",
+ "integrity": "sha512-vhXKBz7jnIhBlOoj2d0joyHicWISuIxDNha65SLrAnagAkVgulLoZBRLZRazstxlO/BtXU+cDERe1opVKte2OQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/provider": "4.0.17",
+ "@ai-sdk/provider-utils": "5.0.45"
+ },
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/@ai-sdk/gateway": {
+ "version": "4.0.136",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/gateway/-/gateway-4.0.136.tgz",
+ "integrity": "sha512-P851NL80P85Ee6MhblRuuCzNlQdOYU5rKmdt/Wuo5dMtkzvIHhyVZY9wtfKG3wBJUUoxHxWKsI2aR6O75o8diA==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/provider": "4.0.36",
+ "@ai-sdk/provider-utils": "5.0.75",
+ "@vercel/oidc": "3.2.0"
+ },
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/@ai-sdk/gateway/node_modules/@ai-sdk/provider": {
+ "version": "4.0.36",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.36.tgz",
+ "integrity": "sha512-GqvWZSZdBelCGughlBdOoupT258rgM3YMbaLAS9WSZJ0vlt8c9vm3My+ZT31mYhiReMCMCF2qF2axnGbILpk1A==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "json-schema": "^0.4.0"
+ },
+ "engines": {
+ "node": ">=22"
+ }
+ },
+ "node_modules/@ai-sdk/gateway/node_modules/@ai-sdk/provider-utils": {
+ "version": "5.0.75",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-5.0.75.tgz",
+ "integrity": "sha512-k4yAsFliGZwoTpyTpm3ptxwIeaPvRh5vGh/UWoqDiLLXKoyz4zuBGS7p3ygf8to5Bh4fAOHynotLBsWLIYdu2A==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/provider": "4.0.36",
+ "@standard-schema/spec": "^1.1.0",
+ "@workflow/serde": "4.1.0",
+ "eventsource-parser": "^3.0.8",
+ "undici": "^7.29.1"
+ },
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/@ai-sdk/google": {
+ "version": "4.0.77",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/google/-/google-4.0.77.tgz",
+ "integrity": "sha512-7s1Gy6PL/KRk12s31g+LMMY5v1D80AQT6Lm+HUGXvCXw5T5WCxzbUuxOrBegXhhLPfIXTRunkYgSIjcRys37Zw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/provider": "4.0.17",
+ "@ai-sdk/provider-utils": "5.0.45"
+ },
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/@ai-sdk/openai": {
+ "version": "4.0.109",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/openai/-/openai-4.0.109.tgz",
+ "integrity": "sha512-N20L44ztSicqEWpB0LfV54Ee1iq6IjGfOFTcRfeTD/bRH0v/VDI1uHve7RFOhP2oi1eAluliBhgmurplaOBuVw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/provider": "4.0.36",
+ "@ai-sdk/provider-utils": "5.0.75"
+ },
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/@ai-sdk/openai-compatible": {
+ "version": "3.0.53",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/openai-compatible/-/openai-compatible-3.0.53.tgz",
+ "integrity": "sha512-uOeghHYcF+CHP/dOCAtdfKesuKLKqDFtkq79bJFNSx4YOqpiP734TdJAZDA8KIWH7mdGNQ0a4N9238HG4FN2Rg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/provider": "4.0.17",
+ "@ai-sdk/provider-utils": "5.0.45"
+ },
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider": {
+ "version": "4.0.36",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.36.tgz",
+ "integrity": "sha512-GqvWZSZdBelCGughlBdOoupT258rgM3YMbaLAS9WSZJ0vlt8c9vm3My+ZT31mYhiReMCMCF2qF2axnGbILpk1A==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "json-schema": "^0.4.0"
+ },
+ "engines": {
+ "node": ">=22"
+ }
+ },
+ "node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider-utils": {
+ "version": "5.0.75",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-5.0.75.tgz",
+ "integrity": "sha512-k4yAsFliGZwoTpyTpm3ptxwIeaPvRh5vGh/UWoqDiLLXKoyz4zuBGS7p3ygf8to5Bh4fAOHynotLBsWLIYdu2A==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/provider": "4.0.36",
+ "@standard-schema/spec": "^1.1.0",
+ "@workflow/serde": "4.1.0",
+ "eventsource-parser": "^3.0.8",
+ "undici": "^7.29.1"
+ },
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/@ai-sdk/provider": {
+ "version": "4.0.17",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.17.tgz",
+ "integrity": "sha512-VYMBxIQdcHqbIf1j+YZlI9Ati6LZ4wJe0GGd4z4a5H/KxTggjeOiyaVYTnfF7LHZK5jMQ+rofmzz4QPqf++NUw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "json-schema": "^0.4.0"
+ },
+ "engines": {
+ "node": ">=22"
+ }
+ },
+ "node_modules/@ai-sdk/provider-utils": {
+ "version": "5.0.45",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-5.0.45.tgz",
+ "integrity": "sha512-gLuaCups8OCIRz3eO6WWz5op7VLYNNtFzyH0sWUr0FE9v7cTxR0qxDpQdrKnGcql+9WWttobjnZsJVsuEbsPQQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/provider": "4.0.17",
+ "@standard-schema/spec": "^1.1.0",
+ "@workflow/serde": "4.1.0",
+ "eventsource-parser": "^3.0.8",
+ "undici": "^7.29.0"
+ },
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/@ai-sdk/xai": {
+ "version": "5.0.4",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/xai/-/xai-5.0.4.tgz",
+ "integrity": "sha512-Cg3xUB0H6OA4fvcX+uamkZXuzxdjhi7HH15glxpE8boZUijFmfz3YPM3Y/HvQkuCb6D/ixCe7lpcwVjidLhw9w==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/provider": "4.0.17",
+ "@ai-sdk/provider-utils": "5.0.45"
+ },
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/@clack/core": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/@clack/core/-/core-1.5.1.tgz",
+ "integrity": "sha512-iHTrHA8MtVuLl2TfZySmcKv1qO2PoyC9Z7pfSDozEuV5vtY3/wcOPKJXlqJ5Oq2Cx5DDGQGAMVx6HZfRRoVEbQ==",
+ "license": "MIT",
+ "dependencies": {
+ "fast-wrap-ansi": "^0.2.0",
+ "sisteransi": "^1.0.5"
+ },
+ "engines": {
+ "node": ">= 20.12.0"
+ }
+ },
+ "node_modules/@clack/prompts": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.8.1.tgz",
+ "integrity": "sha512-dlT1m5e/0yUL0kRNcQn7yGLVThkgbB0Ga/1AmfDDC/8ik6AIiSf2QLQO2zPYvefsHP0aFgxO93cVLCCfDp7kzQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@clack/core": "1.5.1",
+ "fast-string-width": "^3.0.2",
+ "fast-wrap-ansi": "^0.2.0",
+ "sisteransi": "^1.0.5"
+ },
+ "engines": {
+ "node": ">= 20.12.0"
+ }
+ },
+ "node_modules/@e2e-dev/mobile": {
+ "version": "0.9.2",
+ "resolved": "https://registry.npmjs.org/@e2e-dev/mobile/-/mobile-0.9.2.tgz",
+ "integrity": "sha512-aY09M1ckxtezydmTI6/R72R/RVuwZn42+phGekQLCkZWID1EXNQi19+leYyyZJWdH4p+E2EVgYm4k8EcilYM0Q==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "agent-device": "0.21.20",
+ "pngjs": "7.0.0",
+ "zod": "4.6.1"
+ },
+ "engines": {
+ "node": ">=22.12.0"
+ },
+ "peerDependencies": {
+ "ai": "^7.0.0",
+ "e2e": ">=0.15.0 <1"
+ },
+ "peerDependenciesMeta": {
+ "ai": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@e2e-dev/mobile/node_modules/zod": {
+ "version": "4.6.1",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.1.tgz",
+ "integrity": "sha512-341aRWQsve0rvronKNTqZpjmzdbUDlFuzHaI/XLg/Ej82qffDJRRfBTCuv7+9q/rMjB6LSLyEBnW4InJeMtt/Q==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
+ },
+ "node_modules/@esbuild/aix-ppc64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz",
+ "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==",
+ "cpu": [
+ "ppc64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz",
+ "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==",
+ "cpu": [
+ "arm"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz",
+ "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-x64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz",
+ "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz",
+ "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-x64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz",
+ "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz",
+ "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-x64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz",
+ "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz",
+ "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==",
+ "cpu": [
+ "arm"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz",
+ "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ia32": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz",
+ "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-loong64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz",
+ "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==",
+ "cpu": [
+ "loong64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-mips64el": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz",
+ "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==",
+ "cpu": [
+ "mips64el"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ppc64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz",
+ "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==",
+ "cpu": [
+ "ppc64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-riscv64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz",
+ "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==",
+ "cpu": [
+ "riscv64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-s390x": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz",
+ "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==",
+ "cpu": [
+ "s390x"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-x64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz",
+ "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-arm64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz",
+ "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-x64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz",
+ "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-arm64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz",
+ "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-x64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz",
+ "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openharmony-arm64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz",
+ "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/sunos-x64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz",
+ "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-arm64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz",
+ "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-ia32": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz",
+ "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==",
+ "cpu": [
+ "ia32"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-x64": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz",
+ "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@modelcontextprotocol/core": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/@modelcontextprotocol/core/-/core-2.2.0.tgz",
+ "integrity": "sha512-iLhmprRmWI8EcosOA3wVvww22z02NkgqhV4fBH6f/odQBsi7xnJc0HGmi21yWO+/iKw2yzqVE127Zhna5/+JXw==",
+ "license": "MIT",
+ "dependencies": {
+ "zod": "^4.2.0"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@modelcontextprotocol/server": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/@modelcontextprotocol/server/-/server-2.2.0.tgz",
+ "integrity": "sha512-qFnltjus6Gk8Lx6J1w2RXmr3YPN22MNT6qD6zjAkaiWIlFIFxWClz0rXHNuJF/KSUyn5YGhkSvXkWDbQHVLFEQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@modelcontextprotocol/core": "2.2.0",
+ "zod": "^4.2.0"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@openrouter/ai-sdk-provider": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/@openrouter/ai-sdk-provider/-/ai-sdk-provider-3.1.0.tgz",
+ "integrity": "sha512-BQy1TA9fKrh47s9ivsO6FY5QimN7GUF0i8Qon3pkxQclEgShso0dClpcWn8OIyPLEZZPFaFKgI8TW4S/O0p0Dw==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "ai": "^7.0.0",
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/@standard-schema/spec": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",
+ "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
+ "license": "MIT"
+ },
+ "node_modules/@types/chai": {
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",
+ "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/deep-eql": "*",
+ "assertion-error": "^2.0.1"
+ }
+ },
+ "node_modules/@types/deep-eql": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",
+ "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",
+ "license": "MIT"
+ },
+ "node_modules/@vercel/oidc": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/@vercel/oidc/-/oidc-3.2.0.tgz",
+ "integrity": "sha512-UycprH3T6n3jH0k44NHMa7pnFHGu/N05MjojYr+Mc6I7obkoLIJujSWwin1pCvdy/eOxrI/l3uDLQsmcrOb4ug==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">= 20"
+ }
+ },
+ "node_modules/@vitest/expect": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-5.0.2.tgz",
+ "integrity": "sha512-pd6YDkhOHptwC65NYNpGpNxWlJH9M9Gxwtej73osTddb1NpiE0Jz5CIjTTEGXRgK0YtiSN7qBokmBXZ5uPJL1w==",
+ "license": "MIT",
+ "dependencies": {
+ "@standard-schema/spec": "^1.1.0",
+ "@types/chai": "^5.2.2",
+ "@vitest/spy": "5.0.2",
+ "@vitest/utils": "5.0.2",
+ "chai": "^6.2.2",
+ "tinyrainbow": "^3.1.1"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/pretty-format": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-5.0.2.tgz",
+ "integrity": "sha512-YHM+mQQ7N1ROHMugJ7P/M+fC/q1G4zs/iAMZZCvhHcY8WkwPQcXBHD+z18oz+808Cfa12K7jOr3XPQMcLIovjw==",
+ "license": "MIT",
+ "dependencies": {
+ "tinyrainbow": "^3.1.1"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/spy": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.2.tgz",
+ "integrity": "sha512-Ijc7T1nT9efNb5LxvjaBrEqw3f/QwUv5EE0nKqZxgqsaV/FxAAZ8baGylA8X/Z2oS4Lp+K74Jr6dTJsDKxJDeg==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/utils": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-5.0.2.tgz",
+ "integrity": "sha512-mgpUtxFhKeOKVaArBVHNJGdYHAeRh135o59l13uVmPUCS1OUtis5pBqXEgE25iqRgFqEBwXvJlkhknRsYnMeqg==",
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/pretty-format": "5.0.2",
+ "convert-source-map": "^2.0.0",
+ "tinyrainbow": "^3.1.1"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@workflow/serde": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/@workflow/serde/-/serde-4.1.0.tgz",
+ "integrity": "sha512-pav4F2BoirECWR7Nf1TKt+2eETcBj7jj4cBefQ8VXQCA6NPkaKeLfj/zMgi+3zYV5ZIBT4GuUiphsj0/b9hPQQ==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/agent-device": {
+ "version": "0.21.20",
+ "resolved": "https://registry.npmjs.org/agent-device/-/agent-device-0.21.20.tgz",
+ "integrity": "sha512-nD2QNRTbQo3mMEnpOTqgguIreY98lri+VfWBo0Njzc+CLBrISHApUJD2Cs2P8zfzvZCvbGibX1D+LP/B/qeQrQ==",
+ "license": "MIT",
+ "bin": {
+ "agent-device": "bin/agent-device.mjs"
+ },
+ "engines": {
+ "node": ">=22.12"
+ },
+ "peerDependencies": {
+ "ai": "^6.0.0 || ^7.0.0"
+ },
+ "peerDependenciesMeta": {
+ "ai": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/ai": {
+ "version": "7.0.163",
+ "resolved": "https://registry.npmjs.org/ai/-/ai-7.0.163.tgz",
+ "integrity": "sha512-nm8+qn36NQXO4Hjfj7SlbcNRhUyNXKtdoS9xhXr/z92lvdGFuPkzHmA2tFzhaUQy13IitNYrcw2QSNpEJC/iSA==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/gateway": "4.0.136",
+ "@ai-sdk/provider": "4.0.36",
+ "@ai-sdk/provider-utils": "5.0.75"
+ },
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/ai/node_modules/@ai-sdk/provider": {
+ "version": "4.0.36",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.36.tgz",
+ "integrity": "sha512-GqvWZSZdBelCGughlBdOoupT258rgM3YMbaLAS9WSZJ0vlt8c9vm3My+ZT31mYhiReMCMCF2qF2axnGbILpk1A==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "json-schema": "^0.4.0"
+ },
+ "engines": {
+ "node": ">=22"
+ }
+ },
+ "node_modules/ai/node_modules/@ai-sdk/provider-utils": {
+ "version": "5.0.75",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-5.0.75.tgz",
+ "integrity": "sha512-k4yAsFliGZwoTpyTpm3ptxwIeaPvRh5vGh/UWoqDiLLXKoyz4zuBGS7p3ygf8to5Bh4fAOHynotLBsWLIYdu2A==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/provider": "4.0.36",
+ "@standard-schema/spec": "^1.1.0",
+ "@workflow/serde": "4.1.0",
+ "eventsource-parser": "^3.0.8",
+ "undici": "^7.29.1"
+ },
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/assertion-error": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/chai": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz",
+ "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/commander": {
+ "version": "15.0.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-15.0.0.tgz",
+ "integrity": "sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=22.12.0"
+ }
+ },
+ "node_modules/convert-source-map": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
+ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
+ "license": "MIT"
+ },
+ "node_modules/e2e": {
+ "version": "0.17.0",
+ "resolved": "https://registry.npmjs.org/e2e/-/e2e-0.17.0.tgz",
+ "integrity": "sha512-Q8pgMUgp0wY7f5Zs2w0CLmFr1s95rdYyIquEFH8sjU7dYOTSVzvq/xkXCO2FVZFHdcgeO4mvFkdMg+7NyNG+LA==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/provider": "4.0.18",
+ "@clack/prompts": "1.8.1",
+ "@modelcontextprotocol/server": "2.2.0",
+ "@vitest/expect": "5.0.2",
+ "commander": "15.0.0",
+ "picocolors": "1.1.1",
+ "pngjs": "7.0.0",
+ "tsx": "4.23.14",
+ "zod": "4.6.1"
+ },
+ "bin": {
+ "e2e": "dist/cli/bin.js"
+ },
+ "engines": {
+ "node": ">=22.12.0"
+ },
+ "peerDependencies": {
+ "@ai-sdk/anthropic": "^4.0.0",
+ "@ai-sdk/google": "^4.0.0",
+ "@ai-sdk/openai": "^4.0.0",
+ "@ai-sdk/openai-compatible": "^3.0.0",
+ "@ai-sdk/xai": "^5.0.0",
+ "ai": "^7.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@ai-sdk/anthropic": {
+ "optional": true
+ },
+ "@ai-sdk/google": {
+ "optional": true
+ },
+ "@ai-sdk/openai": {
+ "optional": true
+ },
+ "@ai-sdk/openai-compatible": {
+ "optional": true
+ },
+ "@ai-sdk/xai": {
+ "optional": true
+ },
+ "ai": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/e2e/node_modules/@ai-sdk/provider": {
+ "version": "4.0.18",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.18.tgz",
+ "integrity": "sha512-+GZJIgz1jk86pwEbb3f1BD2bdoSKyWE4Jg4YUc7NMnMozbWemSKYZcw2F4nMaO5qwsL5A8RmioAKW81YktRpIQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "json-schema": "^0.4.0"
+ },
+ "engines": {
+ "node": ">=22"
+ }
+ },
+ "node_modules/e2e/node_modules/zod": {
+ "version": "4.6.1",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.1.tgz",
+ "integrity": "sha512-341aRWQsve0rvronKNTqZpjmzdbUDlFuzHaI/XLg/Ej82qffDJRRfBTCuv7+9q/rMjB6LSLyEBnW4InJeMtt/Q==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
+ },
+ "node_modules/esbuild": {
+ "version": "0.28.2",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz",
+ "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.28.2",
+ "@esbuild/android-arm": "0.28.2",
+ "@esbuild/android-arm64": "0.28.2",
+ "@esbuild/android-x64": "0.28.2",
+ "@esbuild/darwin-arm64": "0.28.2",
+ "@esbuild/darwin-x64": "0.28.2",
+ "@esbuild/freebsd-arm64": "0.28.2",
+ "@esbuild/freebsd-x64": "0.28.2",
+ "@esbuild/linux-arm": "0.28.2",
+ "@esbuild/linux-arm64": "0.28.2",
+ "@esbuild/linux-ia32": "0.28.2",
+ "@esbuild/linux-loong64": "0.28.2",
+ "@esbuild/linux-mips64el": "0.28.2",
+ "@esbuild/linux-ppc64": "0.28.2",
+ "@esbuild/linux-riscv64": "0.28.2",
+ "@esbuild/linux-s390x": "0.28.2",
+ "@esbuild/linux-x64": "0.28.2",
+ "@esbuild/netbsd-arm64": "0.28.2",
+ "@esbuild/netbsd-x64": "0.28.2",
+ "@esbuild/openbsd-arm64": "0.28.2",
+ "@esbuild/openbsd-x64": "0.28.2",
+ "@esbuild/openharmony-arm64": "0.28.2",
+ "@esbuild/sunos-x64": "0.28.2",
+ "@esbuild/win32-arm64": "0.28.2",
+ "@esbuild/win32-ia32": "0.28.2",
+ "@esbuild/win32-x64": "0.28.2"
+ }
+ },
+ "node_modules/eventsource-parser": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.1.1.tgz",
+ "integrity": "sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
+ "node_modules/fast-string-truncated-width": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/fast-string-truncated-width/-/fast-string-truncated-width-3.0.3.tgz",
+ "integrity": "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==",
+ "license": "MIT"
+ },
+ "node_modules/fast-string-width": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/fast-string-width/-/fast-string-width-3.0.2.tgz",
+ "integrity": "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==",
+ "license": "MIT",
+ "dependencies": {
+ "fast-string-truncated-width": "^3.0.2"
+ }
+ },
+ "node_modules/fast-wrap-ansi": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/fast-wrap-ansi/-/fast-wrap-ansi-0.2.2.tgz",
+ "integrity": "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==",
+ "license": "MIT",
+ "dependencies": {
+ "fast-string-width": "^3.0.2"
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/json-schema": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
+ "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==",
+ "license": "(AFL-2.1 OR BSD-3-Clause)"
+ },
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
+ "license": "ISC"
+ },
+ "node_modules/pngjs": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-7.0.0.tgz",
+ "integrity": "sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.19.0"
+ }
+ },
+ "node_modules/sisteransi": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
+ "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==",
+ "license": "MIT"
+ },
+ "node_modules/tinyrainbow": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.2.0.tgz",
+ "integrity": "sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "node_modules/tsx": {
+ "version": "4.23.14",
+ "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.23.14.tgz",
+ "integrity": "sha512-yFwMnbAsUFz/T3kR8P2ENc/DDUaYd9tKg4oVYo0lhkX0LlK4UuqYAO6mpQ2y6lmcyip1uPJ34C2kPACopDwG4w==",
+ "license": "MIT",
+ "dependencies": {
+ "esbuild": "~0.28.0"
+ },
+ "bin": {
+ "tsx": "dist/cli.mjs"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ }
+ },
+ "node_modules/undici": {
+ "version": "7.30.2",
+ "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.2.tgz",
+ "integrity": "sha512-mLyPQnHwUxaM/rideoK/+KL8DaAJLRl4aBCfmX444aCSLnIaomqPLtNRe2jdCYcsk5wZzXrDIQC8ZeYNRAYyIA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=20.18.1"
+ }
+ },
+ "node_modules/zod": {
+ "version": "4.6.7",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
+ "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
+ }
+ }
+}
diff --git a/packages/runtimes/e2e/package.json b/packages/runtimes/e2e/package.json
new file mode 100644
index 00000000..60278fff
--- /dev/null
+++ b/packages/runtimes/e2e/package.json
@@ -0,0 +1,19 @@
+{
+ "name": "@mobile-dev/e2e-runtime",
+ "version": "0.1.0",
+ "private": true,
+ "description": "Pinned zero-setup e2e Studio runtime.",
+ "type": "module",
+ "dependencies": {
+ "@ai-sdk/anthropic": "4.0.58",
+ "@ai-sdk/google": "4.0.77",
+ "@ai-sdk/openai": "4.0.109",
+ "@ai-sdk/openai-compatible": "3.0.53",
+ "@ai-sdk/xai": "5.0.4",
+ "@e2e-dev/mobile": "0.9.2",
+ "@openrouter/ai-sdk-provider": "3.1.0",
+ "ai": "7.0.163",
+ "e2e": "0.17.0",
+ "zod": "4.6.7"
+ }
+}
diff --git a/packages/runtimes/e2e/release.json b/packages/runtimes/e2e/release.json
new file mode 100644
index 00000000..7c42994f
--- /dev/null
+++ b/packages/runtimes/e2e/release.json
@@ -0,0 +1,56 @@
+{
+ "schemaVersion": 1,
+ "packages": {
+ "@ai-sdk/anthropic": {
+ "version": "4.0.58",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/anthropic/-/anthropic-4.0.58.tgz",
+ "integrity": "sha512-vhXKBz7jnIhBlOoj2d0joyHicWISuIxDNha65SLrAnagAkVgulLoZBRLZRazstxlO/BtXU+cDERe1opVKte2OQ=="
+ },
+ "@ai-sdk/google": {
+ "version": "4.0.77",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/google/-/google-4.0.77.tgz",
+ "integrity": "sha512-7s1Gy6PL/KRk12s31g+LMMY5v1D80AQT6Lm+HUGXvCXw5T5WCxzbUuxOrBegXhhLPfIXTRunkYgSIjcRys37Zw=="
+ },
+ "@ai-sdk/openai": {
+ "version": "4.0.109",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/openai/-/openai-4.0.109.tgz",
+ "integrity": "sha512-N20L44ztSicqEWpB0LfV54Ee1iq6IjGfOFTcRfeTD/bRH0v/VDI1uHve7RFOhP2oi1eAluliBhgmurplaOBuVw=="
+ },
+ "@ai-sdk/openai-compatible": {
+ "version": "3.0.53",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/openai-compatible/-/openai-compatible-3.0.53.tgz",
+ "integrity": "sha512-uOeghHYcF+CHP/dOCAtdfKesuKLKqDFtkq79bJFNSx4YOqpiP734TdJAZDA8KIWH7mdGNQ0a4N9238HG4FN2Rg=="
+ },
+ "@ai-sdk/xai": {
+ "version": "5.0.4",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/xai/-/xai-5.0.4.tgz",
+ "integrity": "sha512-Cg3xUB0H6OA4fvcX+uamkZXuzxdjhi7HH15glxpE8boZUijFmfz3YPM3Y/HvQkuCb6D/ixCe7lpcwVjidLhw9w=="
+ },
+ "@e2e-dev/mobile": {
+ "version": "0.9.2",
+ "resolved": "https://registry.npmjs.org/@e2e-dev/mobile/-/mobile-0.9.2.tgz",
+ "integrity": "sha512-aY09M1ckxtezydmTI6/R72R/RVuwZn42+phGekQLCkZWID1EXNQi19+leYyyZJWdH4p+E2EVgYm4k8EcilYM0Q=="
+ },
+ "@openrouter/ai-sdk-provider": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/@openrouter/ai-sdk-provider/-/ai-sdk-provider-3.1.0.tgz",
+ "integrity": "sha512-BQy1TA9fKrh47s9ivsO6FY5QimN7GUF0i8Qon3pkxQclEgShso0dClpcWn8OIyPLEZZPFaFKgI8TW4S/O0p0Dw=="
+ },
+ "ai": {
+ "version": "7.0.163",
+ "resolved": "https://registry.npmjs.org/ai/-/ai-7.0.163.tgz",
+ "integrity": "sha512-nm8+qn36NQXO4Hjfj7SlbcNRhUyNXKtdoS9xhXr/z92lvdGFuPkzHmA2tFzhaUQy13IitNYrcw2QSNpEJC/iSA=="
+ },
+ "e2e": {
+ "version": "0.17.0",
+ "resolved": "https://registry.npmjs.org/e2e/-/e2e-0.17.0.tgz",
+ "integrity": "sha512-Q8pgMUgp0wY7f5Zs2w0CLmFr1s95rdYyIquEFH8sjU7dYOTSVzvq/xkXCO2FVZFHdcgeO4mvFkdMg+7NyNG+LA=="
+ },
+ "zod": {
+ "version": "4.6.7",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
+ "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg=="
+ }
+ },
+ "lockfileSHA256": "fd430a6a7dde84a49d42c1763e3498a538895ca82a73f3e3b61ac555ce371edf"
+}
diff --git a/packages/ui/src/components/testing-view.tsx b/packages/ui/src/components/testing-view.tsx
index 90d6e925..9681efa7 100644
--- a/packages/ui/src/components/testing-view.tsx
+++ b/packages/ui/src/components/testing-view.tsx
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";
-import { BotIcon, CheckIcon, ChevronDownIcon, ChevronRightIcon, CircleIcon, CircleXIcon, CopyIcon, FileCode2Icon, FilePlus2Icon, FlaskConicalIcon, FolderOpenIcon, GripVerticalIcon, HistoryIcon, LoaderCircleIcon, MoreHorizontalIcon, PlayIcon, SaveIcon, SquareIcon, Trash2Icon, UserIcon, XIcon } from "lucide-react";
+import { BotIcon, CheckIcon, ChevronDownIcon, ChevronRightIcon, CircleIcon, CircleXIcon, CopyIcon, ExternalLinkIcon, FileCode2Icon, FilePlus2Icon, FlaskConicalIcon, FolderOpenIcon, GripVerticalIcon, HistoryIcon, LoaderCircleIcon, MoreHorizontalIcon, PlayIcon, SaveIcon, Settings2Icon, SquareIcon, Trash2Icon, UserIcon, WandSparklesIcon, XIcon } from "lucide-react";
import type { DeviceAppsStore } from "../device-apps.ts";
-import type { TestingPanel } from "../testing-panel.ts";
+import type { TestingModelPreference, TestingPanel, TestingSetupOperation, TestingSetupOptions } from "../testing-panel.ts";
import { OPEN_STEP, formatRunDuration, testRecorder } from "../test-recorder.ts";
import type { DevicePlatform, TestRunView } from "../test-recorder.ts";
import { isRecordableDevice, recordablePlatform } from "@mobile-dev/shared/panel-target.ts";
@@ -242,6 +242,110 @@ function TestingDraftPicker({ panel }: { panel: TestingPanel }) {
;
}
+function useOperation(panel: TestingPanel, initial: TestingSetupOperation | null, onDone?: (operation: TestingSetupOperation) => void) {
+ const [operation, setOperation] = useState(initial);
+ useEffect(() => {
+ if (!operation || (operation.status !== "running" && operation.status !== "waiting")) return;
+ const timer = setInterval(() => { void panel.setupProgress(operation.id).then(next => {
+ if (!next) return;
+ setOperation(next);
+ if (["succeeded", "failed", "cancelled"].includes(next.status)) onDone?.(next);
+ }).catch(() => undefined); }, 500);
+ return () => clearInterval(timer);
+ }, [panel, operation?.id, operation?.status, onDone]);
+ return [operation, setOperation] as const;
+}
+
+/** Provider/model selection for the first bundled agent step. No key or token enters this view. */
+function TestingModelPicker({ panel }: { panel: TestingPanel }) {
+ const state = useSyncExternalStore(panel.subscribe, panel.getSnapshot);
+ const choices = (state.providers ?? []).filter(entry => entry.id !== "none");
+ const initial: TestingModelPreference | undefined = state.modelPreference ?? (() => {
+ const first = choices[0];
+ return first ? { provider: first.id as TestingModelPreference["provider"], model: first.defaultModel ?? "" } : undefined;
+ })();
+ const [provider, setProvider] = useState(initial?.provider ?? "chatgpt");
+ const choice = choices.find(entry => entry.id === provider);
+ const [model, setModel] = useState(initial?.model ?? choice?.defaultModel ?? "");
+ const [endpoint, setEndpoint] = useState(initial?.endpoint ?? "");
+ const [login, setLogin] = useOperation(panel, null);
+ const [answer, setAnswer] = useState("");
+ const startLogin = async () => {
+ if (!choice?.subscription) return;
+ setLogin(await panel.startLogin(choice.subscription));
+ };
+ return open ? panel.openModelPicker() : panel.closeModelPicker()}>
+
+
+
Choose a model for agent steps
Deterministic steps never use a model. This saves only the provider, model and endpoint—not credentials or prompts.
}
+
+ ;
+}
+
/**
* The Testing tool: choose an e2e project, launch its app on the mirrored device, then record a
* deterministic test by tapping the mirror.
@@ -262,8 +366,8 @@ export function TestingView({ panel, deviceApps }: { panel: TestingPanel; device
// Why the recorder cannot start yet, in the order the user has to fix them.
const blocker = !state.projectPath ? "Choose a project to record against."
: state.loadingProject ? ""
- : state.targets.length === 0 ? "No targets found in this project's e2e config."
- : !target?.bundleId ? `Target "${target?.name}" declares no bundleId, so there is no app to launch.`
+ : state.targets.length === 0 ? "No mobile app identifier was found. Open the app in the mirror, or use Set up project to enter one."
+ : !target?.bundleId ? `Target "${target?.name}" has no app identifier. Enter one in Set up project.`
: !booted ? "Boot an iOS simulator or Android emulator to record against it."
: !isRecordableDevice(device) ? "Recording works on an iOS simulator or an Android emulator, not a physical device."
: mismatch;
@@ -277,6 +381,9 @@ export function TestingView({ panel, deviceApps }: { panel: TestingPanel; device
}
+ {state.projectPath && {state.runtimeMode === "project" ? "Project runtime" : "Bundled runtime"}}
+ {state.runtimeMode === "bundled" && state.projectPath && }
+ {state.projectPath && }
{/* Before the controls, so the `ml-auto` below has one thing to push away from and the
status does not end up marooned past the right edge of the group. */}
{state.loadingProject && Reading config…}
@@ -291,6 +398,8 @@ export function TestingView({ panel, deviceApps }: { panel: TestingPanel; device
}
+ {state.projectWarning && {state.runtimeMode === "bundled" ? "Zero-setup mode" : "Testing"}{state.projectWarning} Tests saved here stay in Mobile Dev until you opt into project setup.}
+
{blocker && !state.agent?.active &&
{blocker}
}
diff --git a/packages/ui/src/testing-panel.ts b/packages/ui/src/testing-panel.ts
index a7a52b23..a8453a9b 100644
--- a/packages/ui/src/testing-panel.ts
+++ b/packages/ui/src/testing-panel.ts
@@ -60,6 +60,10 @@ const DRAFT_AUTOSAVE_MS = 700;
export interface TestingProjectOption { path: string; name: string }
/** A target as the project's e2e config declares it; a static read may not see every field. */
export interface TestingTargetOption { name: string; platform?: string; bundleId?: string }
+export type TestingModelPreference = { provider: "vercel" | "openrouter" | "openai-compatible" | "chatgpt" | "copilot" | "opencode-console" | "grok"; model: string; endpoint?: string };
+export type TestingProviderOption = { id: string; label: string; subscription?: string; defaultModel?: string };
+export type TestingSetupOptions = { targets: { name: string; platform: "ios" | "android"; bundleId: string }[]; provider: TestingModelPreference["provider"] | "none"; model?: string; endpoint?: string; installDependencies: boolean; installSkill: boolean; registerMcp: boolean };
+export type TestingSetupOperation = { id: string; kind: "apply" | "login"; status: "running" | "waiting" | "succeeded" | "failed" | "cancelled"; message: string; completed: number; total: number; applied: string[]; auth?: { url: string; instructions: string; userCode?: string }; prompt?: { message: string; placeholder?: string } };
export type TestingSnapshot = {
open: boolean;
@@ -70,6 +74,14 @@ export type TestingSnapshot = {
/** The target the panel records against; "" until a project with targets is loaded. */
targetName: string;
configPath: string;
+ runtimeMode: "project" | "bundled";
+ setupState: "configured" | "available";
+ targetSource: "project" | "expo-cli" | "static-expo" | "foreground" | "none";
+ projectWarning: string;
+ modelPreference?: TestingModelPreference;
+ providers: TestingProviderOption[];
+ modelPickerOpen: boolean;
+ setupOpen: boolean;
loadingProject: boolean;
pickingProject: boolean;
launching: boolean;
@@ -149,7 +161,7 @@ export class TestingPanel {
/** The project and target the installed tree source reads; "" when there is no source. */
private treeSourceKey = "";
private snapshot: TestingSnapshot = {
- open: false, available: false, projectPath: "", projects: [], targets: [], targetName: "", configPath: "",
+ open: false, available: false, projectPath: "", projects: [], targets: [], targetName: "", configPath: "", runtimeMode: "bundled", setupState: "available", targetSource: "none", projectWarning: "", providers: [], modelPickerOpen: false, setupOpen: false,
loadingProject: false, pickingProject: false, launching: false, appLaunched: false,
fileName: "", saving: false, overwritePath: "", savedRevision: -1, savedPath: "", running: false, pendingRun: false,
agent: null, drafts: [], draftId: "", loadingDraft: false, tests: [], selectedTestPath: "", selectedTestSource: "", selectedTestOriginalHash: "", selectedTestStaged: false, loadingTest: false, deletingTest: "", error: null,
@@ -187,7 +199,11 @@ export class TestingPanel {
this.deviceApps = deviceApps;
// The device is half of what an agent recording needs and it belongs to the simulator panel,
// so the selection is reported whenever either half moves.
- this.stopWatchingDevices = deviceApps.subscribe(() => { void this.reportContext(); });
+ this.stopWatchingDevices = deviceApps.subscribe(() => {
+ void this.reportContext();
+ if (this.snapshot.projectPath && this.snapshot.runtimeMode === "bundled" && this.snapshot.targets.length === 0
+ && deviceApps.getSnapshot().foregroundApp?.bundleId) void this.selectProject(this.snapshot.projectPath);
+ });
// Every change to what would be written bumps the recorder's revision, which is exactly the
// thing worth keeping, so one subscription covers recording, editing, dragging and the title.
this.stopWatchingRecorder = testRecorder.subscribe(() => { this.scheduleDraft(); });
@@ -249,6 +265,18 @@ export class TestingPanel {
};
}
+ /** A host may advertise a preselection through configuration; host names never select behavior. */
+ private hostModelDefault(): TestingModelPreference | undefined {
+ const capabilities = this.app.getHostCapabilities() as unknown as Record | undefined;
+ const configuration = object(capabilities?.configuration) ?? object(object(capabilities?.experimental)?.mobileDev);
+ const testing = object(configuration?.testing);
+ const candidate = object(testing?.defaultModel);
+ const provider = text(candidate?.provider) as TestingModelPreference["provider"];
+ const model = text(candidate?.model);
+ if (!provider || !model || !["vercel", "openrouter", "openai-compatible", "chatgpt", "copilot", "opencode-console", "grok"].includes(provider)) return;
+ return { provider, model, ...(text(candidate?.endpoint) ? { endpoint: text(candidate?.endpoint) } : {}) };
+ }
+
private async call(name: string, arguments_: Record, timeout = 30000) {
const result = await this.app.callServerTool({ name, arguments: arguments_ }, { timeout });
if (result.isError) throw textError(result, `${name} failed.`);
@@ -384,14 +412,17 @@ export class TestingPanel {
clearTimeout(this.draftTimer);
this.draftRevision = testRecorder.getSnapshot().revision;
this.draftFlowId = "";
- this.update({ projectPath: path, targets: [], targetName: "", configPath: "", appLaunched: false,
+ this.update({ projectPath: path, targets: [], targetName: "", configPath: "", runtimeMode: "bundled", setupState: "available", targetSource: "none", projectWarning: "", appLaunched: false,
overwritePath: "", savedRevision: -1, savedPath: "", draftId: "", drafts: [], tests: [], error: null });
void this.refreshDrafts();
void this.refreshTests();
if (!path || !this.snapshot.available) return;
this.update({ loadingProject: true });
try {
- const response = await this.call("mobile_testing_project_config", { projectPath: path });
+ const device = this.deviceApps.getSnapshot().device;
+ const foregroundBundleId = this.deviceApps.getSnapshot().foregroundApp?.bundleId ?? undefined;
+ const foregroundPlatform = device && isRecordableDevice(device) ? recordablePlatform(device) : undefined;
+ const response = await this.call("mobile_testing_project_config", { projectPath: path, ...(foregroundPlatform && foregroundBundleId ? { foregroundPlatform, foregroundBundleId } : {}) });
if (revision !== this.loadRevision) return;
const data = object(response.structuredContent) ?? {};
const listed = Array.isArray(data.targets) ? data.targets : [];
@@ -404,9 +435,11 @@ export class TestingPanel {
}));
// The target on the mirrored device's platform, so a project with both records against the
// right one without being asked; else the first, which `targetMismatch` then reports on.
- const device = this.deviceApps.getSnapshot().device;
const preferred = (device ? targets.find(entry => entry.platform === recordablePlatform(device)) : undefined) ?? targets[0];
- this.update({ targets, targetName: preferred?.name ?? "", configPath: text(data.configPath) });
+ const preference = object(data.modelPreference);
+ const modelPreference = preference && text(preference.provider) && text(preference.model) ? { provider: text(preference.provider) as TestingModelPreference["provider"], model: text(preference.model), ...(text(preference.endpoint) ? { endpoint: text(preference.endpoint) } : {}) } : this.hostModelDefault();
+ const providers = (Array.isArray(data.providers) ? data.providers : []).map(entry => object(entry)).filter((entry): entry is Record => entry !== null).map(entry => ({ id: text(entry.id), label: text(entry.label), ...(text(entry.subscription) ? { subscription: text(entry.subscription) } : {}), ...(text(entry.defaultModel) ? { defaultModel: text(entry.defaultModel) } : {}) })).filter(entry => entry.id && entry.label);
+ this.update({ targets, targetName: preferred?.name ?? "", configPath: text(data.configPath), runtimeMode: data.runtimeMode === "project" ? "project" : "bundled", setupState: data.setupState === "configured" ? "configured" : "available", targetSource: ["project", "expo-cli", "static-expo", "foreground"].includes(text(data.targetSource)) ? text(data.targetSource) as TestingSnapshot["targetSource"] : "none", projectWarning: text(data.warning), ...(modelPreference ? { modelPreference } : {}), providers });
} catch (error) {
if (revision === this.loadRevision) this.update({ error: error instanceof Error ? error.message : String(error) });
} finally {
@@ -420,6 +453,36 @@ export class TestingPanel {
this.update({ targetName: name, appLaunched: false });
}
+ openSetup() { this.update({ setupOpen: true }); }
+ closeSetup() { this.update({ setupOpen: false }); }
+ openModelPicker() { this.update({ modelPickerOpen: true }); }
+ closeModelPicker() { this.update({ modelPickerOpen: false }); }
+
+ async saveModelPreference(preference?: TestingModelPreference) {
+ await this.call("mobile_testing_model_preference", { ...(preference ? { preference } : {}) });
+ this.update({ modelPreference: preference, modelPickerOpen: false });
+ countUiEvent("ui.testing.model_preference");
+ }
+
+ async planSetup(options: TestingSetupOptions) {
+ const response = await this.call("mobile_testing_setup_plan", { projectPath: this.snapshot.projectPath, options }, 60_000);
+ return object(object(response.structuredContent)?.plan);
+ }
+ async applySetup(planId: string) {
+ const response = await this.call("mobile_testing_setup_apply", { planId }, 30_000);
+ return object(object(response.structuredContent)?.operation) as TestingSetupOperation | null;
+ }
+ async setupProgress(operationId: string) {
+ const response = await this.call("mobile_testing_setup_progress", { operationId }, 10_000);
+ return object(object(response.structuredContent)?.operation) as TestingSetupOperation | null;
+ }
+ async cancelSetup(operationId: string) { await this.call("mobile_testing_setup_cancel", { operationId }); }
+ async startLogin(provider: string) {
+ const response = await this.call("mobile_testing_setup_login", { provider }, 30_000);
+ return object(object(response.structuredContent)?.operation) as TestingSetupOperation | null;
+ }
+ async answerLogin(operationId: string, value: string) { await this.call("mobile_testing_setup_answer", { operationId, value }); }
+
/**
* Launches the selected target's app on the mirrored device, so recording starts from the app
* the generated test will open. It does not build: an app that is not installed fails here, and
@@ -995,12 +1058,31 @@ export class TestingPanel {
&& !this.snapshot.loadingTest && !this.snapshot.agent?.active && !this.snapshot.running && !this.snapshot.saving);
}
+ private bundledRunArguments() {
+ if (this.snapshot.runtimeMode !== "bundled") return {};
+ const target = this.target;
+ return {
+ ...(target?.platform === "ios" || target?.platform === "android" ? { platform: target.platform } : {}),
+ ...(target?.bundleId ? { bundleId: target.bundleId } : {}),
+ ...(this.snapshot.modelPreference ? { model: this.snapshot.modelPreference } : {}),
+ };
+ }
+
+ /** Deterministic tests stay model-free; an agent step opens the chooser before any run starts. */
+ private hasBundledModel(source: string): boolean {
+ if (this.snapshot.runtimeMode !== "bundled" || !/\bagent\s*\.\s*(act|assert|waitFor|extract)\s*\(/.test(source)) return true;
+ if (this.snapshot.modelPreference) return true;
+ this.update({ modelPickerOpen: true });
+ return false;
+ }
+
/** Runs a temporary sibling copy so Play and Run never save the working copy implicitly. */
async runStoredTest(untilLine?: number) {
if (!this.canRunStored) return;
const { projectPath, selectedTestPath: relativePath, selectedTestSource: source } = this.snapshot;
const untilSource = untilLine === undefined ? source : storedTestUntilSource(source, untilLine);
if (untilSource === undefined) return;
+ if (!this.hasBundledModel(untilSource)) return;
this.update({ running: true, error: null });
testRecorder.clearRun();
testRecorder.beginRun(untilLine);
@@ -1017,6 +1099,7 @@ export class TestingPanel {
projectPath, relativePath, untilSource,
...(this.snapshot.configPath ? { configPath: this.snapshot.configPath } : {}),
...(this.snapshot.targetName ? { target: this.snapshot.targetName } : {}),
+ ...this.bundledRunArguments(),
}, 15 * 60_000);
const data = object(response.structuredContent) ?? {};
const steps = (Array.isArray(data.steps) ? data.steps : []).map(entry => object(entry))
@@ -1068,6 +1151,7 @@ export class TestingPanel {
const until = options.untilStepId ? testRecorder.emittedThrough(options.untilStepId) : undefined;
// The step went while the pointer was on its play button; there is nothing to run up to.
if (options.untilStepId && !until) return;
+ if (!this.hasBundledModel(until?.source ?? testRecorder.source)) return;
if (!until && (this.dirty || !this.snapshot.savedPath)) {
await this.saveTest();
// The file is already there and the user has not answered yet; `saveTest(true)` resumes.
@@ -1097,6 +1181,7 @@ export class TestingPanel {
...(this.snapshot.configPath ? { configPath: this.snapshot.configPath } : {}),
...(this.snapshot.targetName ? { target: this.snapshot.targetName } : {}),
...(until ? { untilSource: until.source } : {}),
+ ...this.bundledRunArguments(),
}, 15 * 60_000);
const data = object(response.structuredContent) ?? {};
const steps = (Array.isArray(data.steps) ? data.steps : []).map(entry => object(entry))
diff --git a/tooling/build.mjs b/tooling/build.mjs
index c6b1cd84..f72932f2 100644
--- a/tooling/build.mjs
+++ b/tooling/build.mjs
@@ -102,6 +102,19 @@ await writeFile("dist/agent-device/release.json", JSON.stringify({
}, null, 2) + "\n");
// The commands the plugin servers register without starting the runtime (npm run catalog:agent-device).
await copyFile(`${runtime}/tools.json`, "dist/agent-device/tools.json");
+const e2eRuntime = "packages/runtimes/e2e";
+const e2eLock = await readFile(`${e2eRuntime}/package-lock.json`, "utf8");
+const e2eRelease = JSON.parse(await readFile(`${e2eRuntime}/release.json`, "utf8"));
+if (createHash("sha256").update(e2eLock).digest("hex") !== e2eRelease.lockfileSHA256)
+ throw new Error("Run npm run vendor:e2e after changing the pinned e2e runtime.");
+for (const name of Object.keys(e2eRelease.packages ?? {})) {
+ const installed = JSON.parse(await readFile(`${e2eRuntime}/node_modules/${name}/package.json`, "utf8"));
+ if (installed.version !== e2eRelease.packages[name]?.version)
+ throw new Error(`Run npm run vendor:e2e: ${name} does not match release.json.`);
+}
+await cp(`${e2eRuntime}/node_modules`, "dist/e2e/node_modules", { recursive: true, verbatimSymlinks: true });
+for (const file of ["package.json", "package-lock.json", "release.json", "THIRD_PARTY_NOTICES.txt"])
+ await copyFile(`${e2eRuntime}/${file}`, `dist/e2e/${file}`);
await buildServeEmu("dist/serve-emu");
// The host-neutral runtime: the shared server, its services and the MCP Apps panel
// as hosts without their own chrome load it. A host that adds to them builds its
diff --git a/tooling/dependency-lanes.mjs b/tooling/dependency-lanes.mjs
index 1c80a634..03e97754 100644
--- a/tooling/dependency-lanes.mjs
+++ b/tooling/dependency-lanes.mjs
@@ -7,8 +7,8 @@
* so the later lanes rebuild only their own.
*/
export const dependencyLanes = [
- { name: "js", label: "npm packages, device runtimes and GitHub Actions", groups: ["npm", "agent-device", "serve-emu", "github-actions"],
- commands: ["npm ci --no-audit --no-fund", "npm run vendor:agent-device", "npm run catalog:agent-device", "npm run vendor:serve-emu"] },
+ { name: "js", label: "npm packages, device runtimes and GitHub Actions", groups: ["npm", "agent-device", "e2e", "serve-emu", "github-actions"],
+ commands: ["npm ci --no-audit --no-fund", "npm run vendor:agent-device", "npm run catalog:agent-device", "npm run vendor:e2e", "npm run vendor:serve-emu"] },
{ name: "sentry-native", label: "sentry-native", helpers: "all" },
{ name: "baguette", label: "Baguette", helpers: ["baguette"] },
{ name: "libimobiledevice", label: "libimobiledevice", helpers: ["ios-logs"] },
@@ -28,7 +28,7 @@ export function laneHelpers(lane, helperNames) {
return lane.helpers ?? [];
}
-const groups = { npm: "npm", "agent-device": "agent-device runtime", "serve-emu": "serve-emu runtime", "github-actions": "GitHub Actions", native: "Native", forked: "Forks and vendored sources" };
+const groups = { npm: "npm", "agent-device": "agent-device runtime", e2e: "e2e Studio runtime", "serve-emu": "serve-emu runtime", "github-actions": "GitHub Actions", native: "Native", forked: "Forks and vendored sources" };
/** Markdown tables of applied and held-back updates. */
export function renderUpdates(updates, { apply = true, cargoChanges = 0 } = {}) {
diff --git a/tooling/host-runtime.mjs b/tooling/host-runtime.mjs
index f1d74d59..4556ebb8 100644
--- a/tooling/host-runtime.mjs
+++ b/tooling/host-runtime.mjs
@@ -20,6 +20,8 @@ const RUNTIME_FILES = [
"android-cpu/LICENSE", "serve-emu/src/cli.mjs", "serve-emu/vendor/scrcpy-server-v4.0",
"agent-device/node_modules/agent-device/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj",
"agent-device/tools.json",
+ "e2e/node_modules/e2e/dist/cli/bin.js", "e2e/node_modules/@e2e-dev/mobile/dist/nodes.js",
+ "e2e/package-lock.json", "e2e/release.json", "e2e/THIRD_PARTY_NOTICES.txt",
"resource-saving/simslim", "resource-saving/avdslim", "resource-saving/simslim-LICENSE", "resource-saving/avdslim-LICENSE", "resource-saving/release.json",
];
diff --git a/tooling/test/e2e-runtime-package.test.ts b/tooling/test/e2e-runtime-package.test.ts
new file mode 100644
index 00000000..d3b18e1b
--- /dev/null
+++ b/tooling/test/e2e-runtime-package.test.ts
@@ -0,0 +1,27 @@
+import assert from "node:assert/strict";
+import { createHash } from "node:crypto";
+import { readFile } from "node:fs/promises";
+import test from "node:test";
+import { PANEL_PARTS } from "../host-runtime.mjs";
+
+test("the release metadata pins every bundled e2e runtime dependency", async () => {
+ const root = "packages/runtimes/e2e";
+ const manifest = JSON.parse(await readFile(`${root}/package.json`, "utf8"));
+ const lockSource = await readFile(`${root}/package-lock.json`, "utf8");
+ const lock = JSON.parse(lockSource);
+ const release = JSON.parse(await readFile(`${root}/release.json`, "utf8"));
+
+ assert.equal(release.lockfileSHA256, createHash("sha256").update(lockSource).digest("hex"));
+ assert.deepEqual(Object.keys(release.packages).sort(), Object.keys(manifest.dependencies).sort());
+ for (const name of Object.keys(manifest.dependencies)) {
+ assert.equal(release.packages[name].version, lock.packages[`node_modules/${name}`].version);
+ assert.match(release.packages[name].integrity, /^sha512-/);
+ }
+});
+
+test("the bundled e2e runtime ships notices and is not panel-only", async () => {
+ const notices = await readFile("packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt", "utf8");
+ assert.ok(notices.length > 10_000);
+ assert.match(notices, /e2e 0\.17\.0/);
+ assert.equal(PANEL_PARTS.includes("e2e"), false);
+});
diff --git a/tooling/update-dependencies.mjs b/tooling/update-dependencies.mjs
index ee6ae25e..ba30cbe0 100644
--- a/tooling/update-dependencies.mjs
+++ b/tooling/update-dependencies.mjs
@@ -91,8 +91,8 @@ if (wants("js")) {
for (const path of workspaceManifests) workspaceChanged = updateManifest(path, "npm").changed || workspaceChanged;
if (workspaceChanged) run("npm", ["install", "--no-audit", "--no-fund"], { stdio: "inherit", env: { ...process.env, HUSKY: "0" } });
- // The device runtimes ship their own lockfiles; build.mjs checks agent-device against its manifest.
- for (const runtime of ["packages/runtimes/agent-device", "packages/runtimes/serve-emu"]) {
+ // The device runtimes ship their own lockfiles; build.mjs checks them against release metadata.
+ for (const runtime of ["packages/runtimes/agent-device", "packages/runtimes/e2e", "packages/runtimes/serve-emu"]) {
const path = `${runtime}/package.json`;
const { manifest, changed } = updateManifest(path, runtime.split("/").pop());
if (!changed) continue;
diff --git a/tooling/vendor-e2e.mjs b/tooling/vendor-e2e.mjs
new file mode 100644
index 00000000..5feb382d
--- /dev/null
+++ b/tooling/vendor-e2e.mjs
@@ -0,0 +1,39 @@
+import { execFileSync } from "node:child_process";
+import { createHash } from "node:crypto";
+import { readFile, readdir, writeFile } from "node:fs/promises";
+import { join } from "node:path";
+
+const runtime = "packages/runtimes/e2e";
+execFileSync("npm", ["install", "--prefix", runtime, "--ignore-scripts", "--no-audit", "--no-fund", "--package-lock-only=false"], { stdio: "inherit" });
+
+const lock = await readFile(join(runtime, "package-lock.json"), "utf8");
+const packages = JSON.parse(lock).packages;
+const notices = [];
+for (const [key, metadata] of Object.entries(packages)) {
+ if (!key.startsWith("node_modules/")) continue;
+ const name = key.slice("node_modules/".length);
+ // Nested transitive packages are represented by another /node_modules/ segment. Their license
+ // is still included, but the lock entry's path is the unambiguous package label.
+ if (!name || name.includes("/node_modules/")) continue;
+ const directory = join(runtime, key);
+ const files = await readdir(directory).catch(() => []);
+ for (const file of files.filter(name => /^(LICENSE|LICENCE|COPYING|NOTICE)(\.|$)/i.test(name))) {
+ const license = (await readFile(join(directory, file), "utf8"))
+ .replace(/\r\n/g, "\n")
+ .split("\n")
+ .map(line => line.trimEnd())
+ .join("\n")
+ .trimEnd();
+ notices.push(`${name} ${metadata.version ?? "unknown"} (${file})\n\n${license}`);
+ }
+}
+await writeFile(join(runtime, "THIRD_PARTY_NOTICES.txt"), notices.sort().join("\n\n====================\n\n") + "\n");
+await writeFile(join(runtime, "release.json"), JSON.stringify({
+ schemaVersion: 1,
+ packages: Object.fromEntries(Object.keys(packages[""]?.dependencies ?? {}).sort().map(name => {
+ const entry = packages[`node_modules/${name}`];
+ return [name, { version: entry.version, resolved: entry.resolved, integrity: entry.integrity }];
+ })),
+ lockfileSHA256: createHash("sha256").update(lock).digest("hex"),
+}, null, 2) + "\n");
+console.log("Installed and indexed the pinned e2e Studio runtime.");
From 67097e7445f23bb9a1709dc44cef9f002fe117ac Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Mon, 16 Nov 2026 15:24:33 +0500
Subject: [PATCH 02/23] fix: issues
---
docs/testing-panel.md | 19 +++-
packages/core/src/testing-projects.ts | 4 +-
packages/core/src/testing-run.ts | 49 ++++++++-
packages/core/src/testing-setup.ts | 116 ++++++++++++++++++--
packages/core/src/testing-tools.ts | 12 +-
packages/core/test/testing-panel-ui.test.ts | 69 ++++++++++++
packages/core/test/testing-projects.test.ts | 20 ++++
packages/core/test/testing-run.test.ts | 25 ++---
packages/core/test/testing-setup.test.ts | 63 ++++++++++-
packages/ui/src/components/testing-view.tsx | 68 +++++++++---
packages/ui/src/host-bridge.ts | 1 +
packages/ui/src/testing-panel.ts | 73 ++++++++----
packages/ui/test/testing-panel.test.ts | 84 ++++++++++----
13 files changed, 509 insertions(+), 94 deletions(-)
diff --git a/docs/testing-panel.md b/docs/testing-panel.md
index 5467cc7f..ed27d6c4 100644
--- a/docs/testing-panel.md
+++ b/docs/testing-panel.md
@@ -16,14 +16,23 @@ and Android targets are retained when known and are editable in the setup wizard
Deterministic tests use no model. The first bundled run containing `agent.act`, `agent.assert`,
`agent.waitFor` or `agent.extract` opens the provider/model chooser. Subscription sign-in is driven by
E2E's OAuth callbacks; Mobile Dev persists only the non-secret provider, model id and optional endpoint.
+Subscription status is read from E2E 0.17's own `$XDG_CONFIG_HOME/e2e/oauth.json` (or
+`~/.config/e2e/oauth.json`) as provider-id booleans; Mobile Dev neither copies nor exposes tokens or
+account data. A user-initiated Sign in opens the callback URL through the host's link capability and
+keeps the visible link as fallback. Completed and cancelled flows clear callback links and prompts.
Hosts may preselect a choice only through advertised `configuration.mobileDev.testing.defaultModel` (or
the equivalent experimental capability); no host-name branch exists.
-**Set up project** is the opt-in GUI equivalent of `e2e init`: targets and provider are editable, then
+Bundled/unconfigured projects offer **Set up project**, the opt-in GUI equivalent of `e2e init`:
+target names, platforms, identifiers and provider are editable, then
an immutable plan lists every create/update/skip action. Apply revalidates the plan for stale files,
preserves existing configs/tests/skills/MCP entries, uses the detected package manager, reports progress,
supports cancellation and reports partial failures without pretending already-written files were rolled
-back. Setup is the only zero-setup Studio path that writes configuration into the selected project.
+back. MCP registration is preselected and previews both `.mcp.json` and `.cursor/mcp.json`, preserving
+all other servers. Configured projects instead show read-only **E2E configuration** details—effective
+targets/config, statically discoverable model, dependency versions, skill state and MCP registrations—
+with mutations behind a separate **Update setup** action. Setup is the only zero-setup Studio path that
+writes configuration into the selected project.
Status: Android emulators are supported alongside iOS simulators — the device is identified by
`deviceId` plus an explicit `platform`, and the e2e run is pinned with `--target`. The Android path
@@ -124,8 +133,10 @@ source calls can be reordered, duplicated or changed to compatible commands. Eac
temporary working copy, not the project file. Save writes the working copy to the original path
and removes it; Undo removes the working copy and reloads the original. Save refuses if the
original changed on disk after the copy was opened. Each playable call keeps a visible Play icon
-beside its source line. Play runs a temporary sibling of the source,
-so neither a full run nor Play until here saves pending edits. The current recording stays intact
+beside its source line. Run and Play until here mirror the project into an isolated temporary root,
+stage the exact current preview at its original relative path, preserve source-line mapping, and remove
+the root when the runner exits. Neither action saves pending edits or creates a temporary project file.
+The current recording stays intact
and can be reopened from Not stored.
Both deletes **ask first**, in a popover hanging off the trash icon. A draft's steps cannot be
diff --git a/packages/core/src/testing-projects.ts b/packages/core/src/testing-projects.ts
index be99691f..b00c7306 100644
--- a/packages/core/src/testing-projects.ts
+++ b/packages/core/src/testing-projects.ts
@@ -304,14 +304,14 @@ export async function resolveTestPath(projectPath: string, relativePath: string)
* the tool boundary prevents a crafted app call from turning the runner into an arbitrary module
* loader while leaving `runRecordedTest` independently usable by its lower-level tests.
*/
-export async function resolveTestRunPaths(projectPath: string, relativePath: string, configPath?: string): Promise<{
+export async function resolveTestRunPaths(projectPath: string, relativePath: string, configPath?: string, previewSource = false): Promise<{
projectPath: string;
relativePath: string;
configPath?: string;
}> {
const { project, root } = await testStorage(projectPath);
const testPath = await resolveTestPath(root, relativePath);
- if (!(await isFile(testPath))) throw new ExpectedOperationError("invalid_input", "That test file is no longer there.");
+ if (!previewSource && !(await isFile(testPath))) throw new ExpectedOperationError("invalid_input", "That test file is no longer there.");
if (configPath !== undefined) {
const requestedConfig = normalize(configPath.trim());
if (!isAbsolute(requestedConfig) || !same(resolve(requestedConfig), resolve(project.configPath)))
diff --git a/packages/core/src/testing-run.ts b/packages/core/src/testing-run.ts
index cb37552f..b5450240 100644
--- a/packages/core/src/testing-run.ts
+++ b/packages/core/src/testing-run.ts
@@ -1,6 +1,6 @@
import { spawn } from "node:child_process";
import { existsSync } from "node:fs";
-import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from "node:fs/promises";
+import { mkdir, mkdtemp, readFile, readdir, rm, symlink, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { pathToFileURL } from "node:url";
@@ -171,15 +171,21 @@ const PROGRESS_TAG = "@@mobile-dev-step ";
* happens inside `onEvent`, which must also never throw and never block. A tagged line on stderr
* needs no socket, no temp output file and no cleanup beyond this config itself.
*/
-export function progressConfigSource(configPath: string): string {
+export function progressConfigSource(configPath: string, projectRoot?: string): string {
return [
`// Generated by the mobile-dev Testing panel for one run, then deleted. Do not edit or commit.`,
`import base from ${JSON.stringify(pathToFileURL(configPath).href)};`,
+ ...(projectRoot ? [`import { isAbsolute, resolve as resolvePath } from "node:path";`] : []),
``,
`const resolved = typeof base === "function" ? await base() : base;`,
+ ...(projectRoot ? [
+ `const projectRoot = ${JSON.stringify(projectRoot)};`,
+ `const targets = resolved.targets?.map(target => target?.app?.command ? { ...target, app: { ...target.app, command: { ...target.app.command, cwd: target.app.command.cwd === undefined ? projectRoot : isAbsolute(target.app.command.cwd) ? target.app.command.cwd : resolvePath(projectRoot, target.app.command.cwd) } } } : target);`,
+ ] : []),
``,
`export default {`,
` ...resolved,`,
+ ...(projectRoot ? [` targets,`] : []),
` reporters: [`,
` ...(resolved.reporters ?? []),`,
` {`,
@@ -240,9 +246,9 @@ export interface TestRunRequest {
* the later steps and nothing else removed, so every line it keeps is still at the line number
* it has in the file: the report's lines land on the preview's lines with no translation, and
* `EmittedTest.calls` indexes the same way because the truncated call list is a prefix of the
- * full one. It is written beside the real test for one run and removed when the run ends — a
- * sibling rather than a temp directory because the test is discovered through the project's own
- * patterns (`tests/**`) and imports resolve from where it sits.
+ * full one. Project-mode previews run at the same relative path inside an isolated temporary
+ * mirror, so the project's discovery patterns and imports keep working without writing into the
+ * selected project.
*/
untilSource?: string;
/** The e2e target to run against; without it the runner takes the config's first, whatever platform that is. */
@@ -349,6 +355,7 @@ function refusedTheConfig(result: TestRunResult): boolean {
export async function runRecordedTest(request: TestRunRequest, deps: TestRunDeps = {}): Promise {
if (request.runtime?.mode === "bundled") return runBundledTest(request, deps);
+ if (request.untilSource !== undefined) return runProjectPreview(request, deps);
const result = await runOnce(request, deps);
if (!refusedTheConfig(result) || !request.configPath || !deps.onProgress) return result;
// Without the progress sink nothing is generated, so this is the plain run.
@@ -358,6 +365,38 @@ export async function runRecordedTest(request: TestRunRequest, deps: TestRunDeps
return retried.steps.length > 0 || retried.status !== result.status ? retried : result;
}
+/** Mirrors the project with symlinks while reserving the preview test and config as real temp files. */
+async function mirrorProject(source: string, destination: string, reserved: Set, relativePath = ""): Promise {
+ await mkdir(destination, { recursive: true, mode: 0o700 });
+ for (const entry of await readdir(source, { withFileTypes: true })) {
+ const childRelative = relativePath ? `${relativePath}/${entry.name}` : entry.name;
+ if (reserved.has(childRelative) || childRelative === ".e2e") continue;
+ const hasReservedChild = [...reserved].some(path => path.startsWith(`${childRelative}/`));
+ const from = join(source, entry.name), to = join(destination, entry.name);
+ if (entry.isDirectory() && hasReservedChild) await mirrorProject(from, to, reserved, childRelative);
+ else await symlink(from, to, entry.isDirectory() ? "dir" : "file");
+ }
+}
+
+/** Runs the exact preview from an isolated temp root; the selected project remains read-only. */
+async function runProjectPreview(request: TestRunRequest, deps: TestRunDeps): Promise {
+ if (!request.configPath || request.untilSource === undefined) throw new ExpectedOperationError("invalid_input", "Open the project's e2e config before running this preview.");
+ const bin = runnerBin(request.projectPath);
+ await deps.release?.();
+ const workspace = await mkdtemp(join(tmpdir(), "mobile-dev-e2e-preview-"));
+ const configName = "e2e.config.mts";
+ try {
+ await mirrorProject(request.projectPath, workspace, new Set([request.relativePath, configName]));
+ await mkdir(dirname(join(workspace, request.relativePath)), { recursive: true, mode: 0o700 });
+ await writeFile(join(workspace, request.relativePath), request.untilSource, { mode: 0o600 });
+ await writeFile(join(workspace, configName), progressConfigSource(request.configPath, request.projectPath), { mode: 0o600 });
+ return await spawnRun({ command: bin, cwd: workspace, runPath: request.relativePath, configName,
+ target: request.target, timeoutMs: request.timeoutMs, spawner: deps.spawner ?? spawn, onProgress: deps.onProgress });
+ } finally {
+ await rm(workspace, { recursive: true, force: true });
+ }
+}
+
function quoted(value: string): string { return JSON.stringify(value); }
function bundledModelSource(model: TestRunRequest["model"]): { imports: string[]; field: string } | undefined {
diff --git a/packages/core/src/testing-setup.ts b/packages/core/src/testing-setup.ts
index c03bf528..7ccf9414 100644
--- a/packages/core/src/testing-setup.ts
+++ b/packages/core/src/testing-setup.ts
@@ -46,6 +46,16 @@ export type SetupPlan = {
type InternalPlan = SetupPlan & { writes: PlannedWrite[]; observed: Record; skillLink?: { path: string; target: string } };
export type TestingModelPreference = { provider: BundledModelProvider; model: string; endpoint?: string };
+export type TestingLoginStatus = Record<"openai" | "github-copilot" | "opencode-console" | "spacexai", boolean>;
+export type TestingSetupInspection = {
+ provider?: SetupProvider;
+ model?: string;
+ endpoint?: string;
+ dependencies: { e2e?: string; mobile?: string };
+ skillInstalled: boolean;
+ mcpRegistrations: string[];
+ loginStatus: TestingLoginStatus;
+};
const PREFERENCE_FILE = join(TESTING_DIRECTORY, "model-preference.json");
function hash(value: string | Buffer): string { return createHash("sha256").update(value).digest("hex"); }
@@ -58,6 +68,78 @@ async function fileHash(path: string): Promise {
function cleanText(value: string | undefined): string | undefined { const next = value?.trim(); return next ? next : undefined; }
function provider(id: SetupProvider) { return SETUP_PROVIDERS.find(entry => entry.id === id); }
+const SUBSCRIPTION_IDS = ["openai", "github-copilot", "opencode-console", "spacexai"] as const;
+
+/** Reads only provider ids from e2e's own credential store. Tokens and account data never leave it. */
+export async function readTestingLoginStatus(): Promise {
+ const status = Object.fromEntries(SUBSCRIPTION_IDS.map(id => [id, false])) as TestingLoginStatus;
+ try {
+ const module = await import(pathToFileURL(join(bundledE2eRoot(), "node_modules/e2e/dist/oauth/store.js")).href) as {
+ defaultCredentialStore(): { list(): Promise };
+ };
+ const stored = new Set(await module.defaultCredentialStore().list());
+ for (const id of SUBSCRIPTION_IDS) status[id] = stored.has(id);
+ } catch { /* A missing or damaged store is safely reported as signed out. */ }
+ return status;
+}
+
+function detectedModel(source: string): Pick {
+ const choices: { provider: SetupProvider; pattern: RegExp }[] = [
+ { provider: "chatgpt", pattern: /\bchatgpt\s*\(\s*["'`]([^"'`]+)["'`]/ },
+ { provider: "copilot", pattern: /\bcopilot\s*\(\s*["'`]([^"'`]+)["'`]/ },
+ { provider: "opencode-console", pattern: /\bopencodeConsole\s*\(\s*["'`]([^"'`]+)["'`]/ },
+ { provider: "grok", pattern: /\bgrok\s*\(\s*["'`]([^"'`]+)["'`]/ },
+ { provider: "vercel", pattern: /\bgateway\s*\(\s*["'`]([^"'`]+)["'`]/ },
+ { provider: "openrouter", pattern: /\bopenrouter\s*\(\s*["'`]([^"'`]+)["'`]/ },
+ ];
+ for (const choice of choices) {
+ const match = source.match(choice.pattern);
+ if (match) return { provider: choice.provider, model: match[1] };
+ }
+ const compatible = source.match(/createOpenAICompatible\s*\([\s\S]*?baseURL\s*:\s*["'`]([^"'`]+)["'`][\s\S]*?chatModel\s*\(\s*["'`]([^"'`]+)["'`]/);
+ return compatible ? { provider: "openai-compatible", endpoint: compatible[1], model: compatible[2] } : {};
+}
+
+async function dependencyVersion(root: string, name: string, manifest: Record): Promise {
+ const installed = await readFile(join(root, "node_modules", name, "package.json"), "utf8").then(value => JSON.parse(value).version as unknown, () => undefined).catch(() => undefined);
+ if (typeof installed === "string") return installed;
+ for (const field of ["dependencies", "devDependencies"] as const) {
+ const entries = manifest[field];
+ if (entries && typeof entries === "object" && typeof (entries as Record)[name] === "string") return (entries as Record)[name];
+ }
+}
+
+function hasE2eRegistration(value: unknown): boolean {
+ if (!value || typeof value !== "object") return false;
+ const servers = (value as Record).mcpServers;
+ return Boolean(servers && typeof servers === "object" && (servers as Record).e2e);
+}
+
+/** Read-only effective setup shown for an already configured project. */
+export async function inspectTestingSetup(root: string, configPath?: string): Promise {
+ const manifest = await readFile(join(root, "package.json"), "utf8").then(value => JSON.parse(value) as Record, () => ({})).catch(() => ({}));
+ const source = configPath ? await readFile(configPath, "utf8").catch(() => "") : "";
+ const [e2eVersion, mobileVersion] = await Promise.all([
+ dependencyVersion(root, "e2e", manifest),
+ dependencyVersion(root, "@e2e-dev/mobile", manifest),
+ ]);
+ const mcpRegistrations: string[] = [];
+ for (const relativePath of [".mcp.json", ".cursor/mcp.json"]) {
+ const registered = await readFile(join(root, relativePath), "utf8").then(value => hasE2eRegistration(JSON.parse(value)), () => false).catch(() => false);
+ if (registered) mcpRegistrations.push(relativePath);
+ }
+ return {
+ ...detectedModel(source),
+ dependencies: {
+ ...(e2eVersion ? { e2e: e2eVersion } : {}),
+ ...(mobileVersion ? { mobile: mobileVersion } : {}),
+ },
+ skillInstalled: await lstat(join(root, ".agents/skills/e2e/SKILL.md")).then(value => value.isFile(), () => false),
+ mcpRegistrations,
+ loginStatus: await readTestingLoginStatus(),
+ };
+}
+
export async function readTestingModelPreference(): Promise {
try {
const parsed = JSON.parse(await readFile(PREFERENCE_FILE, "utf8")) as Partial;
@@ -145,9 +227,11 @@ export async function planTestingSetup(projectPath: string, input: SetupOptions)
const root = resolve(projectPath.trim());
if (!isAbsolute(projectPath.trim()) || !(await lstat(root).then(value => value.isDirectory(), () => false))) throw new ExpectedOperationError("invalid_input", "Choose an existing project folder.");
if (!provider(input.provider)) throw new ExpectedOperationError("invalid_input", "Choose a provider supported by the bundled e2e runtime.");
- const targets = input.targets.map(target => ({ ...target, name: target.name.trim(), bundleId: target.bundleId.trim() }))
- .filter(target => target.name && target.bundleId);
+ const targets = input.targets.map(target => ({ ...target, name: target.name.trim(), bundleId: target.bundleId.trim() }));
if (targets.length === 0) throw new ExpectedOperationError("invalid_input", "Add at least one iOS or Android target.");
+ if (targets.some(target => !target.name)) throw new ExpectedOperationError("invalid_input", "Every target needs a name.");
+ if (targets.some(target => !target.bundleId)) throw new ExpectedOperationError("invalid_input", "Every target needs an app identifier.");
+ if (new Set(targets.map(target => target.name)).size !== targets.length) throw new ExpectedOperationError("invalid_input", "Target names must be unique.");
if (input.provider === "openai-compatible") {
const endpoint = new URL(cleanText(input.endpoint) ?? "http://127.0.0.1:11434/v1");
if (endpoint.protocol !== "https:" && !(endpoint.protocol === "http:" && ["127.0.0.1", "localhost", "::1"].includes(endpoint.hostname))) throw new ExpectedOperationError("invalid_input", "Use HTTPS unless the model endpoint is loopback.");
@@ -188,13 +272,14 @@ export async function planTestingSetup(projectPath: string, input: SetupOptions)
else for (const file of await skillFiles()) await add(join(".agents/skills/e2e", file.relative), file.content, "skill");
}
if (options.registerMcp) {
- const mcpPath = join(root, ".mcp.json");
- const source = await readFile(mcpPath, "utf8").catch(() => "{}");
- let mcp: Record;
- try { mcp = JSON.parse(source); } catch { throw new ExpectedOperationError("invalid_input", "Fix .mcp.json before registering the e2e server."); }
- const servers = mcp.mcpServers && typeof mcp.mcpServers === "object" ? mcp.mcpServers as Record : {};
- if (servers.e2e) actions.push({ action: "skip", path: ".mcp.json", detail: "Existing e2e MCP registration is preserved." });
- else await add(".mcp.json", JSON.stringify({ ...mcp, mcpServers: { ...servers, e2e: { command: "npx", args: ["e2e", "mcp"] } } }, null, 2) + "\n");
+ for (const relativePath of [".mcp.json", ".cursor/mcp.json"]) {
+ const source = await readFile(join(root, relativePath), "utf8").catch(() => "{}");
+ let mcp: Record;
+ try { mcp = JSON.parse(source); } catch { throw new ExpectedOperationError("invalid_input", `Fix ${relativePath} before registering the e2e server.`); }
+ const servers = mcp.mcpServers && typeof mcp.mcpServers === "object" ? mcp.mcpServers as Record : {};
+ if (servers.e2e) actions.push({ action: "skip", path: relativePath, detail: "Existing e2e MCP registration is preserved." });
+ else await add(relativePath, JSON.stringify({ ...mcp, mcpServers: { ...servers, e2e: { command: "npx", args: ["e2e", "mcp"] } } }, null, 2) + "\n");
+ }
}
const manager = packageManager(root, manifest);
const installCommand = manager === "npm" ? "npm install" : `${manager} install`;
@@ -227,7 +312,15 @@ function publicOperation(operation: InternalOperation): SetupOperation {
return result;
}
export function testingSetupProgress(id: string): SetupOperation | undefined { const operation = operations.get(id); return operation ? publicOperation(operation) : undefined; }
-export function cancelTestingSetup(id: string): boolean { const operation = operations.get(id); if (!operation || !["running", "waiting"].includes(operation.status)) return false; operation.abort.abort(); operation.status = "cancelled"; operation.message = "Cancelled."; operation.answer?.(""); return true; }
+export function cancelTestingSetup(id: string): boolean {
+ const operation = operations.get(id);
+ if (!operation || !["running", "waiting"].includes(operation.status)) return false;
+ const answer = operation.answer;
+ operation.abort.abort(); operation.status = "cancelled"; operation.message = "Cancelled.";
+ operation.auth = undefined; operation.prompt = undefined; operation.answer = undefined;
+ answer?.("");
+ return true;
+}
export function answerTestingSetup(id: string, value: string): boolean { const operation = operations.get(id); if (!operation?.answer) return false; const answer = operation.answer; operation.answer = undefined; operation.prompt = undefined; operation.status = "running"; answer(value); return true; }
async function atomicWrite(write: PlannedWrite): Promise {
@@ -294,9 +387,10 @@ export function startTestingLogin(id: OAuthProvider, runLogin: LoginRunner = e2e
onProgress: (message: string) => { operation.message = message; },
onPrompt: (prompt: { message: string; placeholder?: string }) => new Promise(resolvePrompt => { operation.prompt = prompt; operation.answer = resolvePrompt; operation.status = "waiting"; operation.message = prompt.message; }),
});
- operation.status = "succeeded"; operation.completed = 1; operation.prompt = undefined; operation.message = "Signed in.";
+ operation.status = "succeeded"; operation.completed = 1; operation.prompt = undefined; operation.auth = undefined; operation.message = "Signed in.";
} catch (error) {
operation.status = operation.abort.signal.aborted ? "cancelled" : "failed";
+ operation.prompt = undefined; operation.auth = undefined;
operation.message = operation.abort.signal.aborted ? "Sign-in cancelled." : error instanceof Error ? error.message : String(error);
}
})();
diff --git a/packages/core/src/testing-tools.ts b/packages/core/src/testing-tools.ts
index 96f58006..b8b0aaa1 100644
--- a/packages/core/src/testing-tools.ts
+++ b/packages/core/src/testing-tools.ts
@@ -15,7 +15,7 @@ import { runRecordedTest } from "./testing-run.ts";
import type { TestRunProgress } from "./testing-run.ts";
import { deviceIdSchema } from "@mobile-dev/shared/panel-target.ts";
import type { BundledModelProvider } from "./testing-run.ts";
-import { answerTestingSetup, applyTestingSetup, cancelTestingSetup, planTestingSetup, readTestingModelPreference, saveTestingModelPreference, SETUP_PROVIDERS, startTestingLogin, testingSetupProgress } from "./testing-setup.ts";
+import { answerTestingSetup, applyTestingSetup, cancelTestingSetup, inspectTestingSetup, planTestingSetup, readTestingModelPreference, saveTestingModelPreference, SETUP_PROVIDERS, startTestingLogin, testingSetupProgress } from "./testing-setup.ts";
import type { SetupOptions } from "./testing-setup.ts";
const read = { readOnlyHint: true, destructiveHint: false, openWorldHint: false };
@@ -232,12 +232,14 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
inputSchema: { projectPath, foregroundPlatform: z.enum(["ios", "android"]).optional(), foregroundBundleId: z.string().min(1).max(512).optional() },
annotations: read,
_meta: appVisibility,
- }, safe(async ({ projectPath: selected, foregroundPlatform, foregroundBundleId }: { projectPath: string; foregroundPlatform?: "ios" | "android"; foregroundBundleId?: string }) =>
- dataResult({ ...await inspectProject(selected, foregroundPlatform && foregroundBundleId ? { platform: foregroundPlatform, bundleId: foregroundBundleId } : undefined), modelPreference: await readTestingModelPreference(), providers: SETUP_PROVIDERS })));
+ }, safe(async ({ projectPath: selected, foregroundPlatform, foregroundBundleId }: { projectPath: string; foregroundPlatform?: "ios" | "android"; foregroundBundleId?: string }) => {
+ const project = await inspectProject(selected, foregroundPlatform && foregroundBundleId ? { platform: foregroundPlatform, bundleId: foregroundBundleId } : undefined);
+ return dataResult({ ...project, setup: await inspectTestingSetup(project.path, project.configPath || undefined), modelPreference: await readTestingModelPreference(), providers: SETUP_PROVIDERS });
+ }));
const setupTarget = z.object({ name: z.string().min(1).max(128), platform: z.enum(["ios", "android"]), bundleId: z.string().min(1).max(512) });
const setupOptions = z.object({
- targets: z.array(setupTarget).min(1).max(8),
+ targets: z.array(setupTarget).min(1).max(100),
provider: z.enum(["none", "vercel", "openrouter", "openai-compatible", "chatgpt", "copilot", "opencode-console", "grok"]),
model: z.string().max(256).optional(), endpoint: z.string().max(2048).optional(),
installDependencies: z.boolean(), installSkill: z.boolean(), registerMcp: z.boolean(),
@@ -324,7 +326,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
running = true;
try {
const project = await inspectProject(selected, platform && bundleId ? { platform, bundleId } : undefined);
- const paths = await resolveTestRunPaths(selected, relativePath, project.runtimeMode === "project" ? configPath : undefined);
+ const paths = await resolveTestRunPaths(selected, relativePath, project.runtimeMode === "project" ? configPath : undefined, untilSource !== undefined);
const selectedTarget = project.targets.find(entry => entry.name === target)
?? project.targets.find(entry => entry.platform === platform && (!bundleId || entry.bundleId === bundleId))
?? project.targets[0];
diff --git a/packages/core/test/testing-panel-ui.test.ts b/packages/core/test/testing-panel-ui.test.ts
index 5b5b3f4a..2f1c3168 100644
--- a/packages/core/test/testing-panel-ui.test.ts
+++ b/packages/core/test/testing-panel-ui.test.ts
@@ -148,6 +148,8 @@ test("a run marks the preview line by line, and marks nothing it was not told ab
let panelState: Record = {
open: true, available: true, projectPath: "/app", projects: [], targets: [{ name: "ios", platform: "ios", bundleId: "com.app" }],
targetName: "ios", configPath: "/app/e2e.config.ts", loadingProject: false, pickingProject: false, launching: false,
+ runtimeMode: "project", setupState: "configured", setupDetails: { dependencies: {}, skillInstalled: false, mcpRegistrations: [], loginStatus: {} },
+ providers: [], modelPickerOpen: false, setupOpen: false, targetSource: "project", projectWarning: "",
appLaunched: true, fileName: "flow", saving: false, overwritePath: "", savedRevision: -1, savedPath: "", running: false,
pendingRun: false, drafts: [], draftId: "", loadingDraft: false, tests: [], deletingTest: "", error: null,
};
@@ -565,6 +567,8 @@ function panelStub(overrides: Record = {}) {
const state: Record = {
open: true, available: true, projectPath: "/app", projects: [], targets: [{ name: "ios", platform: "ios", bundleId: "com.app" }],
targetName: "ios", configPath: "/app/e2e.config.ts", loadingProject: false, pickingProject: false, launching: false,
+ runtimeMode: "project", setupState: "configured", setupDetails: { dependencies: {}, skillInstalled: false, mcpRegistrations: [], loginStatus: {} },
+ providers: [], modelPickerOpen: false, setupOpen: false, targetSource: "project", projectWarning: "",
appLaunched: true, fileName: "flow", saving: false, overwritePath: "", savedRevision: -1, savedPath: "", running: false,
pendingRun: false, agent: null, drafts: [], draftId: "", loadingDraft: false, tests: [], deletingTest: "", error: null,
...overrides,
@@ -578,6 +582,7 @@ function panelStub(overrides: Record = {}) {
setFileName: () => {}, cancelOverwrite: () => {}, dismissError: () => {},
refreshDrafts: async () => {}, openDraft: async () => {}, deleteDraft: async () => {}, newRecording: async () => {},
refreshTests: async () => {}, openTest: async () => {}, editStoredTest: () => {}, saveStoredTest: async () => {}, undoStoredTest: async () => {}, runStoredTest: async () => {}, deleteTest: async () => {},
+ openSetup: () => {}, closeSetup: () => {}, openModelPicker: () => {}, closeModelPicker: () => {}, planSetup: async () => null, applySetup: async () => null,
};
}
@@ -748,6 +753,70 @@ test("the list keeps what is not stored above what the project holds, and asks b
testRecorder.clearSteps();
});
+test("bundled tests are labeled In Studio and configured projects show read-only setup", async t => {
+ const { module: { TestingView }, dom, onTeardown } = await renderEnvironment(t, {
+ exports: 'export { TestingView } from "./packages/ui/src/components/testing-view.tsx";', slug: "testing-setup-modes",
+ });
+ const { act, createElement } = await import("react");
+ const { createRoot } = await import("react-dom/client");
+ const root = createRoot(dom.window.document.getElementById("root")!);
+ const deviceApps = { subscribe: () => () => undefined, getSnapshot: () => DEVICE_SNAPSHOT };
+ const configured = panelStub({ setupOpen: true, setupDetails: {
+ provider: "chatgpt", model: "gpt-6-luna", dependencies: { e2e: "0.17.0", mobile: "0.9.2" },
+ skillInstalled: true, mcpRegistrations: [".mcp.json", ".cursor/mcp.json"], loginStatus: { openai: true },
+ } });
+ await act(async () => { root.render(createElement(TestingView, { panel: configured, deviceApps })); });
+ assert.match(dom.window.document.body.textContent ?? "", /E2E configuration/);
+ assert.match(dom.window.document.body.textContent ?? "", /chatgpt · gpt-6-luna/);
+ assert.match(dom.window.document.body.textContent ?? "", /\.mcp\.json, \.cursor\/mcp\.json/);
+ assert.doesNotMatch(dom.window.document.body.textContent ?? "", /Set up project/);
+ await act(async () => { root.render(createElement("div")); });
+ await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
+
+ const bundled = panelStub({ runtimeMode: "bundled", setupState: "available", setupOpen: false,
+ tests: [{ relativePath: "tests/studio.e2e.ts", name: "studio.e2e.ts", updatedAt: "2026-01-01T00:00:00.000Z", sizeBytes: 10 }] });
+ await act(async () => { root.render(createElement(TestingView, { panel: bundled, deviceApps })); });
+ await act(async () => { (dom.window.document.querySelector("[data-testing-drafts]") as HTMLElement).click(); });
+ assert.match(dom.window.document.querySelector("[data-testing-group=stored]")?.textContent ?? "", /In Studio/);
+ await act(async () => { root.render(createElement("div")); });
+ await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
+ onTeardown(async () => { await act(async () => { root.unmount(); }); });
+});
+
+test("async project data prefills model and every discovered setup target", async t => {
+ const { module: { TestingView }, dom, onTeardown } = await renderEnvironment(t, {
+ exports: 'export { TestingView } from "./packages/ui/src/components/testing-view.tsx";', slug: "testing-async-setup",
+ });
+ const { act, createElement } = await import("react");
+ const { createRoot } = await import("react-dom/client");
+ const root = createRoot(dom.window.document.getElementById("root")!);
+ const opened: string[] = [];
+ const panel = { ...panelStub({ runtimeMode: "bundled", setupState: "available", setupOpen: true, modelPickerOpen: true,
+ modelPreference: { provider: "chatgpt", model: "gpt-6-luna" },
+ setupDetails: { dependencies: {}, skillInstalled: false, mcpRegistrations: [], loginStatus: { openai: true } },
+ providers: [{ id: "none", label: "None" }, { id: "chatgpt", label: "ChatGPT", subscription: "openai", defaultModel: "gpt-default" }],
+ targets: [
+ { name: "ios", platform: "ios", bundleId: "com.anonymous.expoapp57" },
+ { name: "android", platform: "android", bundleId: "com.anonymous.expoapp57" },
+ ],
+ }), startLogin: async () => ({ id: "11111111-1111-4111-8111-111111111111", kind: "login", status: "waiting", message: "Open the browser", completed: 0, total: 1, applied: [], auth: { url: "https://auth.example.test/start", instructions: "Open the browser" } }),
+ openLoginUrl: async (url: string) => { opened.push(url); }, setupProgress: async () => null, cancelSetup: async () => {} };
+ await act(async () => { root.render(createElement(TestingView, { panel, deviceApps: { subscribe: () => () => undefined, getSnapshot: () => DEVICE_SNAPSHOT } })); });
+ const identifiers = [...dom.window.document.querySelectorAll('[aria-label$="app identifier"]')] as HTMLInputElement[];
+ assert.deepEqual(identifiers.map(input => input.value), ["com.anonymous.expoapp57", "com.anonymous.expoapp57"]);
+ assert.deepEqual([...dom.window.document.querySelectorAll('[aria-label^="Target "][aria-label$=" name"]')].map(input => (input as HTMLInputElement).value), ["ios", "android"]);
+ assert.equal((dom.window.document.querySelector('[aria-label="Model ID"]') as HTMLInputElement | null)?.value, "gpt-6-luna");
+ assert.match(dom.window.document.body.textContent ?? "", /Signed in/, "stored e2e login status is reused");
+ const signIn = [...dom.window.document.querySelectorAll("button")].find(button => button.textContent?.includes("Sign in with")) as HTMLButtonElement;
+ await act(async () => { signIn.click(); await Promise.resolve(); });
+ assert.deepEqual(opened, ["https://auth.example.test/start"], "a user-started OAuth flow auto-opens its emitted URL");
+ const mcp = [...dom.window.document.querySelectorAll('input[type="checkbox"]')].find(input => input.parentElement?.textContent?.includes("MCP")) as HTMLInputElement;
+ assert.equal(mcp.checked, true, "new setup preselects MCP registration");
+ await act(async () => { root.render(createElement("div")); });
+ await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
+ onTeardown(async () => { await act(async () => { root.unmount(); }); });
+});
+
test("a selected project test offers temporary step edits and per-line runs", async t => {
const { module: { TestingView, testRecorder }, dom, onTeardown } = await renderEnvironment(t, {
exports: 'export { TestingView } from "./packages/ui/src/components/testing-view.tsx";\n'
diff --git a/packages/core/test/testing-projects.test.ts b/packages/core/test/testing-projects.test.ts
index 622b801d..7e2cefb5 100644
--- a/packages/core/test/testing-projects.test.ts
+++ b/packages/core/test/testing-projects.test.ts
@@ -172,6 +172,26 @@ test("a folder without project setup saves into Studio state without modifying t
}
});
+test("bundled mode lists only private Studio tests and never leaks project tests", async () => {
+ const root = await mkdtemp(join(tmpdir(), "testing-bundled-list-"));
+ const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
+ try {
+ process.env.MOBILE_DEV_TESTING_DIRECTORY = join(root, "studio-state");
+ const selected = join(root, "selected");
+ await mkdir(join(selected, "tests"), { recursive: true });
+ await writeFile(join(selected, "tests", "project-only.e2e.ts"), SOURCE);
+ assert.deepEqual(await listTestFiles(selected), [], "project files are outside bundled Studio storage");
+
+ await writeTestFile(selected, "tests/studio-only.e2e.ts", SOURCE);
+ assert.deepEqual((await listTestFiles(selected)).map(entry => entry.relativePath), ["tests/studio-only.e2e.ts"]);
+ assert.equal(await readFile(join(selected, "tests", "studio-only.e2e.ts"), "utf8").catch(() => undefined), undefined);
+ } finally {
+ if (previous === undefined) delete process.env.MOBILE_DEV_TESTING_DIRECTORY;
+ else process.env.MOBILE_DEV_TESTING_DIRECTORY = previous;
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
test("the project's own tests are listed, newest first, and nothing else is", async () => {
const { root, path } = await project();
try {
diff --git a/packages/core/test/testing-run.test.ts b/packages/core/test/testing-run.test.ts
index 2658e67b..925e24cc 100644
--- a/packages/core/test/testing-run.test.ts
+++ b/packages/core/test/testing-run.test.ts
@@ -100,28 +100,27 @@ test("the project's own runner is spawned, never a downloaded one", async () =>
assert.equal(result.output, undefined, "there are lines to mark, so the raw output is not needed");
});
-test("play until here runs a truncated copy beside the test, and takes it away again", async () => {
+test("a preview run uses an isolated temporary project and leaves the project untouched", async () => {
const root = await project();
await mkdir(join(root, "tests"), { recursive: true });
await writeFile(join(root, FILE), "the whole flow\n");
- const until = untilTestPath(FILE);
- assert.equal(until, "tests/a-recorded-flow.mobile-dev-until.e2e.ts", "a sibling, and still a test the project's own patterns discover");
- // The report names the file the runner ran, which is the copy; its lines are the real file's.
- const document = JSON.stringify(report([{ line: 8, status: "passed" }])).replaceAll(FILE, until);
+ const configPath = join(root, "e2e.config.ts");
+ await writeFile(configPath, "export default { targets: [] };\n");
+ const document = JSON.stringify(report([{ line: 8, status: "passed" }]));
const seen: { command?: string; args?: readonly string[]; cwd?: string } = {};
let copy: string | undefined;
- const result = await runRecordedTest({ projectPath: root, relativePath: FILE, untilSource: "the flow, cut short\n" }, {
+ const result = await runRecordedTest({ projectPath: root, relativePath: FILE, configPath, untilSource: "the current preview\n" }, {
spawner: ((command: string, args: readonly string[], options: { cwd?: string }) => {
- // Read while the run is in flight: afterwards it is gone, which is the other half of this.
- copy = readFileSync(join(root, until), "utf8");
+ copy = readFileSync(join(options.cwd!, FILE), "utf8");
return spawner(document, 0, seen)(command, args, options as never);
}) as never,
});
- assert.deepEqual(seen.args, ["run", until, "--reporter", "json"]);
- assert.equal(copy, "the flow, cut short\n");
- assert.deepEqual(result.steps.map(step => step.line), [8], "the copy's lines are the file's lines, so no mark has to be translated");
- assert.equal(existsSync(join(root, until)), false, "the copy belongs to one run and nothing else");
- assert.equal(readFileSync(join(root, FILE), "utf8"), "the whole flow\n", "a partial run must never cut the saved test down to the part that was tried");
+ assert.deepEqual(seen.args, ["run", FILE, "--reporter", "json", "--config", "e2e.config.mts"]);
+ assert.notEqual(seen.cwd, root);
+ assert.equal(copy, "the current preview\n");
+ assert.deepEqual(result.steps.map(step => step.line), [8]);
+ assert.equal(existsSync(seen.cwd!), false, "the isolated workspace is removed after the run");
+ assert.equal(readFileSync(join(root, FILE), "utf8"), "the whole flow\n");
});
test("a run that produced no report explains itself with the runner's own words", async () => {
diff --git a/packages/core/test/testing-setup.test.ts b/packages/core/test/testing-setup.test.ts
index c19a8c2b..6cd82caf 100644
--- a/packages/core/test/testing-setup.test.ts
+++ b/packages/core/test/testing-setup.test.ts
@@ -3,7 +3,7 @@ import assert from "node:assert/strict";
import { mkdtemp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
-import { answerTestingSetup, applyTestingSetup, cancelTestingSetup, planTestingSetup, setupConfigSource, startTestingLogin, testingSetupProgress } from "../src/testing-setup.ts";
+import { answerTestingSetup, applyTestingSetup, cancelTestingSetup, inspectTestingSetup, planTestingSetup, readTestingLoginStatus, setupConfigSource, startTestingLogin, testingSetupProgress } from "../src/testing-setup.ts";
const options = {
targets: [
@@ -90,6 +90,18 @@ test("subscription login is driven through E2E callbacks and keeps prompt answer
const done = await terminal(started.id);
assert.equal(done.status, "succeeded");
assert.equal(received, "synthetic-code");
+ assert.equal(done.auth, undefined, "completed sign-in does not leave a stale link");
+ assert.equal(done.prompt, undefined);
+
+ const cancelled = startTestingLogin("openai", async (_provider, callbacks) => {
+ callbacks.onAuth({ url: "https://example.test/login", instructions: "Open the browser" });
+ await callbacks.onPrompt({ message: "Paste the code" });
+ throw new Error("cancelled");
+ });
+ await new Promise(resolve => setTimeout(resolve, 0));
+ assert.equal(cancelTestingSetup(cancelled.id), true);
+ assert.equal(testingSetupProgress(cancelled.id)?.auth, undefined);
+ assert.equal(testingSetupProgress(cancelled.id)?.prompt, undefined);
});
test("generated config includes only a chosen supported provider", () => {
@@ -98,3 +110,52 @@ test("generated config includes only a chosen supported provider", () => {
assert.match(source, /chatgpt\("gpt-6-luna"\)/);
assert.doesNotMatch(source, /API_KEY/);
});
+
+test("setup validates editable target names and registers both supported MCP locations", async () => {
+ const root = await project();
+ try {
+ await assert.rejects(planTestingSetup(root, { ...options, targets: [options.targets[0], { ...options.targets[1], name: "ios" }] }), /unique/);
+ await writeFile(join(root, ".mcp.json"), JSON.stringify({ mcpServers: { existing: { command: "keep" } } }, null, 2));
+ const plan = await planTestingSetup(root, { ...options, registerMcp: true });
+ assert.ok(plan.actions.some(action => action.path === ".mcp.json" && action.action === "update"));
+ assert.ok(plan.actions.some(action => action.path === ".cursor/mcp.json" && action.action === "create"));
+ assert.equal((await terminal(applyTestingSetup(plan.id).id)).status, "succeeded");
+ const rootMcp = JSON.parse(await readFile(join(root, ".mcp.json"), "utf8"));
+ const cursorMcp = JSON.parse(await readFile(join(root, ".cursor/mcp.json"), "utf8"));
+ assert.equal(rootMcp.mcpServers.existing.command, "keep", "unrelated registrations are preserved");
+ assert.deepEqual(rootMcp.mcpServers.e2e, { command: "npx", args: ["e2e", "mcp"] });
+ assert.deepEqual(cursorMcp.mcpServers.e2e, { command: "npx", args: ["e2e", "mcp"] });
+ } finally { await rm(root, { recursive: true, force: true }); }
+});
+
+test("configured setup inspection is read-only and reports effective versions, model, skill and MCP", async () => {
+ const root = await project();
+ try {
+ await mkdir(join(root, ".agents/skills/e2e"), { recursive: true });
+ await writeFile(join(root, ".agents/skills/e2e/SKILL.md"), "# e2e\n");
+ await writeFile(join(root, "e2e.config.ts"), `import { chatgpt } from "e2e/oauth/chatgpt";\nexport default { agents: { default: { model: chatgpt("gpt-6-luna") } } };\n`);
+ await writeFile(join(root, ".mcp.json"), JSON.stringify({ mcpServers: { e2e: { command: "npx" } } }));
+ await writeFile(join(root, "package.json"), JSON.stringify({ devDependencies: { e2e: "^0.17.0", "@e2e-dev/mobile": "^0.9.2" } }));
+ const inspected = await inspectTestingSetup(root, join(root, "e2e.config.ts"));
+ assert.equal(inspected.provider, "chatgpt");
+ assert.equal(inspected.model, "gpt-6-luna");
+ assert.deepEqual(inspected.dependencies, { e2e: "^0.17.0", mobile: "^0.9.2" });
+ assert.equal(inspected.skillInstalled, true);
+ assert.deepEqual(inspected.mcpRegistrations, [".mcp.json"]);
+ } finally { await rm(root, { recursive: true, force: true }); }
+});
+
+test("stored e2e OAuth logins are detected from XDG config without exposing credential data", async () => {
+ const root = await mkdtemp(join(tmpdir(), "testing-oauth-status-"));
+ const previous = process.env.XDG_CONFIG_HOME;
+ try {
+ process.env.XDG_CONFIG_HOME = root;
+ await mkdir(join(root, "e2e"), { recursive: true });
+ await writeFile(join(root, "e2e/oauth.json"), JSON.stringify({ openai: { access: "synthetic-access", refresh: "synthetic-refresh", expires: Date.now() + 60_000 } }));
+ assert.deepEqual(await readTestingLoginStatus(), { openai: true, "github-copilot": false, "opencode-console": false, spacexai: false });
+ } finally {
+ if (previous === undefined) delete process.env.XDG_CONFIG_HOME;
+ else process.env.XDG_CONFIG_HOME = previous;
+ await rm(root, { recursive: true, force: true });
+ }
+});
diff --git a/packages/ui/src/components/testing-view.tsx b/packages/ui/src/components/testing-view.tsx
index 9681efa7..f97a4683 100644
--- a/packages/ui/src/components/testing-view.tsx
+++ b/packages/ui/src/components/testing-view.tsx
@@ -212,7 +212,7 @@ function TestingDraftPicker({ panel }: { panel: TestingPanel }) {
- setStoredOpen(value => !value)}>
{state.tests.map(stored => {
const selected = stored.relativePath === state.selectedTestPath;
@@ -231,8 +231,8 @@ function TestingDraftPicker({ panel }: { panel: TestingPanel }) {
void panel.deleteTest(stored.relativePath)} />
;
})}
@@ -270,10 +270,25 @@ function TestingModelPicker({ panel }: { panel: TestingPanel }) {
const [endpoint, setEndpoint] = useState(initial?.endpoint ?? "");
const [login, setLogin] = useOperation(panel, null);
const [answer, setAnswer] = useState("");
+ const openedAuth = useRef("");
+ useEffect(() => {
+ if (!state.modelPickerOpen) return;
+ const next = state.modelPreference ?? initial;
+ if (!next) return;
+ setProvider(next.provider); setModel(next.model); setEndpoint(next.endpoint ?? "");
+ }, [state.modelPickerOpen, state.modelPreference?.provider, state.modelPreference?.model, state.modelPreference?.endpoint]);
+ useEffect(() => {
+ const url = login?.auth?.url;
+ if (!url || openedAuth.current === url) return;
+ openedAuth.current = url;
+ void panel.openLoginUrl(url).catch(() => undefined);
+ }, [panel, login?.auth?.url]);
const startLogin = async () => {
if (!choice?.subscription) return;
+ openedAuth.current = "";
setLogin(await panel.startLogin(choice.subscription));
};
+ const signedIn = Boolean(choice?.subscription && (login?.status === "succeeded" || state.setupDetails?.loginStatus[choice.subscription]));
return open ? panel.openModelPicker() : panel.closeModelPicker()}>
@@ -283,12 +298,13 @@ function TestingModelPicker({ panel }: { panel: TestingPanel }) {
if (!value) return; const next = value as TestingModelPreference["provider"]; setProvider(next); setModel(choices.find(entry => entry.id === next)?.defaultModel ?? ""); setLogin(null);
}}>{choice?.label ?? provider}{choices.map(entry => {entry.label})}
-
+
{provider === "openai-compatible" && }
{choice?.subscription &&
;
+}
+
+/** One check in the summary: a state icon, what it is, and its current value. */
+function StatusItem({ ok, label, value }: { ok: boolean; label: string; value: string }) {
+ return
+ {ok ? : }
+
{label}
{value}
+
;
+}
+
+const ACTION_STYLE: Record = {
+ create: { label: "Create", icon: , className: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400" },
+ update: { label: "Update", icon: , className: "bg-amber-500/10 text-amber-600 dark:text-amber-400" },
+ skip: { label: "Unchanged", icon: , className: "bg-muted text-muted-foreground" },
+};
+
+/** Paths in a plan are shown relative to the project so they stay short and comparable. */
+export function relativeToProject(path: string, projectPath: string) {
+ const root = projectPath.replace(/\/+$/, "");
+ return root && path.startsWith(`${root}/`) ? path.slice(root.length + 1) : path;
+}
+
+function PlanRow({ action, path, detail }: { action: string; path: string; detail: string }) {
+ const style = ACTION_STYLE[action] ?? ACTION_STYLE.skip!;
+ return
}
+ >;
+ const needsModel = state.modelPickerOpen && !state.modelPreference;
+ const modelHint = "Deterministic steps never use a model. Only the provider, model and endpoint are saved, never credentials or prompts.";
+
+ return { if (next) panel.openSetup(); else { panel.closeSetup(); panel.closeModelPicker(); } }}>
+
+
+
+
+
+
}
-
- ;
-}
-
/**
* The Testing tool: choose an e2e project, launch its app on the mirrored device, then record a
* deterministic test by tapping the mirror.
@@ -408,8 +263,8 @@ export function TestingView({ panel, deviceApps }: { panel: TestingPanel; device
// Why the recorder cannot start yet, in the order the user has to fix them.
const blocker = !state.projectPath ? "Choose a project to record against."
: state.loadingProject ? ""
- : state.targets.length === 0 ? "No mobile app identifier was found. Open the app in the mirror, or use Set up project to enter one."
- : !target?.bundleId ? `Target "${target?.name}" has no app identifier. Enter one in Set up project.`
+ : state.targets.length === 0 ? "No mobile app identifier was found. Open the app in the mirror, or use E2E setup to enter one."
+ : !target?.bundleId ? `Target "${target?.name}" has no app identifier. Enter one in E2E setup.`
: !booted ? "Boot an iOS simulator or Android emulator to record against it."
: !isRecordableDevice(device) ? "Recording works on an iOS simulator or an Android emulator, not a physical device."
: mismatch;
@@ -423,9 +278,7 @@ export function TestingView({ panel, deviceApps }: { panel: TestingPanel; device
}
- {state.projectPath && {state.runtimeMode === "project" ? "Project runtime" : "Bundled runtime"}}
- {state.runtimeMode === "bundled" && state.projectPath && }
- {state.projectPath && }
+ {state.projectPath && }
{/* Before the controls, so the `ml-auto` below has one thing to push away from and the
status does not end up marooned past the right edge of the group. */}
{state.loadingProject && Reading config…}
@@ -440,7 +293,7 @@ export function TestingView({ panel, deviceApps }: { panel: TestingPanel; device
}
- {state.projectWarning && {state.runtimeMode === "bundled" ? "Zero-setup mode" : "Testing"}{state.projectWarning} Tests saved here stay in Mobile Dev until you opt into project setup.}
+ {state.projectWarning && state.runtimeMode !== "bundled" && Testing{state.projectWarning}}
{blocker && !state.agent?.active &&
{blocker}
}
From 58fc61bf06e5661d6d5324c7b4a5cf07a24a0c87 Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Mon, 16 Nov 2026 17:09:33 +0500
Subject: [PATCH 04/23] feat: allow non-project recordings
---
docs/testing-panel.md | 22 +++++
packages/core/src/testing-projects.ts | 79 +++++++++++++++-
packages/core/src/testing-tools.ts | 29 ++++--
packages/core/test/testing-panel-ui.test.ts | 49 ++++++++++
packages/core/test/testing-projects.test.ts | 50 +++++++++-
packages/ui/src/components/testing-setup.tsx | 4 +-
packages/ui/src/components/testing-view.tsx | 43 +++++++--
packages/ui/src/testing-panel.ts | 94 +++++++++++++++++--
packages/ui/test/testing-drafts-panel.test.ts | 1 +
packages/ui/test/testing-panel.test.ts | 33 ++++++-
10 files changed, 371 insertions(+), 33 deletions(-)
diff --git a/docs/testing-panel.md b/docs/testing-panel.md
index 9faa6743..a62735aa 100644
--- a/docs/testing-panel.md
+++ b/docs/testing-panel.md
@@ -9,6 +9,28 @@ config, no compatible mobile target, no local packages, or an incompatible API l
to **Bundled runtime** and keeps generated config plus saved tests in Mobile Dev's private state. Record,
Save, Run, Play until here, manual recording and agent recording therefore do not modify the project.
+### No project open
+
+Opening a project is optional. With no recorded project, Studio opens on **No project**: a private,
+empty workspace in Mobile Dev's state (`testing/studio-workspace`, reported as `studioPath` by
+`mobile_testing_projects`). It has no config, so it always runs on the Bundled runtime. The user picks
+nothing up front: the target is the app in the mirror's foreground (platform from the mirrored device,
+bundle id from the foreground app), so Launch app, Record, Save and Run work as in any bundled project.
+Saved tests are listed under **In Studio**. The project picker's first entry, **No project**, returns
+to this workspace; any recorded or newly chosen folder still switches to project behavior, and the
+workspace is never listed as a project. **Set up project** is hidden in this mode because there is
+no project to write into.
+
+### Pinned app
+
+A Studio (bundled) test is pinned to `{ platform, bundleId }`, stored in `targets.json` beside the
+tests in Mobile Dev's private state, never in the test source. Save pins the app being recorded
+against. Run on a test with no pin pins the app in front first (`mobile_testing_run_test` `pin`).
+A pinned test always runs against its own app: Studio opens it if it is not in front, and says so
+if it is not installed or the mirrored platform differs. The preview shows the pinned app with
+**Use current app** to re-pin (`mobile_testing_set_target`). With no pin and no foreground app, Run
+is disabled with a hint. Project tests keep using their config's targets.
+
Bundled targets are discovered in this order: the project's local Expo CLI (`expo config --json`, never
network `npx`), non-executing `app.json`/`app.config.*` data, then the mirrored foreground app. Both iOS
and Android targets are retained when known and are editable in the setup wizard.
diff --git a/packages/core/src/testing-projects.ts b/packages/core/src/testing-projects.ts
index b00c7306..a14c41b3 100644
--- a/packages/core/src/testing-projects.ts
+++ b/packages/core/src/testing-projects.ts
@@ -80,6 +80,16 @@ function timestamp(value: unknown): string {
return typeof value === "string" && !Number.isNaN(Date.parse(value)) ? value : "";
}
+/**
+ * The workspace Studio records against when no project is open: an empty folder in Mobile Dev's
+ * private state. It has no e2e config, so the bundled runtime owns it and its tests stay in Mobile
+ * Dev. Only the host can name it, so the panel asks the server instead of guessing a path.
+ */
+export function studioWorkspacePath(): string {
+ const stateRoot = process.env.MOBILE_DEV_TESTING_DIRECTORY?.trim() || TESTING_DIRECTORY;
+ return normalize(join(stateRoot, "studio-workspace"));
+}
+
/** The e2e config file of a project folder, or undefined when it holds none. */
export async function findConfig(projectPath: string): Promise {
for (const file of CONFIG_FILES) {
@@ -120,6 +130,7 @@ export function parseTargets(source: string): TestingTarget[] {
export async function inspectProject(projectPath: string, foreground?: ForegroundTestingTarget): Promise {
const path = normalize(projectPath.trim());
if (!isAbsolute(path)) throw new ExpectedOperationError("invalid_input", "Choose the project folder.");
+ if (path === studioWorkspacePath()) await mkdir(path, { recursive: true, mode: 0o700 });
if (!(await isDirectory(path))) throw new ExpectedOperationError("invalid_input", "That project folder no longer exists.");
const configPath = await findConfig(path);
const source = configPath ? await readFile(configPath, "utf-8").catch(() => "") : "";
@@ -199,7 +210,8 @@ export class TestingProjectChoices {
/** Recorded folders that still exist, including zero-setup projects without an e2e config. */
async list(): Promise {
- const projects = TestingProjectChoices.clean(await this.read());
+ const studio = studioWorkspacePath();
+ const projects = TestingProjectChoices.clean(await this.read()).filter(entry => !same(entry.path, studio));
const available = await Promise.all(projects.map(async entry => ((await isDirectory(entry.path)) ? entry : null)));
return available.filter((entry): entry is TestingProjectChoice => entry !== null);
}
@@ -353,6 +365,61 @@ export interface StoredTest {
name: string;
updatedAt: string;
sizeBytes: number;
+ /** The app a bundled test is pinned to; absent for project tests and for tests not yet run or saved with one. */
+ target?: TestTarget;
+}
+
+/** The app a Studio test runs against, kept beside the test and never inside its source. */
+export interface TestTarget { platform: "ios" | "android"; bundleId: string }
+
+const TARGETS_FILE = "targets.json";
+
+function validTarget(value: unknown): TestTarget | undefined {
+ const entry = value as Partial | null;
+ return (entry?.platform === "ios" || entry?.platform === "android") && typeof entry.bundleId === "string" && entry.bundleId.length > 0 && entry.bundleId.length <= 512
+ ? { platform: entry.platform, bundleId: entry.bundleId } : undefined;
+}
+
+async function readTargets(root: string): Promise> {
+ const saved = await readJson(join(root, TARGETS_FILE)) as { targets?: Record } | null;
+ const targets: Record = {};
+ for (const [path, value] of Object.entries(saved?.targets ?? {})) { const target = validTarget(value); if (target) targets[path] = target; }
+ return targets;
+}
+
+async function changeTargets(root: string, change: (targets: Record) => void): Promise {
+ const targets = await readTargets(root);
+ change(targets);
+ await mkdir(root, { recursive: true, mode: 0o700 });
+ const file = join(root, TARGETS_FILE);
+ const temporary = `${file}.${process.pid}.${randomUUID()}.tmp`;
+ try {
+ await writeFile(temporary, JSON.stringify({ version: 1, targets }, null, 2), { mode: 0o600 });
+ await rename(temporary, file);
+ } finally {
+ await unlink(temporary).catch(() => undefined);
+ }
+}
+
+/**
+ * Pins a Studio test to the app it was recorded or first run against. Only bundled tests carry one:
+ * a project test's app is its config's target, and nothing is written into the project for it.
+ */
+export async function writeTestTarget(projectPath: string, relativePath: string, target: TestTarget): Promise {
+ const { project, root } = await testStorage(projectPath);
+ if (project.runtimeMode !== "bundled") return false;
+ const file = await resolveTestPath(root, relativePath);
+ if (!(await isFile(file))) throw new ExpectedOperationError("invalid_input", "Save the test before pinning an app to it.");
+ const checked = validTarget(target);
+ if (!checked) throw new ExpectedOperationError("invalid_input", "Choose an iOS or Android app identifier.");
+ await changeTargets(root, targets => { targets[relativePath] = checked; });
+ return true;
+}
+
+/** The app a bundled test is pinned to, if any. */
+export async function readTestTarget(projectPath: string, relativePath: string): Promise {
+ const { project, root } = await testStorage(projectPath);
+ return project.runtimeMode === "bundled" ? (await readTargets(root))[relativePath] : undefined;
}
/** How deep under `tests/` the listing walks. Deeper than a folder per feature is not a list. */
@@ -371,8 +438,9 @@ const MAX_LISTED_TESTS = 200;
* A project with no `tests/` folder yet is an empty list, not an error: nothing has been saved.
*/
export async function listTestFiles(projectPath: string): Promise {
- const { root } = await testStorage(projectPath);
+ const { project, root } = await testStorage(projectPath);
const testsRoot = resolve(root, TESTS_DIRECTORY);
+ const pinned = project.runtimeMode === "bundled" ? await readTargets(root) : {};
const found: StoredTest[] = [];
const walk = async (directory: string, depth: number): Promise => {
if (depth > MAX_TEST_DEPTH || found.length >= MAX_LISTED_TESTS) return;
@@ -386,11 +454,13 @@ export async function listTestFiles(projectPath: string): Promise
if (!entry.isFile() || !entry.name.endsWith(".e2e.ts")) continue;
const info = await stat(child).catch(() => undefined);
if (!info) continue;
+ const relativePath = [TESTS_DIRECTORY, ...relative(testsRoot, child).split(/[\\/]/).filter(Boolean)].join("/");
found.push({
- relativePath: [TESTS_DIRECTORY, ...relative(testsRoot, child).split(/[\\/]/).filter(Boolean)].join("/"),
+ relativePath,
name: entry.name,
updatedAt: info.mtime.toISOString(),
sizeBytes: info.size,
+ ...(pinned[relativePath] ? { target: pinned[relativePath] } : {}),
});
}
};
@@ -473,8 +543,9 @@ export async function discardStagedTestFile(projectPath: string, relativePath: s
* this removes a file from the user's repository, which nothing here can put back.
*/
export async function deleteTestFile(projectPath: string, relativePath: string): Promise<{ path: string; removed: boolean }> {
- const { root } = await testStorage(projectPath);
+ const { project, root } = await testStorage(projectPath);
const target = await resolveTestPath(root, relativePath);
const removed = await unlink(target).then(() => true, () => false);
+ if (removed && project.runtimeMode === "bundled") await changeTargets(root, targets => { delete targets[relativePath]; }).catch(() => undefined);
return { path: target, removed };
}
diff --git a/packages/core/src/testing-tools.ts b/packages/core/src/testing-tools.ts
index b8b0aaa1..13b883f6 100644
--- a/packages/core/src/testing-tools.ts
+++ b/packages/core/src/testing-tools.ts
@@ -6,7 +6,7 @@ import { errorMessage } from "@mobile-dev/shared/protocol.ts";
import { ExpectedOperationError } from "@mobile-dev/shared/error-reporting.ts";
import { captureServerError, recordTestingSetupOperation } from "./telemetry.ts";
import type { TestingProjectChoices } from "./testing-projects.ts";
-import { deleteTestFile, discardStagedTestFile, inspectProject, listTestFiles, previewTestFile, readTestFile, resolveTestRunPaths, saveStagedTestFile, stageTestFile, writeTestFile } from "./testing-projects.ts";
+import { deleteTestFile, discardStagedTestFile, inspectProject, listTestFiles, previewTestFile, readTestFile, resolveTestRunPaths, saveStagedTestFile, stageTestFile, studioWorkspacePath, writeTestFile, writeTestTarget } from "./testing-projects.ts";
import { TestDraftStore } from "./testing-drafts.ts";
import { MAX_DRAFT_STEPS, recordedStepSchema, testDraftIdSchema } from "@mobile-dev/shared/test-drafts.ts";
import type { TestDraft } from "@mobile-dev/shared/test-drafts.ts";
@@ -56,11 +56,11 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
let running = false;
registerAppTool(server, "mobile_testing_projects", {
title: "List testing projects",
- description: "List the e2e project folders the Testing panel can record against, most recent first.",
+ description: "List the e2e project folders the Testing panel can record against, most recent first, and the private Studio workspace it uses when no project is open.",
inputSchema: {},
annotations: read,
_meta: appVisibility,
- }, safe(async () => dataResult({ projects: await projects.list() })));
+ }, safe(async () => dataResult({ projects: await projects.list(), studioPath: studioWorkspacePath() })));
registerAppTool(server, "mobile_testing_choose_project", {
title: "Choose a testing project",
@@ -83,13 +83,16 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
relativePath: z.string().min(1).max(512).describe("Path under the project, inside tests/, ending in .e2e.ts."),
contents: z.string().max(256 * 1024),
overwrite: z.boolean().optional(),
+ platform: z.enum(["ios", "android"]).optional().describe("With bundleId: the app a Studio test is pinned to. Stored beside the test, never in its source."),
+ bundleId: z.string().min(1).max(512).optional(),
},
// Replacing someone's test file is destructive, so the host asks before this runs.
annotations: destructive,
_meta: appVisibility,
- }, safe(async ({ projectPath: selected, relativePath, contents, overwrite }: { projectPath: string; relativePath: string; contents: string; overwrite?: boolean }) => {
+ }, safe(async ({ projectPath: selected, relativePath, contents, overwrite, platform, bundleId }: { projectPath: string; relativePath: string; contents: string; overwrite?: boolean; platform?: "ios" | "android"; bundleId?: string }) => {
const project = await inspectProject(selected);
const result = await writeTestFile(selected, relativePath, contents, overwrite ?? false);
+ if (result.written && platform && bundleId) await writeTestTarget(selected, relativePath, { platform, bundleId });
const shownPath = project.runtimeMode === "bundled" ? `Studio/${relativePath}` : result.path;
return dataResult({ ...result, path: shownPath, storageMode: project.runtimeMode }, result.written ? `Saved ${shownPath}` : `${shownPath} already exists.`);
}));
@@ -297,6 +300,15 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
return dataResult({ tree, ...(screen ? { screen } : {}) });
}));
+ registerAppTool(server, "mobile_testing_set_target", {
+ title: "Pin a Studio test to an app",
+ description: "Store the app (platform and bundle id) a saved Studio test runs against. Only Studio tests carry one; a project test keeps using its config's target.",
+ inputSchema: { projectPath, relativePath: z.string().min(1).max(512), platform: z.enum(["ios", "android"]), bundleId: z.string().min(1).max(512) },
+ annotations: write,
+ _meta: appVisibility,
+ }, safe(async ({ projectPath: selected, relativePath, platform, bundleId }: { projectPath: string; relativePath: string; platform: "ios" | "android"; bundleId: string }) =>
+ dataResult({ pinned: await writeTestTarget(selected, relativePath, { platform, bundleId }) })));
+
registerAppTool(server, "mobile_testing_run_test", {
title: "Run a recorded test",
description:
@@ -308,7 +320,8 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
timeoutMs: z.number().int().min(10_000).max(30 * 60_000).optional(),
target: z.string().min(1).max(256).optional().describe("The e2e target name to run against, so a flow recorded on Android does not run on the config's first (iOS) target."),
platform: z.enum(["ios", "android"]).optional().describe("The mirrored platform for a bundled run."),
- bundleId: z.string().min(1).max(512).optional().describe("The foreground app identifier for a bundled run."),
+ bundleId: z.string().min(1).max(512).optional().describe("The app identifier for a bundled run: the test's pinned app, or the foreground app when it has none."),
+ pin: z.boolean().optional().describe("Pin platform and bundleId to the saved test before running, for a bundled test that has no app yet."),
model: z.object({
provider: z.enum(["vercel", "openrouter", "openai-compatible", "chatgpt", "copilot", "opencode-console", "grok"]),
model: z.string().min(1).max(256), endpoint: z.string().url().max(2048).optional(),
@@ -319,13 +332,14 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
// A test run drives the app on the device: it taps, types and changes the app's own state.
annotations: destructive,
_meta: appVisibility,
- }, safe(async ({ projectPath: selected, relativePath, configPath, timeoutMs, target, platform, bundleId, model, untilSource }: { projectPath: string; relativePath: string; configPath?: string; timeoutMs?: number; target?: string; platform?: "ios" | "android"; bundleId?: string; model?: { provider: BundledModelProvider; model: string; endpoint?: string }; untilSource?: string }) => {
+ }, safe(async ({ projectPath: selected, relativePath, configPath, timeoutMs, target, platform, bundleId, pin, model, untilSource }: { projectPath: string; relativePath: string; configPath?: string; timeoutMs?: number; target?: string; platform?: "ios" | "android"; bundleId?: string; pin?: boolean; model?: { provider: BundledModelProvider; model: string; endpoint?: string }; untilSource?: string }) => {
// The release is a dependency of the run, not a step the caller is trusted to have taken: see
// `TestRunDeps`. The panel releases too, but a caller who forgets must not break the run.
progress = [];
running = true;
try {
const project = await inspectProject(selected, platform && bundleId ? { platform, bundleId } : undefined);
+ if (pin && platform && bundleId) await writeTestTarget(selected, relativePath, { platform, bundleId }).catch(() => false);
const paths = await resolveTestRunPaths(selected, relativePath, project.runtimeMode === "project" ? configPath : undefined, untilSource !== undefined);
const selectedTarget = project.targets.find(entry => entry.name === target)
?? project.targets.find(entry => entry.platform === platform && (!bundleId || entry.bundleId === bundleId))
@@ -334,7 +348,8 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
const result = await runRecordedTest(
{ ...paths, ...(timeoutMs === undefined ? {} : { timeoutMs }), ...(target ? { target } : {}),
...(bundledSource === undefined ? {} : { untilSource: bundledSource }), runtime: { mode: project.runtimeMode, root: project.runtime.root },
- ...(project.runtimeMode === "bundled" && selectedTarget?.platform && selectedTarget.bundleId ? { bundledTarget: { platform: selectedTarget.platform as "ios" | "android", bundleId: selectedTarget.bundleId } } : {}),
+ ...(project.runtimeMode === "bundled" && platform && bundleId ? { bundledTarget: { platform, bundleId } }
+ : project.runtimeMode === "bundled" && selectedTarget?.platform && selectedTarget.bundleId ? { bundledTarget: { platform: selectedTarget.platform as "ios" | "android", bundleId: selectedTarget.bundleId } } : {}),
...(model ? { model } : {}) },
{ release: () => devices.release(), onProgress: entry => { progress.push(entry); } });
return dataResult({ ...result }, `${relativePath} ${result.status}.`);
diff --git a/packages/core/test/testing-panel-ui.test.ts b/packages/core/test/testing-panel-ui.test.ts
index 10efc63f..0a521e16 100644
--- a/packages/core/test/testing-panel-ui.test.ts
+++ b/packages/core/test/testing-panel-ui.test.ts
@@ -159,6 +159,7 @@ test("a run marks the preview line by line, and marks nothing it was not told ab
subscribe: (listener: () => void) => { panelListeners.add(listener); return () => { panelListeners.delete(listener); }; },
getSnapshot: () => panelState,
canLaunch: true, canRun: true, canRunStored: true, dirty: true,
+ noProject: false, storedTarget: undefined, foregroundTarget: undefined, storedRunHint: "", repinStoredTest: async () => {},
refreshProjects: async () => {}, chooseProject: async () => {}, pickProject: async () => {},
launchApp: async () => {}, saveTest: async () => {}, runTest: async (options?: unknown) => { runs.push(options); }, selectTarget: () => {},
setFileName: () => {}, cancelOverwrite: () => {}, dismissError: () => {},
@@ -577,6 +578,8 @@ function panelStub(overrides: Record = {}) {
subscribe: (listener: () => void) => { listeners.add(listener); return () => { listeners.delete(listener); }; },
getSnapshot: () => state,
canLaunch: true, canRun: true, canRunStored: true, dirty: true,
+ get noProject() { return state.projectPath === state.studioPath; }, useNoProject: async () => {},
+ storedTarget: undefined, foregroundTarget: undefined, storedRunHint: "", repinStoredTest: async () => {},
refreshProjects: async () => {}, chooseProject: async () => {}, pickProject: async () => {},
launchApp: async () => {}, saveTest: async () => {}, runTest: async () => {}, selectTarget: () => {},
setFileName: () => {}, cancelOverwrite: () => {}, dismissError: () => {},
@@ -784,6 +787,52 @@ test("bundled tests are labeled In Studio and configured projects show read-only
onTeardown(async () => { await act(async () => { root.unmount(); }); });
});
+test("with no project open the picker says so and setup offers no project files", async t => {
+ const { module: { TestingView }, dom, onTeardown } = await renderEnvironment(t, {
+ exports: 'export { TestingView } from "./packages/ui/src/components/testing-view.tsx";', slug: "testing-no-project",
+ });
+ const { act, createElement } = await import("react");
+ const { createRoot } = await import("react-dom/client");
+ const root = createRoot(dom.window.document.getElementById("root")!);
+ const deviceApps = { subscribe: () => () => undefined, getSnapshot: () => DEVICE_SNAPSHOT };
+ let chosen = 0;
+ const panel = { ...panelStub({ projectPath: "/studio", studioPath: "/studio", runtimeMode: "bundled", setupState: "available", configPath: "", setupOpen: true }), useNoProject: async () => { chosen += 1; } };
+ await act(async () => { root.render(createElement(TestingView, { panel, deviceApps })); });
+ const trigger = dom.window.document.querySelector("[aria-label='Testing project']") as HTMLElement;
+ assert.match(trigger.textContent ?? "", /No project/);
+ assert.match(dom.window.document.body.textContent ?? "", /No project open/);
+ assert.doesNotMatch(dom.window.document.body.textContent ?? "", /Set up project/);
+ await act(async () => { trigger.click(); });
+ await act(async () => { (dom.window.document.querySelector("[data-testing-no-project]") as HTMLElement).click(); });
+ assert.equal(chosen, 1);
+ await act(async () => { root.render(createElement("div")); });
+ await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
+ onTeardown(async () => { await act(async () => { root.unmount(); }); });
+});
+
+test("a stored Studio test shows its pinned app and offers to re-pin it to the app in front", async t => {
+ const { module: { TestingView }, dom, onTeardown } = await renderEnvironment(t, {
+ exports: 'export { TestingView } from "./packages/ui/src/components/testing-view.tsx";', slug: "testing-pinned-app",
+ });
+ const { act, createElement } = await import("react");
+ const { createRoot } = await import("react-dom/client");
+ const root = createRoot(dom.window.document.getElementById("root")!);
+ const deviceApps = { subscribe: () => () => undefined, getSnapshot: () => DEVICE_SNAPSHOT };
+ let repinned = 0;
+ const panel = { ...panelStub({ runtimeMode: "bundled", selectedTestPath: "tests/flow.e2e.ts", selectedTestSource: "await tap();\n" }),
+ storedTarget: { platform: "ios", bundleId: "com.a" }, foregroundTarget: { platform: "ios", bundleId: "com.b" },
+ storedRunHint: "com.a is not installed on the mirrored device.", canRunStored: false, repinStoredTest: async () => { repinned += 1; } };
+ await act(async () => { root.render(createElement(TestingView, { panel, deviceApps })); });
+ assert.match(dom.window.document.querySelector("[data-testing-pinned-app]")?.textContent ?? "", /com\.a/);
+ assert.match(dom.window.document.querySelector("[data-testing-run-hint]")?.textContent ?? "", /not installed/);
+ assert.equal((dom.window.document.querySelector("[data-testing-run]") as HTMLButtonElement).disabled, true);
+ await act(async () => { (dom.window.document.querySelector("[data-testing-repin]") as HTMLElement).click(); });
+ assert.equal(repinned, 1);
+ await act(async () => { root.render(createElement("div")); });
+ await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
+ onTeardown(async () => { await act(async () => { root.unmount(); }); });
+});
+
test("async project data prefills model and every discovered setup target", async t => {
const { module: { TestingView }, dom, onTeardown } = await renderEnvironment(t, {
exports: 'export { TestingView } from "./packages/ui/src/components/testing-view.tsx";', slug: "testing-async-setup",
diff --git a/packages/core/test/testing-projects.test.ts b/packages/core/test/testing-projects.test.ts
index 7e2cefb5..c474d914 100644
--- a/packages/core/test/testing-projects.test.ts
+++ b/packages/core/test/testing-projects.test.ts
@@ -3,7 +3,7 @@ import assert from "node:assert/strict";
import { mkdtemp, mkdir, readFile, rm, symlink, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
-import { deleteTestFile, discardStagedTestFile, findConfig, inspectProject, listTestFiles, parseTargets, previewTestFile, readTestFile, resolveTestRunPaths, saveStagedTestFile, stageTestFile, TestingProjectChoices, writeTestFile } from "../src/testing-projects.ts";
+import { deleteTestFile, discardStagedTestFile, findConfig, inspectProject, listTestFiles, parseTargets, previewTestFile, readTestFile, resolveTestRunPaths, saveStagedTestFile, stageTestFile, readTestTarget, studioWorkspacePath, TestingProjectChoices, writeTestTarget, writeTestFile } from "../src/testing-projects.ts";
const CONFIG = `import { mobile } from "@e2e-dev/mobile";
import type { E2EConfig } from "e2e";
@@ -172,6 +172,54 @@ test("a folder without project setup saves into Studio state without modifying t
}
});
+test("the Studio workspace needs no project: it is created on demand, bundled, and not listed as a project", async () => {
+ const { root } = await project();
+ const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
+ try {
+ process.env.MOBILE_DEV_TESTING_DIRECTORY = join(root, "studio-state");
+ const studio = studioWorkspacePath();
+ assert.ok(studio.startsWith(join(root, "studio-state")));
+ const inspected = await inspectProject(studio, { platform: "ios", bundleId: "com.anonymous.expoapp57" });
+ assert.equal(inspected.runtimeMode, "bundled");
+ assert.deepEqual(inspected.targets, [{ name: "ios", platform: "ios", bundleId: "com.anonymous.expoapp57" }]);
+ assert.equal((await writeTestFile(studio, "tests/flow.e2e.ts", SOURCE)).written, true);
+ assert.equal(await readTestFile(studio, "tests/flow.e2e.ts"), SOURCE);
+ assert.equal(await readFile(join(studio, "tests/flow.e2e.ts"), "utf8").catch(() => undefined), undefined, "tests stay in Mobile Dev's state");
+ const choices = new TestingProjectChoices(join(root, "choices"));
+ await choices.record(studio);
+ assert.deepEqual(await choices.list(), []);
+ } finally {
+ if (previous === undefined) delete process.env.MOBILE_DEV_TESTING_DIRECTORY;
+ else process.env.MOBILE_DEV_TESTING_DIRECTORY = previous;
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
+test("a Studio test is pinned to its app beside the source, listed, re-pinned and cleared on delete", async () => {
+ const { root } = await project();
+ const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
+ try {
+ process.env.MOBILE_DEV_TESTING_DIRECTORY = join(root, "studio-state");
+ const studio = studioWorkspacePath();
+ await assert.rejects(writeTestTarget(studio, "tests/flow.e2e.ts", { platform: "ios", bundleId: "com.a" }), /Save the test/);
+ await writeTestFile(studio, "tests/flow.e2e.ts", SOURCE);
+ assert.equal(await readTestTarget(studio, "tests/flow.e2e.ts"), undefined);
+ assert.equal(await writeTestTarget(studio, "tests/flow.e2e.ts", { platform: "ios", bundleId: "com.a" }), true);
+ assert.deepEqual(await readTestTarget(studio, "tests/flow.e2e.ts"), { platform: "ios", bundleId: "com.a" });
+ assert.deepEqual((await listTestFiles(studio))[0]?.target, { platform: "ios", bundleId: "com.a" });
+ assert.equal(await readTestFile(studio, "tests/flow.e2e.ts"), SOURCE, "the source carries no target");
+ await writeTestTarget(studio, "tests/flow.e2e.ts", { platform: "android", bundleId: "com.b" });
+ assert.deepEqual(await readTestTarget(studio, "tests/flow.e2e.ts"), { platform: "android", bundleId: "com.b" });
+ await deleteTestFile(studio, "tests/flow.e2e.ts");
+ await writeTestFile(studio, "tests/flow.e2e.ts", SOURCE);
+ assert.equal(await readTestTarget(studio, "tests/flow.e2e.ts"), undefined, "a deleted test leaves no pin behind");
+ } finally {
+ if (previous === undefined) delete process.env.MOBILE_DEV_TESTING_DIRECTORY;
+ else process.env.MOBILE_DEV_TESTING_DIRECTORY = previous;
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
test("bundled mode lists only private Studio tests and never leaks project tests", async () => {
const root = await mkdtemp(join(tmpdir(), "testing-bundled-list-"));
const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
diff --git a/packages/ui/src/components/testing-setup.tsx b/packages/ui/src/components/testing-setup.tsx
index b99a6be8..33f9debe 100644
--- a/packages/ui/src/components/testing-setup.tsx
+++ b/packages/ui/src/components/testing-setup.tsx
@@ -235,8 +235,8 @@ export function TestingSetup({ panel }: { panel: TestingPanel }) {
{panel.noProject ? "No Studio tests yet." : "No tests in this project's tests/ folder yet."}
}
;
@@ -261,9 +272,9 @@ export function TestingView({ panel, deviceApps }: { panel: TestingPanel; device
const deviceId = device?.udid ?? "";
const platform = device ? recordablePlatform(device) : "ios";
// Why the recorder cannot start yet, in the order the user has to fix them.
- const blocker = !state.projectPath ? "Choose a project to record against."
+ const blocker = !state.projectPath ? "Preparing Studio…"
: state.loadingProject ? ""
- : state.targets.length === 0 ? "No mobile app identifier was found. Open the app in the mirror, or use E2E setup to enter one."
+ : state.targets.length === 0 ? (panel.noProject ? "Open the app you want to record in the mirror. Studio records against the app in the foreground." : "No mobile app identifier was found. Open the app in the mirror, or use E2E setup to enter one.")
: !target?.bundleId ? `Target "${target?.name}" has no app identifier. Enter one in E2E setup.`
: !booted ? "Boot an iOS simulator or Android emulator to record against it."
: !isRecordableDevice(device) ? "Recording works on an iOS simulator or an Android emulator, not a physical device."
@@ -295,6 +306,8 @@ export function TestingView({ panel, deviceApps }: { panel: TestingPanel; device
{state.projectWarning && state.runtimeMode !== "bundled" && Testing{state.projectWarning}}
+ {state.selectedTestPath && panel.storedRunHint && !state.agent?.active &&
{panel.storedRunHint}
}
+
{blocker && !state.agent?.active &&
{blocker}
}
@@ -376,7 +389,7 @@ function TestingControls({ panel, recordable, deviceId, platform }: { panel: Tes
: testRecorder.start(deviceId, platform)}>Record}
void (panelState.selectedTestPath ? panel.runStoredTest() : panel.runTest())}>
{panelState.running ? : }Run test
@@ -681,6 +694,21 @@ function SourceStepMenu({ source, step, index, mode, onEdit, editable }: {
}
/** A project file's awaited calls can be edited in a temporary working copy. */
+/** The app a Studio test is pinned to, with a way to pin it to the app in front instead. */
+function PinnedApp({ panel }: { panel: TestingPanel }) {
+ const state = useSyncExternalStore(panel.subscribe, panel.getSnapshot);
+ const pinned = panel.storedTarget;
+ const front = panel.foregroundTarget;
+ const canRepin = Boolean(front) && !state.running && (!pinned || pinned.bundleId !== front!.bundleId || pinned.platform !== front!.platform);
+ return
+
+ {pinned ? pinned.bundleId : "No app pinned"}
+ {pinned && {pinned.platform}}
+
+ {canRepin && void panel.repinStoredTest()}>{pinned ? "Use current app" : "Pin current app"}}
+ ;
+}
+
function StoredTestPreview({ panel, source, path, loading }: { panel: TestingPanel; source: string; path: string; loading: boolean }) {
const panelState = useSyncExternalStore(panel.subscribe, panel.getSnapshot);
const recorder = useSyncExternalStore(testRecorder.subscribe, testRecorder.getSnapshot);
@@ -696,6 +724,7 @@ function StoredTestPreview({ panel, source, path, loading }: { panel: TestingPan
return
{path}
+ {panelState.runtimeMode === "bundled" && }
{panelState.selectedTestStaged && <>
Unsaved edits are temporary and may be lost until you Save. => entry !== null)
.filter(entry => text(entry.path))
.map(entry => ({ path: text(entry.path), name: text(entry.name) || projectName(text(entry.path)) }));
- if (!this.disposed) this.update({ projects });
+ if (!this.disposed) this.update({ projects, studioPath: text(object(response.structuredContent)?.studioPath) || this.snapshot.studioPath });
} catch {
// The panel still works from the project it was last opened with, or the empty state.
} finally {
@@ -358,8 +360,10 @@ export class TestingPanel {
if (!this.snapshot.available || this.snapshot.projectPath || this.restoreRequest) return this.restoreRequest;
const request = (async () => {
await this.refreshProjects();
- const latest = this.snapshot.projects[0];
- if (latest && !this.disposed && !this.snapshot.projectPath) await this.selectProject(latest.path);
+ // No project is a state of its own: with nothing recorded against yet, Studio opens on its
+ // private workspace so recording never waits for a folder to be chosen.
+ const latest = this.snapshot.projects[0]?.path || this.snapshot.studioPath;
+ if (latest && !this.disposed && !this.snapshot.projectPath) await this.selectProject(latest);
})();
this.restoreRequest = request;
try { await request; } finally { if (this.restoreRequest === request) this.restoreRequest = undefined; }
@@ -369,11 +373,20 @@ export class TestingPanel {
this.update({ projects: [project, ...this.snapshot.projects.filter(entry => entry.path !== project.path)] });
}
+ /** Whether Studio is on its private workspace rather than a project the user opened. */
+ get noProject(): boolean { return Boolean(this.snapshot.studioPath) && this.snapshot.projectPath === this.snapshot.studioPath; }
+
+ /** Leaves the open project and records in Studio's own workspace. */
+ async useNoProject() {
+ await this.refreshProjects();
+ if (this.snapshot.studioPath) await this.selectProject(this.snapshot.studioPath);
+ }
+
/** Selects a project the selector already lists, and makes it the one the panel reopens with. */
async chooseProject(projectPath: string) {
const path = projectPath.trim();
if (!path) return;
- if (!this.snapshot.available) { await this.selectProject(path); return; }
+ if (!this.snapshot.available || path === this.snapshot.studioPath) { await this.selectProject(path); return; }
try {
const response = await this.call("mobile_testing_choose_project", { projectPath: path });
const project = object(object(response.structuredContent)?.project);
@@ -907,6 +920,7 @@ export class TestingPanel {
try {
const response = await this.call("mobile_testing_write_file", {
projectPath, relativePath, contents: testRecorder.source, overwrite: confirmOverwrite,
+ ...this.pinArguments(),
}, 60_000);
const data = object(response.structuredContent) ?? {};
if (data.written === true) {
@@ -1092,12 +1106,56 @@ export class TestingPanel {
get canRunStored(): boolean {
return Boolean(this.snapshot.available && this.snapshot.projectPath && this.snapshot.selectedTestPath
- && !this.snapshot.loadingTest && !this.snapshot.agent?.active && !this.snapshot.running && !this.snapshot.saving);
+ && !this.snapshot.loadingTest && !this.snapshot.agent?.active && !this.snapshot.running && !this.snapshot.saving
+ && !this.storedRunHint);
}
- private bundledRunArguments() {
- if (this.snapshot.runtimeMode !== "bundled") return {};
+ /** The app a selected Studio test is pinned to; undefined for project tests and unpinned tests. */
+ get storedTarget(): NonNullable | undefined {
+ if (this.snapshot.runtimeMode !== "bundled") return undefined;
+ return this.snapshot.tests.find(test => test.relativePath === this.snapshot.selectedTestPath)?.target;
+ }
+
+ /** The app in front on the mirrored device, as a Studio target. */
+ get foregroundTarget(): NonNullable | undefined {
+ const { device, foregroundApp } = this.deviceApps.getSnapshot();
+ return device && isRecordableDevice(device) && foregroundApp?.bundleId ? { platform: recordablePlatform(device), bundleId: foregroundApp.bundleId } : undefined;
+ }
+
+ /** Why Run is unavailable for a selected Studio test, or "": it needs a pinned app or one in front. */
+ get storedRunHint(): string {
+ if (this.snapshot.runtimeMode !== "bundled" || !this.snapshot.selectedTestPath) return "";
+ const pinned = this.storedTarget;
+ if (!pinned) return this.foregroundTarget ? "" : "This test has no app yet. Open the app in the mirror to run it; Studio will pin it.";
+ const { device, apps, ready } = this.deviceApps.getSnapshot();
+ if (device && isRecordableDevice(device) && recordablePlatform(device) !== pinned.platform) return `This test is pinned to ${pinned.bundleId} (${pinned.platform}). Mirror an ${pinned.platform === "ios" ? "iOS simulator" : "Android emulator"} to run it.`;
+ if (ready && apps.length > 0 && !apps.some(app => app.bundleId === pinned.bundleId)) return `${pinned.bundleId} is not installed on the mirrored device.`;
+ return "";
+ }
+
+ /** The platform and bundle id sent with a save, so a Studio test is pinned to the app it was recorded against. */
+ private pinArguments() {
const target = this.target;
+ return this.snapshot.runtimeMode === "bundled" && (target?.platform === "ios" || target?.platform === "android") && target.bundleId
+ ? { platform: target.platform, bundleId: target.bundleId } : {};
+ }
+
+ /** Pins the selected Studio test to the app in front, replacing the one it had. */
+ async repinStoredTest() {
+ const { projectPath, selectedTestPath: relativePath } = this.snapshot;
+ const target = this.foregroundTarget;
+ if (!projectPath || !relativePath || !target || this.snapshot.running) return;
+ try {
+ await this.call("mobile_testing_set_target", { projectPath, relativePath, ...target }, 10_000);
+ await this.refreshTests();
+ } catch (error) {
+ this.update({ error: error instanceof Error ? error.message : String(error) });
+ }
+ }
+
+ private bundledRunArguments(pinned?: { platform: "ios" | "android"; bundleId: string }) {
+ if (this.snapshot.runtimeMode !== "bundled") return {};
+ const target = pinned ?? this.target;
return {
...(target?.platform === "ios" || target?.platform === "android" ? { platform: target.platform } : {}),
...(target?.bundleId ? { bundleId: target.bundleId } : {}),
@@ -1121,7 +1179,21 @@ export class TestingPanel {
const untilSource = untilLine === undefined ? source : storedTestUntilSource(source, untilLine);
if (untilSource === undefined) return;
if (!this.hasBundledModel(untilSource, { kind: "stored", ...(untilLine === undefined ? {} : { untilLine }) })) return;
+ // A Studio test runs against the app it is pinned to, never whichever app is in front. A test
+ // with no app yet takes the one in front and keeps it, so later runs are pinned.
+ const pinned = this.storedTarget;
+ const runTarget = pinned ?? this.foregroundTarget;
+ if (this.snapshot.runtimeMode === "bundled" && !runTarget) return;
this.update({ running: true, error: null });
+ if (pinned && this.deviceApps.getSnapshot().foregroundApp?.bundleId !== pinned.bundleId) {
+ try {
+ const device = this.deviceApps.getSnapshot().device;
+ if (device) await this.call("mobile_launch_app", { platform: pinned.platform, deviceId: device.udid, bundleId: pinned.bundleId }, 120_000);
+ } catch (error) {
+ this.update({ running: false, error: `Could not open ${pinned.bundleId}: ${error instanceof Error ? error.message : String(error)}` });
+ return;
+ }
+ }
testRecorder.clearRun();
testRecorder.beginRun(untilLine);
if (untilLine !== undefined) countUiEvent("ui.testing.run_until");
@@ -1137,7 +1209,8 @@ export class TestingPanel {
projectPath, relativePath, untilSource,
...(this.snapshot.configPath ? { configPath: this.snapshot.configPath } : {}),
...(this.snapshot.targetName ? { target: this.snapshot.targetName } : {}),
- ...this.bundledRunArguments(),
+ ...this.bundledRunArguments(runTarget),
+ ...(!pinned && runTarget ? { pin: true } : {}),
}, 15 * 60_000);
const data = object(response.structuredContent) ?? {};
const steps = (Array.isArray(data.steps) ? data.steps : []).map(entry => object(entry))
@@ -1158,6 +1231,7 @@ export class TestingPanel {
if (getUiTelemetryAttributes() === telemetryContext) recordUiTiming("ui.testing.run", performance.now() - startedAt);
this.update({ running: false });
testRecorder.invalidate();
+ if (!pinned && runTarget) void this.refreshTests();
}
}
diff --git a/packages/ui/test/testing-drafts-panel.test.ts b/packages/ui/test/testing-drafts-panel.test.ts
index 995d3985..7ac4c591 100644
--- a/packages/ui/test/testing-drafts-panel.test.ts
+++ b/packages/ui/test/testing-drafts-panel.test.ts
@@ -358,6 +358,7 @@ test("Play until a saved call runs a temporary copy without saving the project f
mobile_testing_read_file: { source, originalHash: "a".repeat(64), staged: false },
mobile_testing_run_test: { status: "passed", steps: [{ line: 3, status: "passed" }] },
}, calls);
+ (panel as unknown as { update(fields: Record): void }).update({ runtimeMode: "project" });
await panel.openTest("tests/flow.e2e.ts");
await panel.runStoredTest(3);
const run = named(calls, "mobile_testing_run_test")[0];
diff --git a/packages/ui/test/testing-panel.test.ts b/packages/ui/test/testing-panel.test.ts
index d6cc040d..36954c97 100644
--- a/packages/ui/test/testing-panel.test.ts
+++ b/packages/ui/test/testing-panel.test.ts
@@ -15,6 +15,8 @@ const tab: ScreenComponent = {
};
// Saving touches no device, so the store is a stub: the real one binds to the document.
+/** A booted simulator with an app in front, for runs that need an app to pin. */
+const frontApps = { subscribe: () => () => undefined, getSnapshot: () => ({ device: { udid: "udid", name: "iPhone", state: "Booted", platform: "ios", kind: "simulator" }, apps: [], foregroundApp: { bundleId: "com.example.app", pid: 1 }, ready: false }) } as unknown as DeviceAppsStore;
const deviceApps = { subscribe: () => () => undefined, getSnapshot: () => ({ device: undefined }) } as unknown as DeviceAppsStore;
/**
@@ -140,7 +142,7 @@ test("a project test polls live progress against its own source lines", async ()
panel.setAvailable(true);
const source = 'test("stored", async ({ app, screen }) => {\n await app.open();\n await screen.getByText("Done").tap();\n});';
(panel as unknown as { update(fields: Record): void }).update({
- projectPath: PROJECT, selectedTestPath: "tests/stored.e2e.ts", selectedTestSource: source, configPath: `${PROJECT}/e2e.config.ts`,
+ projectPath: PROJECT, runtimeMode: "project", selectedTestPath: "tests/stored.e2e.ts", selectedTestSource: source, configPath: `${PROJECT}/e2e.config.ts`,
});
const running = panel.runStoredTest();
@@ -242,7 +244,7 @@ test("stored Play until here resumes with the same cutoff after model selection"
const panel = new TestingPanel(host({
mobile_testing_model_preference: { saved: true },
mobile_testing_run_test: { status: "passed", exitCode: 0, steps: [{ line: 2, status: "passed" }] },
- }, calls), deviceApps);
+ }, calls), frontApps);
panel.setAvailable(true);
(panel as unknown as { update(fields: Record): void }).update({
projectPath: PROJECT, runtimeMode: "bundled", selectedTestPath: "tests/stored.e2e.ts", selectedTestSource: source,
@@ -308,3 +310,30 @@ test("a booted Android emulator is recordable and a target of the wrong platform
update({ targetName: "android" });
assert.equal(panel.targetMismatch, "");
});
+
+test("a Studio test with no app pins the one in front on its first run, then runs against the pin", async () => {
+ const calls: { name: string; arguments: Record }[] = [];
+ const source = 'test("stored", async ({ app }) => {\n await app.open();\n});\n';
+ const panel = new TestingPanel(host({ mobile_testing_run_test: { status: "passed", exitCode: 0, steps: [] } }, calls), frontApps);
+ panel.setAvailable(true);
+ (panel as unknown as { update(fields: Record): void }).update({ projectPath: PROJECT, runtimeMode: "bundled", selectedTestPath: "tests/stored.e2e.ts", selectedTestSource: source, tests: [{ relativePath: "tests/stored.e2e.ts", name: "stored.e2e.ts", updatedAt: "", sizeBytes: 1 }] });
+ await panel.runStoredTest();
+ const first = calls.find(call => call.name === "mobile_testing_run_test")!;
+ assert.deepEqual([first.arguments.platform, first.arguments.bundleId, first.arguments.pin], ["ios", "com.example.app", true]);
+ calls.length = 0;
+ (panel as unknown as { update(fields: Record): void }).update({ tests: [{ relativePath: "tests/stored.e2e.ts", name: "stored.e2e.ts", updatedAt: "", sizeBytes: 1, target: { platform: "ios", bundleId: "com.pinned.app" } }] });
+ await panel.runStoredTest();
+ assert.ok(calls.some(call => call.name === "mobile_launch_app" && call.arguments.bundleId === "com.pinned.app"), "the pinned app is opened when it is not in front");
+ const second = calls.find(call => call.name === "mobile_testing_run_test")!;
+ assert.deepEqual([second.arguments.bundleId, second.arguments.pin], ["com.pinned.app", undefined]);
+ panel.dispose();
+});
+
+test("Run is unavailable for a Studio test with neither a pinned app nor one in front", () => {
+ const panel = new TestingPanel(host({}, []), deviceApps);
+ panel.setAvailable(true);
+ (panel as unknown as { update(fields: Record): void }).update({ projectPath: PROJECT, runtimeMode: "bundled", selectedTestPath: "tests/stored.e2e.ts", selectedTestSource: "x" });
+ assert.equal(panel.canRunStored, false);
+ assert.match(panel.storedRunHint, /Open the app in the mirror/);
+ panel.dispose();
+});
From c759edf8c4337b11788125c0b517bc2126bfa264 Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Tue, 17 Nov 2026 10:14:20 +0500
Subject: [PATCH 05/23] fix: bug with version conflict
---
docs/testing-panel.md | 8 ++++--
packages/core/src/e2e-runtime.ts | 20 ++++++-------
packages/core/src/testing-device.ts | 25 +++++++++++++++--
packages/core/test/testing-device.test.ts | 8 ++----
packages/core/test/testing-projects.test.ts | 31 +++++++++++++++++++--
5 files changed, 69 insertions(+), 23 deletions(-)
diff --git a/docs/testing-panel.md b/docs/testing-panel.md
index a62735aa..5c7f3315 100644
--- a/docs/testing-panel.md
+++ b/docs/testing-panel.md
@@ -4,9 +4,11 @@
Testing Studio no longer requires `e2e.config.ts`. Every panel build ships a pinned, integrity-checked
runtime containing `e2e`, `@e2e-dev/mobile`, the supported AI SDK/provider packages, license notices
-and release metadata. A compatible project-local config and runtime remain authoritative. With no
-config, no compatible mobile target, no local packages, or an incompatible API line, Studio switches
-to **Bundled runtime** and keeps generated config plus saved tests in Mobile Dev's private state. Record,
+and release metadata. A project with its own config, a compatible mobile target and an installed
+`e2e` CLI is always authoritative, whatever its e2e version: runs use the project's own CLI. Only the
+recorder's tree reading is version-sensitive; when the project's `@e2e-dev/mobile` node projection is
+missing or does not load, the recorder reads the tree with the bundled one instead. With no config,
+no compatible mobile target, or no installed `e2e` CLI, Studio switches to **Bundled runtime** and keeps generated config plus saved tests in Mobile Dev's private state. Record,
Save, Run, Play until here, manual recording and agent recording therefore do not modify the project.
### No project open
diff --git a/packages/core/src/e2e-runtime.ts b/packages/core/src/e2e-runtime.ts
index e0cb3b09..d8daf11c 100644
--- a/packages/core/src/e2e-runtime.ts
+++ b/packages/core/src/e2e-runtime.ts
@@ -17,6 +17,9 @@ export interface TestingRuntimeDescriptor {
const sourceRuntime = resolve("packages/runtimes/e2e");
+/** The runner a project run executes (`runnerBin`); its presence is what makes a project's own setup usable. */
+export const PROJECT_CLI = "node_modules/.bin/e2e";
+
/** The shipped runtime beside server.mjs, with the source tree fallback used by unit tests. */
export function bundledE2eRoot(): string {
const configured = process.env.MOBILE_DEV_E2E_RUNTIME?.trim();
@@ -45,17 +48,14 @@ export async function bundledRuntimeDescriptor(reason?: string): Promise {
const root = projectPath;
- if (!existsSync(join(root, "node_modules/.bin/e2e"))
- || !existsSync(join(root, "node_modules/@e2e-dev/mobile/dist/nodes.js"))) return;
- const [e2eVersion, mobileVersion, bundled] = await Promise.all([
- version(root, "e2e"), version(root, "@e2e-dev/mobile"), bundledRuntimeDescriptor(),
+ // A project with its own e2e setup is authoritative whatever its version: runs go through the
+ // project's own CLI, exactly as `npx e2e run` would. Only the recorder's tree projection is
+ // version-sensitive, and it falls back to the bundled one on its own (see `testing-device.ts`).
+ if (!existsSync(join(root, PROJECT_CLI))) return;
+ const [e2eVersion, mobileVersion] = await Promise.all([
+ version(root, "e2e"),
+ version(root, "@e2e-dev/mobile").catch(() => "unknown"),
]);
- const apiLine = (value: string) => value.split(".").slice(0, 2).join(".");
- // Studio imports the runner's public CLI and mobile projection. Keep the project authoritative
- // only on the API lines the shipped Studio was tested against; a newer or older local install
- // remains untouched and Studio falls back to its pinned runtime.
- if (apiLine(e2eVersion) !== apiLine(bundled.e2eVersion)
- || apiLine(mobileVersion) !== apiLine(bundled.mobileVersion)) return;
return {
mode: "project",
root,
diff --git a/packages/core/src/testing-device.ts b/packages/core/src/testing-device.ts
index c1e6b2c3..af22d31b 100644
--- a/packages/core/src/testing-device.ts
+++ b/packages/core/src/testing-device.ts
@@ -4,6 +4,7 @@ import { pathToFileURL } from "node:url";
import { ExpectedOperationError } from "@mobile-dev/shared/error-reporting.ts";
import type { ScreenComponent, ScreenSize } from "@mobile-dev/shared/screen-annotations.ts";
import { APP_FLOW_DIRECTORY, loadVendoredAgentDevice } from "./app-flow-host.ts";
+import { bundledE2eRoot } from "./e2e-runtime.ts";
import { captureServerError } from "./telemetry.ts";
/**
@@ -127,7 +128,27 @@ async function loadProjection(projectPath: string): Promise {
// Deep path rather than a package specifier: the package does not export this module, and a
// copy of its mapping here would be the divergence this path exists to remove.
const dynamicImport = new Function("specifier", "return import(specifier)") as (specifier: string) => Promise;
- return await dynamicImport(pathToFileURL(entry).href) as EngineProjection;
+ const module = await dynamicImport(pathToFileURL(entry).href) as Partial | null;
+ if (typeof module?.projectSnapshot !== "function") {
+ throw new ExpectedOperationError("invalid_input", "This project's @e2e-dev/mobile does not expose the node projection the recorder reads.");
+ }
+ return module as EngineProjection;
+}
+
+/**
+ * The project's projection when it loads, else the bundled runtime's. A project on an e2e version
+ * Studio was not built against still runs its tests with its own CLI; only the recorder's tree
+ * reading drops back to the pinned copy, so recording keeps working instead of refusing.
+ */
+async function loadProjectionWithFallback(runtimeRoot: string): Promise {
+ try {
+ return await loadProjection(runtimeRoot);
+ } catch (error) {
+ let bundled: string;
+ try { bundled = bundledE2eRoot(); } catch { throw error; }
+ if (bundled === runtimeRoot) throw error;
+ return await loadProjection(bundled).catch(() => { throw error; });
+ }
}
function textOf(value: unknown): string | undefined {
@@ -235,7 +256,7 @@ export class TestingDevices {
private projection(runtimeRoot: string): Promise {
let pending = this.projections.get(runtimeRoot);
if (!pending) {
- pending = loadProjection(runtimeRoot);
+ pending = loadProjectionWithFallback(runtimeRoot);
// A failed load must not be cached: the user installs the dependency and records again.
pending.catch(() => this.projections.delete(runtimeRoot));
this.projections.set(runtimeRoot, pending);
diff --git a/packages/core/test/testing-device.test.ts b/packages/core/test/testing-device.test.ts
index 605176a4..e2f3da1d 100644
--- a/packages/core/test/testing-device.test.ts
+++ b/packages/core/test/testing-device.test.ts
@@ -151,12 +151,10 @@ test("a failed read still leaves the device releasable", async () => {
assert.equal(calls.filter(entry => entry.call === "close").length, 1);
});
-test("a project without the mobile engine says so instead of guessing at roles", async () => {
+test("a project whose mobile engine does not load reads the tree with the bundled projection", async () => {
const devices = new TestingDevices(fakeAgentDevice([], () => ({ nodes: [] })) as never);
- await assert.rejects(
- devices.read({ ...target, projectPath: "/does/not/exist" }),
- /@e2e-dev\/mobile/,
- );
+ const tree = await devices.read({ ...target, projectPath: "/does/not/exist" });
+ assert.ok(Array.isArray(tree.tree));
});
test("shutting the plugin down gives the recorder's device back", async () => {
diff --git a/packages/core/test/testing-projects.test.ts b/packages/core/test/testing-projects.test.ts
index c474d914..cd38da68 100644
--- a/packages/core/test/testing-projects.test.ts
+++ b/packages/core/test/testing-projects.test.ts
@@ -37,16 +37,41 @@ test("a config with no targets reads as none rather than throwing", () => {
assert.deepEqual(parseTargets("export default { workers: 1 };"), []);
});
-async function installCompatibleRuntime(path: string) {
+async function installCompatibleRuntime(path: string, versions = { e2e: "0.17.0", mobile: "0.9.2" }) {
await mkdir(join(path, "node_modules/.bin"), { recursive: true });
await mkdir(join(path, "node_modules/e2e"), { recursive: true });
await mkdir(join(path, "node_modules/@e2e-dev/mobile/dist"), { recursive: true });
await writeFile(join(path, "node_modules/.bin/e2e"), "");
- await writeFile(join(path, "node_modules/e2e/package.json"), JSON.stringify({ version: "0.17.0" }));
- await writeFile(join(path, "node_modules/@e2e-dev/mobile/package.json"), JSON.stringify({ version: "0.9.2" }));
+ await writeFile(join(path, "node_modules/e2e/package.json"), JSON.stringify({ version: versions.e2e }));
+ await writeFile(join(path, "node_modules/@e2e-dev/mobile/package.json"), JSON.stringify({ version: versions.mobile }));
await writeFile(join(path, "node_modules/@e2e-dev/mobile/dist/nodes.js"), "export {};\n");
}
+test("a configured project on another e2e version still uses its own runtime", async () => {
+ const root = await mkdtemp(join(tmpdir(), "testing-projects-"));
+ try {
+ await writeFile(join(root, "e2e.config.ts"), CONFIG, "utf-8");
+ await installCompatibleRuntime(root, { e2e: "0.23.0", mobile: "0.12.6" });
+ const inspected = await inspectProject(root);
+ assert.equal(inspected.runtimeMode, "project");
+ assert.equal(inspected.runtime.e2eVersion, "0.23.0");
+ assert.equal(inspected.runtime.root, root);
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
+test("a configured project without an installed e2e CLI falls back to bundled mode", async () => {
+ const root = await mkdtemp(join(tmpdir(), "testing-projects-"));
+ try {
+ await writeFile(join(root, "e2e.config.ts"), CONFIG, "utf-8");
+ const inspected = await inspectProject(root);
+ assert.equal(inspected.runtimeMode, "bundled");
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
test("configured projects stay authoritative and folders without config use bundled mode", async () => {
const root = await mkdtemp(join(tmpdir(), "testing-projects-"));
try {
From 94b550ccb98984a6d99354f8fdc24cc5bfa63975 Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Tue, 17 Nov 2026 10:14:39 +0500
Subject: [PATCH 06/23] feat: use latest e2e
---
packages/core/src/testing-setup.ts | 2 +-
packages/core/test/testing-setup.test.ts | 2 +-
packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt | 563 +++++++-
packages/runtimes/e2e/package-lock.json | 1218 ++++++++++++-----
packages/runtimes/e2e/package.json | 4 +-
packages/runtimes/e2e/release.json | 14 +-
6 files changed, 1432 insertions(+), 371 deletions(-)
diff --git a/packages/core/src/testing-setup.ts b/packages/core/src/testing-setup.ts
index 7ccf9414..2aec51c8 100644
--- a/packages/core/src/testing-setup.ts
+++ b/packages/core/src/testing-setup.ts
@@ -242,7 +242,7 @@ export async function planTestingSetup(projectPath: string, input: SetupOptions)
let manifest: Record;
try { manifest = JSON.parse(originalPackage); } catch { throw new ExpectedOperationError("invalid_input", "Fix package.json before applying e2e setup."); }
const model = modelSource(options);
- const devDependencies = { ...((manifest.devDependencies && typeof manifest.devDependencies === "object") ? manifest.devDependencies as Record : {}), e2e: "^0.17.0", "@e2e-dev/mobile": "^0.9.2", ...(options.provider === "none" ? {} : { ai: "^7.0.0", zod: "^4.1.8", ...model.dependencies }) };
+ const devDependencies = { ...((manifest.devDependencies && typeof manifest.devDependencies === "object") ? manifest.devDependencies as Record : {}), e2e: "^0.23.1", "@e2e-dev/mobile": "^0.12.7", ...(options.provider === "none" ? {} : { ai: "^7.0.0", zod: "^4.1.8", ...model.dependencies }) };
const scripts = { ...((manifest.scripts && typeof manifest.scripts === "object") ? manifest.scripts as Record : {}) };
if (scripts["test:e2e"] === undefined) scripts["test:e2e"] = "e2e run";
const nextPackage = JSON.stringify({ ...manifest, scripts, devDependencies: Object.fromEntries(Object.entries(devDependencies).sort(([a], [b]) => a.localeCompare(b))) }, null, 2) + "\n";
diff --git a/packages/core/test/testing-setup.test.ts b/packages/core/test/testing-setup.test.ts
index 6cd82caf..beb3b593 100644
--- a/packages/core/test/testing-setup.test.ts
+++ b/packages/core/test/testing-setup.test.ts
@@ -45,7 +45,7 @@ test("the setup preview is immutable and apply creates a complete mobile scaffol
assert.match(config, /platform: "android"/);
const manifest = JSON.parse(await readFile(join(root, "package.json"), "utf8"));
assert.equal(manifest.scripts["test:e2e"], "e2e run");
- assert.equal(manifest.devDependencies.e2e, "^0.17.0");
+ assert.equal(manifest.devDependencies.e2e, "^0.23.1");
assert.match(await readFile(join(root, ".gitignore"), "utf8"), /\.e2e\/artifacts\//);
} finally { await rm(root, { recursive: true, force: true }); }
});
diff --git a/packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt b/packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt
index f5348ab5..0b899cbc 100644
--- a/packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt
+++ b/packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt
@@ -124,7 +124,7 @@ limitations under the License.
====================
-@clack/core 1.5.1 (LICENSE)
+@clack/core 1.6.0 (LICENSE)
MIT License
@@ -138,7 +138,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
====================
-@clack/prompts 1.8.1 (LICENSE)
+@clack/prompts 1.9.0 (LICENSE)
MIT License
@@ -152,7 +152,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
====================
-@e2e-dev/mobile 0.9.2 (LICENSE)
+@e2e-dev/mobile 0.12.7 (LICENSE)
Apache License
@@ -359,7 +359,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
====================
-@e2e-dev/mobile 0.9.2 (NOTICE)
+@e2e-dev/mobile 0.12.7 (NOTICE)
@e2e-dev/mobile
Copyright 2026 TesterArmy, Inc.
@@ -369,7 +369,127 @@ This product includes software developed at TesterArmy, Inc.
====================
-@modelcontextprotocol/core 2.2.0 (LICENSE)
+@jridgewell/gen-mapping 0.3.13 (LICENSE)
+
+Copyright 2024 Justin Ridgewell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+@jridgewell/remapping 2.3.5 (LICENSE)
+
+Copyright 2024 Justin Ridgewell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+@jridgewell/resolve-uri 3.1.3 (LICENSE)
+
+Copyright 2019 Justin Ridgewell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+@jridgewell/sourcemap-codec 1.6.0 (LICENSE)
+
+Copyright 2024 Justin Ridgewell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+@jridgewell/trace-mapping 0.3.31 (LICENSE)
+
+Copyright 2024 Justin Ridgewell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+@modelcontextprotocol/core 2.4.0 (LICENSE)
The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
@@ -590,7 +710,7 @@ the full license text.
====================
-@modelcontextprotocol/server 2.2.0 (LICENSE)
+@modelcontextprotocol/server 2.4.0 (LICENSE)
The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
@@ -811,6 +931,32 @@ the full license text.
====================
+@napi-rs/image 1.16.0 (LICENSE)
+
+MIT License
+
+Copyright (c) 2020-present LongYinan(github@lyn.one)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
@openrouter/ai-sdk-provider 3.1.0 (LICENSE)
Apache License
@@ -1017,6 +1163,60 @@ APPENDIX: How to apply the Apache License to your work.
====================
+@oxc-project/runtime 0.158.0 (LICENSE)
+
+MIT License
+
+Copyright (c) 2014-present Sebastian McKenzie and other contributors
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+====================
+
+@oxc-project/types 0.158.0 (LICENSE)
+
+MIT License
+
+Copyright (c) 2024-present VoidZero Inc. & Contributors
+Copyright (c) 2023 Boshen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
@standard-schema/spec 1.1.0 (LICENSE)
MIT License
@@ -1302,7 +1502,7 @@ SOFTWARE.
====================
-@vitest/expect 5.0.2 (LICENSE)
+@vitest/expect 5.1.0 (LICENSE)
MIT License
@@ -1328,7 +1528,7 @@ SOFTWARE.
====================
-@vitest/pretty-format 5.0.2 (LICENSE)
+@vitest/pretty-format 5.1.0 (LICENSE)
MIT License
@@ -1354,7 +1554,7 @@ SOFTWARE.
====================
-@vitest/spy 5.0.2 (LICENSE)
+@vitest/spy 5.1.0 (LICENSE)
MIT License
@@ -1380,7 +1580,7 @@ SOFTWARE.
====================
-@vitest/utils 5.0.2 (LICENSE)
+@vitest/utils 5.1.0 (LICENSE)
MIT License
@@ -1414,7 +1614,7 @@ See the LICENSE file in the root of this repository.
====================
-agent-device 0.21.20 (LICENSE)
+agent-device 0.21.37 (LICENSE)
MIT License
@@ -1510,7 +1710,7 @@ SOFTWARE.
====================
-commander 15.0.0 (LICENSE)
+commander 15.1.0 (LICENSE)
(The MIT License)
@@ -1565,7 +1765,7 @@ OTHER DEALINGS IN THE SOFTWARE.
====================
-e2e 0.17.0 (LICENSE)
+e2e 0.23.1 (LICENSE)
Apache License
@@ -1772,7 +1972,7 @@ e2e 0.17.0 (LICENSE)
====================
-e2e 0.17.0 (NOTICE)
+e2e 0.23.1 (NOTICE)
e2e
Copyright 2026 TesterArmy, Inc.
@@ -1782,29 +1982,209 @@ This product includes software developed at TesterArmy, Inc.
====================
-esbuild 0.28.2 (LICENSE.md)
+eslint-visitor-keys 5.0.1 (LICENSE)
-MIT License
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
-Copyright (c) 2020 Evan Wallace
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
+ 1. Definitions.
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright contributors
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
====================
@@ -1914,12 +2294,11 @@ SOFTWARE.
====================
-fsevents 2.3.3 (LICENSE)
+get-tsconfig 4.14.3 (LICENSE)
MIT License
------------
-Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller
+Copyright (c) Hiroki Osame
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -1928,16 +2307,16 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
====================
@@ -2141,6 +2520,60 @@ permission of its copyright owner.
====================
+oxc-parser 0.158.0 (LICENSE)
+
+MIT License
+
+Copyright (c) 2024-present VoidZero Inc. & Contributors
+Copyright (c) 2023 Boshen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+oxc-transform 0.158.0 (LICENSE)
+
+MIT License
+
+Copyright (c) 2024-present VoidZero Inc. & Contributors
+Copyright (c) 2023 Boshen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
picocolors 1.1.1 (LICENSE)
ISC License
@@ -2161,6 +2594,26 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
====================
+pixelmatch 8.0.0 (LICENSE)
+
+ISC License
+
+Copyright (c) 2025, Mapbox
+
+Permission to use, copy, modify, and/or distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright notice
+and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+THIS SOFTWARE.
+
+====================
+
pngjs 7.0.0 (LICENSE)
pngjs original work Copyright (c) 2015 Luke Page & Original Contributors
@@ -2186,7 +2639,33 @@ THE SOFTWARE.
====================
-sisteransi 1.0.5 (license)
+resolve-pkg-maps 1.0.0 (LICENSE)
+
+MIT License
+
+Copyright (c) Hiroki Osame
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+====================
+
+sisteransi 2.0.0 (license)
MIT License
@@ -2238,11 +2717,11 @@ SOFTWARE.
====================
-tsx 4.23.14 (LICENSE)
+toml-eslint-parser 1.0.3 (LICENSE)
MIT License
-Copyright (c) Hiroki Osame
+Copyright (c) 2021 Yosuke Ota
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/packages/runtimes/e2e/package-lock.json b/packages/runtimes/e2e/package-lock.json
index 9156bd74..b495db7d 100644
--- a/packages/runtimes/e2e/package-lock.json
+++ b/packages/runtimes/e2e/package-lock.json
@@ -13,10 +13,10 @@
"@ai-sdk/openai": "4.0.109",
"@ai-sdk/openai-compatible": "3.0.53",
"@ai-sdk/xai": "5.0.4",
- "@e2e-dev/mobile": "0.9.2",
+ "@e2e-dev/mobile": "0.12.7",
"@openrouter/ai-sdk-provider": "3.1.0",
"ai": "7.0.163",
- "e2e": "0.17.0",
+ "e2e": "0.23.1",
"zod": "4.6.7"
}
},
@@ -211,49 +211,50 @@
}
},
"node_modules/@clack/core": {
- "version": "1.5.1",
- "resolved": "https://registry.npmjs.org/@clack/core/-/core-1.5.1.tgz",
- "integrity": "sha512-iHTrHA8MtVuLl2TfZySmcKv1qO2PoyC9Z7pfSDozEuV5vtY3/wcOPKJXlqJ5Oq2Cx5DDGQGAMVx6HZfRRoVEbQ==",
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/@clack/core/-/core-1.6.0.tgz",
+ "integrity": "sha512-4GZynIB2IIe431odxesswvWTCP6orvqd6e2b07b3VFWBQRqUqIHc/EPIZwFoKS692QBp+ooPuXKaJV8g4kXuYA==",
"license": "MIT",
"dependencies": {
+ "fast-string-width": "^3.0.2",
"fast-wrap-ansi": "^0.2.0",
- "sisteransi": "^1.0.5"
+ "sisteransi": "^2.0.0"
},
"engines": {
"node": ">= 20.12.0"
}
},
"node_modules/@clack/prompts": {
- "version": "1.8.1",
- "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.8.1.tgz",
- "integrity": "sha512-dlT1m5e/0yUL0kRNcQn7yGLVThkgbB0Ga/1AmfDDC/8ik6AIiSf2QLQO2zPYvefsHP0aFgxO93cVLCCfDp7kzQ==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.9.0.tgz",
+ "integrity": "sha512-tEj8X2No2A1c9NDnZECxiiJ8TP3vmFlN9tLlLeSaMqVW4tUmVG2R4qpv/eP4zymWxnymYLkLcIYVV0VcWj3RCQ==",
"license": "MIT",
"dependencies": {
- "@clack/core": "1.5.1",
+ "@clack/core": "1.6.0",
"fast-string-width": "^3.0.2",
"fast-wrap-ansi": "^0.2.0",
- "sisteransi": "^1.0.5"
+ "sisteransi": "^2.0.0"
},
"engines": {
"node": ">= 20.12.0"
}
},
"node_modules/@e2e-dev/mobile": {
- "version": "0.9.2",
- "resolved": "https://registry.npmjs.org/@e2e-dev/mobile/-/mobile-0.9.2.tgz",
- "integrity": "sha512-aY09M1ckxtezydmTI6/R72R/RVuwZn42+phGekQLCkZWID1EXNQi19+leYyyZJWdH4p+E2EVgYm4k8EcilYM0Q==",
+ "version": "0.12.7",
+ "resolved": "https://registry.npmjs.org/@e2e-dev/mobile/-/mobile-0.12.7.tgz",
+ "integrity": "sha512-xssZhb7kQhA0tGqM+kPgm1dguW1HwnIhN8wnvRHh+90hENsl1WufxUEU45mEgyBVa1/ltKYtjZlYQA+lFr+x+g==",
"license": "Apache-2.0",
"dependencies": {
- "agent-device": "0.21.20",
- "pngjs": "7.0.0",
- "zod": "4.6.1"
+ "@napi-rs/image": "1.16.0",
+ "agent-device": "0.21.37",
+ "zod": "4.6.7"
},
"engines": {
- "node": ">=22.12.0"
+ "node": "^22.22.3 || >=24.8.0"
},
"peerDependencies": {
"ai": "^7.0.0",
- "e2e": ">=0.15.0 <1"
+ "e2e": ">=0.22.1 <1"
},
"peerDependenciesMeta": {
"ai": {
@@ -261,131 +262,388 @@
}
}
},
- "node_modules/@e2e-dev/mobile/node_modules/zod": {
- "version": "4.6.1",
- "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.1.tgz",
- "integrity": "sha512-341aRWQsve0rvronKNTqZpjmzdbUDlFuzHaI/XLg/Ej82qffDJRRfBTCuv7+9q/rMjB6LSLyEBnW4InJeMtt/Q==",
+ "node_modules/@jridgewell/gen-mapping": {
+ "version": "0.3.13",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.0",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/remapping": {
+ "version": "2.3.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",
+ "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.5",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz",
+ "integrity": "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g==",
"license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz",
+ "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==",
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.31",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
+ }
+ },
+ "node_modules/@modelcontextprotocol/core": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/@modelcontextprotocol/core/-/core-2.4.0.tgz",
+ "integrity": "sha512-z8QBKqdfXLPzkLQuG4xp8hrVEMm1PZ1IgxMN2sMbJiFiAKOWXnAzogXn2W4aqIBlP1ea6U5yiqVquvUNM1Cj6Q==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "zod": "^4.2.0"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@modelcontextprotocol/server": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/@modelcontextprotocol/server/-/server-2.4.0.tgz",
+ "integrity": "sha512-rgR9yxSaAJ+bcsi/XroT/S2AfPiIWloXAnrdfYSCms9ivVju0ishu/wW0J21Ho6+ZOR1r7RyeRbjiRuF87ix5Q==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@modelcontextprotocol/core": "2.4.0",
+ "zod": "^4.2.0"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@napi-rs/image": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image/-/image-1.16.0.tgz",
+ "integrity": "sha512-kciiEskvG7m6t0+VwJ/dUT5Zn79mKr1/RAAmjvG8TfK6aG9dI1lZqohtt8QGSQjdhRkyYJ85YKW686gQGFgzWw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 10"
+ },
"funding": {
- "url": "https://github.com/sponsors/colinhacks"
+ "type": "github",
+ "url": "https://github.com/sponsors/Brooooooklyn"
+ },
+ "optionalDependencies": {
+ "@napi-rs/image-android-arm64": "1.16.0",
+ "@napi-rs/image-darwin-arm64": "1.16.0",
+ "@napi-rs/image-darwin-x64": "1.16.0",
+ "@napi-rs/image-freebsd-x64": "1.16.0",
+ "@napi-rs/image-linux-arm-gnueabihf": "1.16.0",
+ "@napi-rs/image-linux-arm64-gnu": "1.16.0",
+ "@napi-rs/image-linux-arm64-musl": "1.16.0",
+ "@napi-rs/image-linux-x64-gnu": "1.16.0",
+ "@napi-rs/image-linux-x64-musl": "1.16.0",
+ "@napi-rs/image-win32-arm64-msvc": "1.16.0",
+ "@napi-rs/image-win32-ia32-msvc": "1.16.0",
+ "@napi-rs/image-win32-x64-msvc": "1.16.0"
+ }
+ },
+ "node_modules/@napi-rs/image-android-arm64": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-android-arm64/-/image-android-arm64-1.16.0.tgz",
+ "integrity": "sha512-pwn/41RoGaE0gHlJBvEIikYXASeiHhs1lyo5+fWZZSXsS9hpJt0zQqWiSr7cCdCwLdg84pQwPbqd32Kp+scLSw==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">= 10"
}
},
- "node_modules/@esbuild/aix-ppc64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz",
- "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==",
+ "node_modules/@napi-rs/image-darwin-arm64": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-darwin-arm64/-/image-darwin-arm64-1.16.0.tgz",
+ "integrity": "sha512-JJesjwlmWA9m0iN4y0GvHpfZkgAviU4Yhk+qvV+D44obYPisqAhJdMCQMY1/u8Yj/PblijimCMY05fMRvCmrdQ==",
"cpu": [
- "ppc64"
+ "arm64"
],
"license": "MIT",
"optional": true,
"os": [
- "aix"
+ "darwin"
],
"engines": {
- "node": ">=18"
+ "node": ">= 10"
}
},
- "node_modules/@esbuild/android-arm": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz",
- "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==",
+ "node_modules/@napi-rs/image-darwin-x64": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-darwin-x64/-/image-darwin-x64-1.16.0.tgz",
+ "integrity": "sha512-EV/SHAnsIoadlJdyeSVtHo2RE+N6BAWTK6S3y52vvCF8/s3z38fe9o1tbk40xxPpcSXdu+gh6ASBeFHic2/NOQ==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@napi-rs/image-freebsd-x64": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-freebsd-x64/-/image-freebsd-x64-1.16.0.tgz",
+ "integrity": "sha512-2Q2XcPqeFfr5U8oL9zwZgbnfJLvFrA85+XPaOgjaUiIhEFfRKDgp5l7R0jDFZvymCw0ljMKtVzUD+Id2LUQasg==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@napi-rs/image-linux-arm-gnueabihf": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-arm-gnueabihf/-/image-linux-arm-gnueabihf-1.16.0.tgz",
+ "integrity": "sha512-qOXhoEXK66U396sBtL1wDvho4yooW6EPse0Ue23kRHlRHbR6SiDKz6mKcEoB1MrQzZGeKOYRh2F9rk0iHlsPiw==",
"cpu": [
"arm"
],
"license": "MIT",
"optional": true,
"os": [
- "android"
+ "linux"
],
"engines": {
- "node": ">=18"
+ "node": ">= 10"
}
},
- "node_modules/@esbuild/android-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz",
- "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==",
+ "node_modules/@napi-rs/image-linux-arm64-gnu": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-arm64-gnu/-/image-linux-arm64-gnu-1.16.0.tgz",
+ "integrity": "sha512-S0j/r3ciH+WW/NnsOaLwhol0wly0x0YtljZnfQ4o1YCfkVrcAPMQGgGmPyjKIG/TLQ8tqPd6liuUL4Nms017lA==",
"cpu": [
"arm64"
],
+ "libc": [
+ "glibc"
+ ],
"license": "MIT",
"optional": true,
"os": [
- "android"
+ "linux"
],
"engines": {
- "node": ">=18"
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@napi-rs/image-linux-arm64-musl": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-arm64-musl/-/image-linux-arm64-musl-1.16.0.tgz",
+ "integrity": "sha512-ILcos5cDYUQw6h2aty8BBlm5B4l4I5y52i0tSSU44HBM8tmGE6sUU1DREPfMx1NLhB2HX4xu1Y9DNQq7tIXhpQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
}
},
- "node_modules/@esbuild/android-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz",
- "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==",
+ "node_modules/@napi-rs/image-linux-x64-gnu": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-x64-gnu/-/image-linux-x64-gnu-1.16.0.tgz",
+ "integrity": "sha512-R2LnMJzHxztTYyySZnyWIiZmDxgK7pq8DWYT1jAuryCXcGmhUhM14BgEnQKj5h3zvDVbtf1czm6DSD9f8PDl4g==",
"cpu": [
"x64"
],
+ "libc": [
+ "glibc"
+ ],
"license": "MIT",
"optional": true,
"os": [
- "android"
+ "linux"
],
"engines": {
- "node": ">=18"
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@napi-rs/image-linux-x64-musl": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-x64-musl/-/image-linux-x64-musl-1.16.0.tgz",
+ "integrity": "sha512-UXcwFSIEEHia8/JhJO6H3uehQmTrsG8UK8tpD1qpzi8WHxUVgLJyuoVS3zKm8cmqlYq0No1cyqU6h2OnArShOw==",
+ "cpu": [
+ "x64"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
}
},
- "node_modules/@esbuild/darwin-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz",
- "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==",
+ "node_modules/@napi-rs/image-win32-arm64-msvc": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-win32-arm64-msvc/-/image-win32-arm64-msvc-1.16.0.tgz",
+ "integrity": "sha512-C1lmWAajIqkiYyVb0aBz0svCWIbzFAT6YpNoQ/QC/QsyNaQ602WSLSoq4ixnNhBPQrlro/Va3n/KANv4iqp4GA==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
- "darwin"
+ "win32"
],
"engines": {
- "node": ">=18"
+ "node": ">= 10"
}
},
- "node_modules/@esbuild/darwin-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz",
- "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==",
+ "node_modules/@napi-rs/image-win32-ia32-msvc": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-win32-ia32-msvc/-/image-win32-ia32-msvc-1.16.0.tgz",
+ "integrity": "sha512-j6OMycTmw47pY4m3yw4FnurkikzA8r36xgtbHqxsXWg1TGdY2uQq37Or56USNjLIeA6Oyv4az5YXc7L1oVv03w==",
+ "cpu": [
+ "ia32"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@napi-rs/image-win32-x64-msvc": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-win32-x64-msvc/-/image-win32-x64-msvc-1.16.0.tgz",
+ "integrity": "sha512-jdmbjZhvR1T++hTZpi5CYASA+2Js9tuUQGtQ0fVtrtbGt82sGkYrrax8gAVNsgyvEu9/B2yxbB/4mlJcXkwt0Q==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
- "darwin"
+ "win32"
],
"engines": {
- "node": ">=18"
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@openrouter/ai-sdk-provider": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/@openrouter/ai-sdk-provider/-/ai-sdk-provider-3.1.0.tgz",
+ "integrity": "sha512-BQy1TA9fKrh47s9ivsO6FY5QimN7GUF0i8Qon3pkxQclEgShso0dClpcWn8OIyPLEZZPFaFKgI8TW4S/O0p0Dw==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "ai": "^7.0.0",
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/@oxc-parser/binding-android-arm-eabi": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm-eabi/-/binding-android-arm-eabi-0.158.0.tgz",
+ "integrity": "sha512-eZ4sHtg/u9mzPaRPWXZ7MmJ3tSFYPDCoDrnAJEXBOIQfdAy0TnzlaJx7nq0HZwE8DkYLQg6GqGZlcjaJrnijKg==",
+ "cpu": [
+ "arm"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/freebsd-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz",
- "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==",
+ "node_modules/@oxc-parser/binding-android-arm64": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm64/-/binding-android-arm64-0.158.0.tgz",
+ "integrity": "sha512-Jqfn2GRXFkEukYBke/d1Hc9a3gB/qA3YRZ1u0D6HecjoOc3d9QvB7YFWyaLDWc139pfH+fIMIeOQ2SNOe1mnvQ==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
- "freebsd"
+ "android"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-darwin-arm64": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-arm64/-/binding-darwin-arm64-0.158.0.tgz",
+ "integrity": "sha512-C3/Sl4HE0DE5r64UWBljMTua5aFh14/Urc6o45gK7J8HWjEttJJP26M0bK2eSWcas2zpJZrJlcvwyIxR7YqSZA==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/freebsd-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz",
- "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==",
+ "node_modules/@oxc-parser/binding-darwin-x64": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-x64/-/binding-darwin-x64-0.158.0.tgz",
+ "integrity": "sha512-IlU6PMqlk2pbqiidJ1dU5moOeVtzQf4x1n8fXixupLUixA6Sdd3a5WHclvGEZhJom4SjSan0EIpPQkXl9TnjeA==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-freebsd-x64": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-freebsd-x64/-/binding-freebsd-x64-0.158.0.tgz",
+ "integrity": "sha512-0uQD/66qKMzcz99yudx7yPWdPziXXl4S4bMxyOwXFPQ6F53Vr2DYM8Tfl9gd/32R2FXlAIqK9g8aNfwJEa0/Kg==",
"cpu": [
"x64"
],
@@ -395,13 +653,13 @@
"freebsd"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/linux-arm": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz",
- "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==",
+ "node_modules/@oxc-parser/binding-linux-arm-gnueabihf": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.158.0.tgz",
+ "integrity": "sha512-B5ZAgT/cwKVtGa14Z3PEgim8hBTAK//uX/QpwdO2ZKGMqLFDq8myV3jDU1FAGJ0aPZ24SC8X362kKrpFOYmbHg==",
"cpu": [
"arm"
],
@@ -411,15 +669,15 @@
"linux"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/linux-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz",
- "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==",
+ "node_modules/@oxc-parser/binding-linux-arm-musleabihf": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.158.0.tgz",
+ "integrity": "sha512-ZLuYVsBUejzfdFmOlY9yW+g/iCInw+pirfTu+eMk27wFcpyCG6yfTmS/qzzvKARI/VmoUdaXmEcDNUm9hdq5Cg==",
"cpu": [
- "arm64"
+ "arm"
],
"license": "MIT",
"optional": true,
@@ -427,15 +685,18 @@
"linux"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/linux-ia32": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz",
- "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==",
+ "node_modules/@oxc-parser/binding-linux-arm64-gnu": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.158.0.tgz",
+ "integrity": "sha512-QHKIX2SW3pnUFfhAKU8P9t36QlkGGfxgodwoKkp+pQNZmA/PF3DbkA8OgUHoeCIE0aFL1t9Sse+2wr6+zohdRA==",
"cpu": [
- "ia32"
+ "arm64"
+ ],
+ "libc": [
+ "glibc"
],
"license": "MIT",
"optional": true,
@@ -443,15 +704,18 @@
"linux"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/linux-loong64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz",
- "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==",
+ "node_modules/@oxc-parser/binding-linux-arm64-musl": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.158.0.tgz",
+ "integrity": "sha512-Z57mkQZMjUHh0KxxjmZLNUpqJUT5lPYYpihAOudh4PnQC79Kq7Ujy8KJsmsbla3rU0xV4aCpUKDCfVx0wnYn+Q==",
"cpu": [
- "loong64"
+ "arm64"
+ ],
+ "libc": [
+ "musl"
],
"license": "MIT",
"optional": true,
@@ -459,15 +723,18 @@
"linux"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/linux-mips64el": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz",
- "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==",
+ "node_modules/@oxc-parser/binding-linux-ppc64-gnu": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.158.0.tgz",
+ "integrity": "sha512-jl6537qMp3Tb2D0J1oYzU/xzvYOM7ZDBf4Dhg8WvgkV+wgept/r2rX30PdWTE5gNo6QdHkOTz7le+9yldU1VwQ==",
"cpu": [
- "mips64el"
+ "ppc64"
+ ],
+ "libc": [
+ "glibc"
],
"license": "MIT",
"optional": true,
@@ -475,15 +742,18 @@
"linux"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/linux-ppc64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz",
- "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==",
+ "node_modules/@oxc-parser/binding-linux-riscv64-gnu": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.158.0.tgz",
+ "integrity": "sha512-BFwDkCZ2K6VuSfBlKLItXkTYMN/8SAcFpZgBohU6qjlq4HrRKBqOXW/J0ViwZ4BHZuNFxgrhUXcM3hcalZnQaA==",
"cpu": [
- "ppc64"
+ "riscv64"
+ ],
+ "libc": [
+ "glibc"
],
"license": "MIT",
"optional": true,
@@ -491,237 +761,493 @@
"linux"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/linux-riscv64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz",
- "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==",
+ "node_modules/@oxc-parser/binding-linux-riscv64-musl": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.158.0.tgz",
+ "integrity": "sha512-3YcZPBhpDhD9BUWQct+70To5wJhY36pvn+gA04ArMCdREd76EIXB14IgYsDsRqIgOXSXT1okMpHA6UEamM/QQg==",
"cpu": [
"riscv64"
],
+ "libc": [
+ "musl"
+ ],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/linux-s390x": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz",
- "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==",
+ "node_modules/@oxc-parser/binding-linux-s390x-gnu": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.158.0.tgz",
+ "integrity": "sha512-C+HBtM/aauGsp1sRuKHnB6yqrFCfGzGgS/3b/Alwz+bGIgOCm6DiNnFEnA14MOQ1YA63ikjpmTN7LPb505pkCQ==",
"cpu": [
"s390x"
],
+ "libc": [
+ "glibc"
+ ],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/linux-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz",
- "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==",
+ "node_modules/@oxc-parser/binding-linux-x64-gnu": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.158.0.tgz",
+ "integrity": "sha512-COR5cFRE6DqmxZGE9QCJG1X7uUYxNdSYkMR7J9igRLnZqZ8ki6kJIa5S4czYHeIjdNyYn4vo1CsK3rQsK5sjrA==",
"cpu": [
"x64"
],
+ "libc": [
+ "glibc"
+ ],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/netbsd-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz",
- "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==",
+ "node_modules/@oxc-parser/binding-linux-x64-musl": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-musl/-/binding-linux-x64-musl-0.158.0.tgz",
+ "integrity": "sha512-lF8YZdySxTjYnHfitZpbFWpyyxDchZj+TIyvDnzH3AGZlUvyrsu7BeORPdf05cLFwiyb+RPqAae4EJ7uu5xAhg==",
"cpu": [
- "arm64"
+ "x64"
+ ],
+ "libc": [
+ "musl"
],
"license": "MIT",
"optional": true,
"os": [
- "netbsd"
+ "linux"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/netbsd-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz",
- "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==",
+ "node_modules/@oxc-parser/binding-openharmony-arm64": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-openharmony-arm64/-/binding-openharmony-arm64-0.158.0.tgz",
+ "integrity": "sha512-m2HMKQgNNatcwOeCDCewrW5gvmHE61WFKl2J4KHiCGNpJb6ZI8n3T/JzwxFkt8kY3E27fJwvHM6t3WIEgtPiAA==",
"cpu": [
- "x64"
+ "arm64"
],
"license": "MIT",
"optional": true,
"os": [
- "netbsd"
+ "openharmony"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/openbsd-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz",
- "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==",
+ "node_modules/@oxc-parser/binding-win32-arm64-msvc": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.158.0.tgz",
+ "integrity": "sha512-Kksc5jIB7cE9vgoePyIQ8sRkXA4kAfO5oDEI6X+JJMGGTRnvtGafQniLXAHur9XU+5hUgMOGoZcyA8L+JvBu6g==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
- "openbsd"
+ "win32"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-win32-ia32-msvc": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.158.0.tgz",
+ "integrity": "sha512-HhxU9z7t6gqSh7UslTwD/wha5U2uD44Ss7GKtrBSJfG061iDrJ1Qk63N0Dzh3clax9pjJgYFnMpQRt72Q1bP8w==",
+ "cpu": [
+ "ia32"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/openbsd-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz",
- "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==",
+ "node_modules/@oxc-parser/binding-win32-x64-msvc": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.158.0.tgz",
+ "integrity": "sha512-/SLN0ot62iL6XhmsWyLdU+37vjVCgDP96sOqeCPIFov63odr4DPv9vgq+lIkZMBMOxpWsSMcwDfpERsRAyCl8A==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
- "openbsd"
+ "win32"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-project/runtime": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-project/runtime/-/runtime-0.158.0.tgz",
+ "integrity": "sha512-OYWBlK/wnZHyol5jkvBJadD8KTR6DJfFDRClqrU6kBDQKHd4bXNZALg3qfXk0aFl6F5loSxMT24EZurNWE4MKQ==",
+ "license": "MIT",
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-project/types": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.158.0.tgz",
+ "integrity": "sha512-xZ66qA4WmLbTLlxH3mqMd8f9UKbaOzOT0ATwFf4DH/14pMgpUrtqtjyYzOQmgfl2a0iRAAMbQ9G1th/67jRzGw==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/oxc-project"
+ }
+ },
+ "node_modules/@oxc-transform/binding-android-arm-eabi": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-android-arm-eabi/-/binding-android-arm-eabi-0.158.0.tgz",
+ "integrity": "sha512-TUBwLmfBgoD2KlYlqeiajavHn64GPOZw7UNvUMN2TVch9o87AHUUUIFVAdHipkZnIGJW7EXbpS/zC/rS/taEXQ==",
+ "cpu": [
+ "arm"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/openharmony-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz",
- "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==",
+ "node_modules/@oxc-transform/binding-android-arm64": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-android-arm64/-/binding-android-arm64-0.158.0.tgz",
+ "integrity": "sha512-bVlAwj8xUhhCHrlsOSUtwNz+WiWoO3YjtywvUN+X0wxkbzESVaHs/5Myh6eCwhSQC7EBe1hb1JW91AtXM9huEw==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
- "openharmony"
+ "android"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/sunos-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz",
- "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==",
+ "node_modules/@oxc-transform/binding-darwin-arm64": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-darwin-arm64/-/binding-darwin-arm64-0.158.0.tgz",
+ "integrity": "sha512-2YVfdhu3xhuN6W4jCUuQ0po7+sZEHDm/BRDuwl1ohGg/0uc2hVmdz0ECux8yPGTrEyBzk1umnh1zjlNj0o8r1A==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-transform/binding-darwin-x64": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-darwin-x64/-/binding-darwin-x64-0.158.0.tgz",
+ "integrity": "sha512-3muQhBK20O7n6/SZAbzk8qpPTlYjJgY2tvzz7l+M8NrxJputaei/cVAbaMskT9a3bUMy//0S7tkbC0jLa8SU/w==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
- "sunos"
+ "darwin"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/win32-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz",
- "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==",
+ "node_modules/@oxc-transform/binding-freebsd-x64": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-freebsd-x64/-/binding-freebsd-x64-0.158.0.tgz",
+ "integrity": "sha512-7sDIXf8jFXMy7v8Xa7UPy5uYW2i653Fr1LtpTkDVd+ZaTDwe4YMbmYs+4WTNf6l0Jm9c8OAJYtbKmC923SIVsQ==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-transform/binding-linux-arm-gnueabihf": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.158.0.tgz",
+ "integrity": "sha512-2O6jQVPipXMI+s3vkD9GNS/fCLgb4tAMJhwbp1HSvAYkLWiGi9NzyNc2m/SZUhfyIZFCQEdijrlzr+GdQP8gwA==",
+ "cpu": [
+ "arm"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-transform/binding-linux-arm-musleabihf": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.158.0.tgz",
+ "integrity": "sha512-qmXhfIbGzQvBnWS9b0JzxU/X6MSD9WJX/n0uMA9BtM41w4FV5JW+J8X5V95ynmyH3zHK7PVyF2rt2gZzQZmxyw==",
+ "cpu": [
+ "arm"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-transform/binding-linux-arm64-gnu": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.158.0.tgz",
+ "integrity": "sha512-P+RzamkgKwCHualNSfJECuQEzhiJvp+TtMDSfz64Pv5to/Jo1YwrFHG7yQQW0Bi/ogS52tB3FTpS48pFZIf1Tg==",
"cpu": [
"arm64"
],
+ "libc": [
+ "glibc"
+ ],
"license": "MIT",
"optional": true,
"os": [
- "win32"
+ "linux"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/win32-ia32": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz",
- "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==",
+ "node_modules/@oxc-transform/binding-linux-arm64-musl": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.158.0.tgz",
+ "integrity": "sha512-thXTdeEIzoGFlcXwy8cyOQPN50ESOKh3oQRXIhQ0p0Uv8qAOCJKP7W6PyOL1tUG6bojzK/mExeXrywHSazzTRw==",
"cpu": [
- "ia32"
+ "arm64"
+ ],
+ "libc": [
+ "musl"
],
"license": "MIT",
"optional": true,
"os": [
- "win32"
+ "linux"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-transform/binding-linux-ppc64-gnu": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.158.0.tgz",
+ "integrity": "sha512-KtB9LeoIjWsp1XUxBBnPpyvdSHFlvz2NsrYo/qI1CiV/OGteonpwjiefjRgZJXjCwjXr5gCsmjhfwJcUTm23Og==",
+ "cpu": [
+ "ppc64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-transform/binding-linux-riscv64-gnu": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.158.0.tgz",
+ "integrity": "sha512-W55jszyeaJXopbCA5l9uJCb88x7wKF0oIDHAg1dR88rtrAw6dmiuYfPkdZ84cyXg8P/v+XVr9rkVlkYlbkfIsw==",
+ "cpu": [
+ "riscv64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-transform/binding-linux-riscv64-musl": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.158.0.tgz",
+ "integrity": "sha512-5FyU9wNk61DpDVn5ng6wMFyqbm76gOZQDfRNrbWQgOtXc6R3f6cV3j/GMq28p0qYk6VKI2h7M8B1nAmlZzMSAg==",
+ "cpu": [
+ "riscv64"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-transform/binding-linux-s390x-gnu": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.158.0.tgz",
+ "integrity": "sha512-qntXPrX0g1JZy0VlHlt+66Pd1SRKJBHiEc53Ke+LgxGvM9A5OXVYUdiEhQmmGFCzgQXrGCpgLaGif1ZHUtpykg==",
+ "cpu": [
+ "s390x"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@esbuild/win32-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz",
- "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==",
+ "node_modules/@oxc-transform/binding-linux-x64-gnu": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.158.0.tgz",
+ "integrity": "sha512-s60b0VyQ6sPZCaHF7uAyEmd4iH1NSdjCyEiN2fPKWuak0JObS1HLpFoXp8TlB15Qn9jcH6tF1gJ9x4Jbc5mRMQ==",
"cpu": [
"x64"
],
+ "libc": [
+ "glibc"
+ ],
"license": "MIT",
"optional": true,
"os": [
- "win32"
+ "linux"
],
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@modelcontextprotocol/core": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/@modelcontextprotocol/core/-/core-2.2.0.tgz",
- "integrity": "sha512-iLhmprRmWI8EcosOA3wVvww22z02NkgqhV4fBH6f/odQBsi7xnJc0HGmi21yWO+/iKw2yzqVE127Zhna5/+JXw==",
+ "node_modules/@oxc-transform/binding-linux-x64-musl": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-linux-x64-musl/-/binding-linux-x64-musl-0.158.0.tgz",
+ "integrity": "sha512-jbC4zZkWAZL4GPLzDyZJmghvr/fwhgvEDiSNG5XWKgm0Rmd4SkZSoJ50+Oh9wxBUTcSG69gbBe5SajRV/JioHQ==",
+ "cpu": [
+ "x64"
+ ],
+ "libc": [
+ "musl"
+ ],
"license": "MIT",
- "dependencies": {
- "zod": "^4.2.0"
- },
+ "optional": true,
+ "os": [
+ "linux"
+ ],
"engines": {
- "node": ">=20"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@modelcontextprotocol/server": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/@modelcontextprotocol/server/-/server-2.2.0.tgz",
- "integrity": "sha512-qFnltjus6Gk8Lx6J1w2RXmr3YPN22MNT6qD6zjAkaiWIlFIFxWClz0rXHNuJF/KSUyn5YGhkSvXkWDbQHVLFEQ==",
+ "node_modules/@oxc-transform/binding-openharmony-arm64": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-openharmony-arm64/-/binding-openharmony-arm64-0.158.0.tgz",
+ "integrity": "sha512-Enlb11rHHv3hVO4vWxCrQiK2AKb9SIMoLqkrqaTUJkmO0xcP1vUt9L4vwWvAYVHHx9PZIkyQd3xF7uVXK+3BRA==",
+ "cpu": [
+ "arm64"
+ ],
"license": "MIT",
- "dependencies": {
- "@modelcontextprotocol/core": "2.2.0",
- "zod": "^4.2.0"
- },
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
"engines": {
- "node": ">=20"
+ "node": "^20.19.0 || >=22.12.0"
}
},
- "node_modules/@openrouter/ai-sdk-provider": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/@openrouter/ai-sdk-provider/-/ai-sdk-provider-3.1.0.tgz",
- "integrity": "sha512-BQy1TA9fKrh47s9ivsO6FY5QimN7GUF0i8Qon3pkxQclEgShso0dClpcWn8OIyPLEZZPFaFKgI8TW4S/O0p0Dw==",
- "license": "Apache-2.0",
+ "node_modules/@oxc-transform/binding-win32-arm64-msvc": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.158.0.tgz",
+ "integrity": "sha512-AUaFdp+nJ6nlz3mRaqiS5RABPip7Mo3L+IvyxeqZhz19I8zrz14bIRmOSOgOOXBbSBtodNHa+C7lxgNnrviTfQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
"engines": {
- "node": ">=22"
- },
- "peerDependencies": {
- "ai": "^7.0.0",
- "zod": "^3.25.76 || ^4.1.8"
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-transform/binding-win32-ia32-msvc": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.158.0.tgz",
+ "integrity": "sha512-0yFhGPHcqkpk9r+J9LrJjX2ghaTooUOo3UqRLqMbOfyVeMyGHT+ZDn+SeYoGXedCtxIPuRgqdabJbYS0wMwl6g==",
+ "cpu": [
+ "ia32"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-transform/binding-win32-x64-msvc": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/@oxc-transform/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.158.0.tgz",
+ "integrity": "sha512-YLkL1cm49dYa8TAAAaQjBApi5pm/tqLozpqMu0cLcnSv/rVnVbzUuAwwwqof2p1uHJtn4Chnce1HUilW1AtX7g==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@standard-schema/spec": {
@@ -756,52 +1282,52 @@
}
},
"node_modules/@vitest/expect": {
- "version": "5.0.2",
- "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-5.0.2.tgz",
- "integrity": "sha512-pd6YDkhOHptwC65NYNpGpNxWlJH9M9Gxwtej73osTddb1NpiE0Jz5CIjTTEGXRgK0YtiSN7qBokmBXZ5uPJL1w==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-5.1.0.tgz",
+ "integrity": "sha512-Okx71SHCjnfax7YLaxcJzZINi71BF2S5FezzQipheEQsiBAB0dhRBwuQ7uCJUH0/eGAT6HgAtmVVzrEZo6Qmcw==",
"license": "MIT",
"dependencies": {
"@standard-schema/spec": "^1.1.0",
"@types/chai": "^5.2.2",
- "@vitest/spy": "5.0.2",
- "@vitest/utils": "5.0.2",
- "chai": "^6.2.2",
- "tinyrainbow": "^3.1.1"
+ "@vitest/spy": "5.1.0",
+ "@vitest/utils": "5.1.0",
+ "chai": "^6.3.0",
+ "tinyrainbow": "^3.2.0"
},
"funding": {
"url": "https://opencollective.com/vitest"
}
},
"node_modules/@vitest/pretty-format": {
- "version": "5.0.2",
- "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-5.0.2.tgz",
- "integrity": "sha512-YHM+mQQ7N1ROHMugJ7P/M+fC/q1G4zs/iAMZZCvhHcY8WkwPQcXBHD+z18oz+808Cfa12K7jOr3XPQMcLIovjw==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-5.1.0.tgz",
+ "integrity": "sha512-IRx5mc30CrFzyMNni6SZKQ1r53kv049Mcvvk0WbWcD6PUz/bFjG4zYv0KosQAeonPpGp5WxqYBMqdSOfJfvVWw==",
"license": "MIT",
"dependencies": {
- "tinyrainbow": "^3.1.1"
+ "tinyrainbow": "^3.2.0"
},
"funding": {
"url": "https://opencollective.com/vitest"
}
},
"node_modules/@vitest/spy": {
- "version": "5.0.2",
- "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.2.tgz",
- "integrity": "sha512-Ijc7T1nT9efNb5LxvjaBrEqw3f/QwUv5EE0nKqZxgqsaV/FxAAZ8baGylA8X/Z2oS4Lp+K74Jr6dTJsDKxJDeg==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.0.tgz",
+ "integrity": "sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A==",
"license": "MIT",
"funding": {
"url": "https://opencollective.com/vitest"
}
},
"node_modules/@vitest/utils": {
- "version": "5.0.2",
- "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-5.0.2.tgz",
- "integrity": "sha512-mgpUtxFhKeOKVaArBVHNJGdYHAeRh135o59l13uVmPUCS1OUtis5pBqXEgE25iqRgFqEBwXvJlkhknRsYnMeqg==",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-5.1.0.tgz",
+ "integrity": "sha512-V+qgCwkvVw+s1t1S5TaoBHsLi5Sz/YmohCMoOu0mZ8ZQst2bKhRYARAQucWpVg8D0mv0x5MHcWXY5QdOsoiGBQ==",
"license": "MIT",
"dependencies": {
- "@vitest/pretty-format": "5.0.2",
+ "@vitest/pretty-format": "5.1.0",
"convert-source-map": "^2.0.0",
- "tinyrainbow": "^3.1.1"
+ "tinyrainbow": "^3.2.0"
},
"funding": {
"url": "https://opencollective.com/vitest"
@@ -814,9 +1340,9 @@
"license": "Apache-2.0"
},
"node_modules/agent-device": {
- "version": "0.21.20",
- "resolved": "https://registry.npmjs.org/agent-device/-/agent-device-0.21.20.tgz",
- "integrity": "sha512-nD2QNRTbQo3mMEnpOTqgguIreY98lri+VfWBo0Njzc+CLBrISHApUJD2Cs2P8zfzvZCvbGibX1D+LP/B/qeQrQ==",
+ "version": "0.21.37",
+ "resolved": "https://registry.npmjs.org/agent-device/-/agent-device-0.21.37.tgz",
+ "integrity": "sha512-IepPH4OtF3rrf51bxAACGCCaHX4Uj7xt5vlbG3sQyNAVzYnSJpOXpn3INQ1gZhZV/tiCIxI3Z+KAIGeiULKc1A==",
"license": "MIT",
"bin": {
"agent-device": "bin/agent-device.mjs"
@@ -900,9 +1426,9 @@
}
},
"node_modules/commander": {
- "version": "15.0.0",
- "resolved": "https://registry.npmjs.org/commander/-/commander-15.0.0.tgz",
- "integrity": "sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==",
+ "version": "15.1.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-15.1.0.tgz",
+ "integrity": "sha512-cgnQ88TRrWcC7pVq46RzJVRMktu3W2RcbnoidnfBsl1bmDCBwJS/udcIZpKoCrbAYYaCqsz1yZCVIgbIaU3ddQ==",
"license": "MIT",
"engines": {
"node": ">=22.12.0"
@@ -915,26 +1441,32 @@
"license": "MIT"
},
"node_modules/e2e": {
- "version": "0.17.0",
- "resolved": "https://registry.npmjs.org/e2e/-/e2e-0.17.0.tgz",
- "integrity": "sha512-Q8pgMUgp0wY7f5Zs2w0CLmFr1s95rdYyIquEFH8sjU7dYOTSVzvq/xkXCO2FVZFHdcgeO4mvFkdMg+7NyNG+LA==",
+ "version": "0.23.1",
+ "resolved": "https://registry.npmjs.org/e2e/-/e2e-0.23.1.tgz",
+ "integrity": "sha512-s4jTPadzzOt9OC2q1vKP80CfOvwLw5lvkFw5uvZnlh+pB5u7Rosx8yazK9Y/TbzSyRXzQr4t2FwQpQMXHlYZLg==",
"license": "Apache-2.0",
"dependencies": {
- "@ai-sdk/provider": "4.0.18",
- "@clack/prompts": "1.8.1",
- "@modelcontextprotocol/server": "2.2.0",
- "@vitest/expect": "5.0.2",
- "commander": "15.0.0",
+ "@ai-sdk/provider": "4.0.37",
+ "@clack/prompts": "1.9.0",
+ "@jridgewell/remapping": "2.3.5",
+ "@modelcontextprotocol/server": "2.4.0",
+ "@napi-rs/image": "1.16.0",
+ "@oxc-project/runtime": "0.158.0",
+ "@vitest/expect": "5.1.0",
+ "commander": "15.1.0",
+ "get-tsconfig": "4.14.3",
+ "oxc-parser": "0.158.0",
+ "oxc-transform": "0.158.0",
"picocolors": "1.1.1",
- "pngjs": "7.0.0",
- "tsx": "4.23.14",
- "zod": "4.6.1"
+ "pixelmatch": "8.0.0",
+ "toml-eslint-parser": "1.0.3",
+ "zod": "4.6.7"
},
"bin": {
"e2e": "dist/cli/bin.js"
},
"engines": {
- "node": ">=22.12.0"
+ "node": "^22.22.3 || >=24.8.0"
},
"peerDependencies": {
"@ai-sdk/anthropic": "^4.0.0",
@@ -966,9 +1498,9 @@
}
},
"node_modules/e2e/node_modules/@ai-sdk/provider": {
- "version": "4.0.18",
- "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.18.tgz",
- "integrity": "sha512-+GZJIgz1jk86pwEbb3f1BD2bdoSKyWE4Jg4YUc7NMnMozbWemSKYZcw2F4nMaO5qwsL5A8RmioAKW81YktRpIQ==",
+ "version": "4.0.37",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.37.tgz",
+ "integrity": "sha512-4uPgZ3qiX/JaQFr0dQoibUzHImZit9u05ro2BxGUnJwU4fV28BOAbKUa2OjQvqtM1tMac3bTKkaXdyzGovQXqg==",
"license": "Apache-2.0",
"dependencies": {
"json-schema": "^0.4.0"
@@ -977,54 +1509,16 @@
"node": ">=22"
}
},
- "node_modules/e2e/node_modules/zod": {
- "version": "4.6.1",
- "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.1.tgz",
- "integrity": "sha512-341aRWQsve0rvronKNTqZpjmzdbUDlFuzHaI/XLg/Ej82qffDJRRfBTCuv7+9q/rMjB6LSLyEBnW4InJeMtt/Q==",
- "license": "MIT",
- "funding": {
- "url": "https://github.com/sponsors/colinhacks"
- }
- },
- "node_modules/esbuild": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz",
- "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==",
- "hasInstallScript": true,
- "license": "MIT",
- "bin": {
- "esbuild": "bin/esbuild"
- },
+ "node_modules/eslint-visitor-keys": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz",
+ "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==",
+ "license": "Apache-2.0",
"engines": {
- "node": ">=18"
+ "node": "^20.19.0 || ^22.13.0 || >=24"
},
- "optionalDependencies": {
- "@esbuild/aix-ppc64": "0.28.2",
- "@esbuild/android-arm": "0.28.2",
- "@esbuild/android-arm64": "0.28.2",
- "@esbuild/android-x64": "0.28.2",
- "@esbuild/darwin-arm64": "0.28.2",
- "@esbuild/darwin-x64": "0.28.2",
- "@esbuild/freebsd-arm64": "0.28.2",
- "@esbuild/freebsd-x64": "0.28.2",
- "@esbuild/linux-arm": "0.28.2",
- "@esbuild/linux-arm64": "0.28.2",
- "@esbuild/linux-ia32": "0.28.2",
- "@esbuild/linux-loong64": "0.28.2",
- "@esbuild/linux-mips64el": "0.28.2",
- "@esbuild/linux-ppc64": "0.28.2",
- "@esbuild/linux-riscv64": "0.28.2",
- "@esbuild/linux-s390x": "0.28.2",
- "@esbuild/linux-x64": "0.28.2",
- "@esbuild/netbsd-arm64": "0.28.2",
- "@esbuild/netbsd-x64": "0.28.2",
- "@esbuild/openbsd-arm64": "0.28.2",
- "@esbuild/openbsd-x64": "0.28.2",
- "@esbuild/openharmony-arm64": "0.28.2",
- "@esbuild/sunos-x64": "0.28.2",
- "@esbuild/win32-arm64": "0.28.2",
- "@esbuild/win32-ia32": "0.28.2",
- "@esbuild/win32-x64": "0.28.2"
+ "funding": {
+ "url": "https://opencollective.com/eslint"
}
},
"node_modules/eventsource-parser": {
@@ -1060,18 +1554,16 @@
"fast-string-width": "^3.0.2"
}
},
- "node_modules/fsevents": {
- "version": "2.3.3",
- "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
- "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
- "hasInstallScript": true,
+ "node_modules/get-tsconfig": {
+ "version": "4.14.3",
+ "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.14.3.tgz",
+ "integrity": "sha512-++QEw4DIY7WGoukz+/+A/8dGYPT9l9yIadnmSgZ8Rjr3YVSVDipQSO9CdnJo9ePqFqUUqh+wk9uIaoiAwsiPkA==",
"license": "MIT",
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ "dependencies": {
+ "resolve-pkg-maps": "^1.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
},
"node_modules/json-schema": {
@@ -1080,12 +1572,93 @@
"integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==",
"license": "(AFL-2.1 OR BSD-3-Clause)"
},
+ "node_modules/oxc-parser": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.158.0.tgz",
+ "integrity": "sha512-BKmaZZXp667kLC8Od/ivIkbw6yaxTSqw8ViI1Tvl21E6r+6NLdwDmo43LpL2Ebt/PDMu1d4tcdBucMSor+cL1g==",
+ "license": "MIT",
+ "dependencies": {
+ "@oxc-project/types": "^0.158.0"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/oxc-project"
+ },
+ "optionalDependencies": {
+ "@oxc-parser/binding-android-arm-eabi": "0.158.0",
+ "@oxc-parser/binding-android-arm64": "0.158.0",
+ "@oxc-parser/binding-darwin-arm64": "0.158.0",
+ "@oxc-parser/binding-darwin-x64": "0.158.0",
+ "@oxc-parser/binding-freebsd-x64": "0.158.0",
+ "@oxc-parser/binding-linux-arm-gnueabihf": "0.158.0",
+ "@oxc-parser/binding-linux-arm-musleabihf": "0.158.0",
+ "@oxc-parser/binding-linux-arm64-gnu": "0.158.0",
+ "@oxc-parser/binding-linux-arm64-musl": "0.158.0",
+ "@oxc-parser/binding-linux-ppc64-gnu": "0.158.0",
+ "@oxc-parser/binding-linux-riscv64-gnu": "0.158.0",
+ "@oxc-parser/binding-linux-riscv64-musl": "0.158.0",
+ "@oxc-parser/binding-linux-s390x-gnu": "0.158.0",
+ "@oxc-parser/binding-linux-x64-gnu": "0.158.0",
+ "@oxc-parser/binding-linux-x64-musl": "0.158.0",
+ "@oxc-parser/binding-openharmony-arm64": "0.158.0",
+ "@oxc-parser/binding-win32-arm64-msvc": "0.158.0",
+ "@oxc-parser/binding-win32-ia32-msvc": "0.158.0",
+ "@oxc-parser/binding-win32-x64-msvc": "0.158.0"
+ }
+ },
+ "node_modules/oxc-transform": {
+ "version": "0.158.0",
+ "resolved": "https://registry.npmjs.org/oxc-transform/-/oxc-transform-0.158.0.tgz",
+ "integrity": "sha512-muHHb5xftnipB4HKP/zvbxxoE7eH+5AhKyO1az7D2AX2xvsbC9NWADiuZhTnAldoiRQ7QrSw2yJTJdz44LyCbw==",
+ "license": "MIT",
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/oxc-project"
+ },
+ "optionalDependencies": {
+ "@oxc-transform/binding-android-arm-eabi": "0.158.0",
+ "@oxc-transform/binding-android-arm64": "0.158.0",
+ "@oxc-transform/binding-darwin-arm64": "0.158.0",
+ "@oxc-transform/binding-darwin-x64": "0.158.0",
+ "@oxc-transform/binding-freebsd-x64": "0.158.0",
+ "@oxc-transform/binding-linux-arm-gnueabihf": "0.158.0",
+ "@oxc-transform/binding-linux-arm-musleabihf": "0.158.0",
+ "@oxc-transform/binding-linux-arm64-gnu": "0.158.0",
+ "@oxc-transform/binding-linux-arm64-musl": "0.158.0",
+ "@oxc-transform/binding-linux-ppc64-gnu": "0.158.0",
+ "@oxc-transform/binding-linux-riscv64-gnu": "0.158.0",
+ "@oxc-transform/binding-linux-riscv64-musl": "0.158.0",
+ "@oxc-transform/binding-linux-s390x-gnu": "0.158.0",
+ "@oxc-transform/binding-linux-x64-gnu": "0.158.0",
+ "@oxc-transform/binding-linux-x64-musl": "0.158.0",
+ "@oxc-transform/binding-openharmony-arm64": "0.158.0",
+ "@oxc-transform/binding-win32-arm64-msvc": "0.158.0",
+ "@oxc-transform/binding-win32-ia32-msvc": "0.158.0",
+ "@oxc-transform/binding-win32-x64-msvc": "0.158.0"
+ }
+ },
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"license": "ISC"
},
+ "node_modules/pixelmatch": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-8.0.0.tgz",
+ "integrity": "sha512-cIqOLfh5k52us715qf3B3+kTOxZv+WDv77HN7xokLScYQGYQHi4m/ynoDIPpvF2LvCyUJGyvzY64i0QCXtzu1g==",
+ "license": "ISC",
+ "dependencies": {
+ "pngjs": "^7.0.0"
+ },
+ "bin": {
+ "pixelmatch": "bin/pixelmatch"
+ }
+ },
"node_modules/pngjs": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-7.0.0.tgz",
@@ -1095,11 +1668,23 @@
"node": ">=14.19.0"
}
},
+ "node_modules/resolve-pkg-maps": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz",
+ "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"
+ }
+ },
"node_modules/sisteransi": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
- "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==",
- "license": "MIT"
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-2.0.0.tgz",
+ "integrity": "sha512-2WCqLdt12eN6ehLI50S2/ZxoowXU3DD1KVPRyVP0WEsFahrGZZmCdq1K59qjJljMRIDTwx1D9YaRK+hDneBUMg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=20"
+ }
},
"node_modules/tinyrainbow": {
"version": "3.2.0",
@@ -1110,22 +1695,19 @@
"node": ">=14.0.0"
}
},
- "node_modules/tsx": {
- "version": "4.23.14",
- "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.23.14.tgz",
- "integrity": "sha512-yFwMnbAsUFz/T3kR8P2ENc/DDUaYd9tKg4oVYo0lhkX0LlK4UuqYAO6mpQ2y6lmcyip1uPJ34C2kPACopDwG4w==",
+ "node_modules/toml-eslint-parser": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/toml-eslint-parser/-/toml-eslint-parser-1.0.3.tgz",
+ "integrity": "sha512-A5F0cM6+mDleacLIEUkmfpkBbnHJFV1d2rprHU2MXNk7mlxHq2zGojA+SRvQD1RoMo9gqjZPWEaKG4v1BQ48lw==",
"license": "MIT",
"dependencies": {
- "esbuild": "~0.28.0"
- },
- "bin": {
- "tsx": "dist/cli.mjs"
+ "eslint-visitor-keys": "^5.0.0"
},
"engines": {
- "node": ">=18.0.0"
+ "node": "^20.19.0 || ^22.13.0 || >=24"
},
- "optionalDependencies": {
- "fsevents": "~2.3.3"
+ "funding": {
+ "url": "https://github.com/sponsors/ota-meshi"
}
},
"node_modules/undici": {
diff --git a/packages/runtimes/e2e/package.json b/packages/runtimes/e2e/package.json
index 60278fff..72169c06 100644
--- a/packages/runtimes/e2e/package.json
+++ b/packages/runtimes/e2e/package.json
@@ -10,10 +10,10 @@
"@ai-sdk/openai": "4.0.109",
"@ai-sdk/openai-compatible": "3.0.53",
"@ai-sdk/xai": "5.0.4",
- "@e2e-dev/mobile": "0.9.2",
+ "@e2e-dev/mobile": "0.12.7",
"@openrouter/ai-sdk-provider": "3.1.0",
"ai": "7.0.163",
- "e2e": "0.17.0",
+ "e2e": "0.23.1",
"zod": "4.6.7"
}
}
diff --git a/packages/runtimes/e2e/release.json b/packages/runtimes/e2e/release.json
index 7c42994f..10b17f0c 100644
--- a/packages/runtimes/e2e/release.json
+++ b/packages/runtimes/e2e/release.json
@@ -27,9 +27,9 @@
"integrity": "sha512-Cg3xUB0H6OA4fvcX+uamkZXuzxdjhi7HH15glxpE8boZUijFmfz3YPM3Y/HvQkuCb6D/ixCe7lpcwVjidLhw9w=="
},
"@e2e-dev/mobile": {
- "version": "0.9.2",
- "resolved": "https://registry.npmjs.org/@e2e-dev/mobile/-/mobile-0.9.2.tgz",
- "integrity": "sha512-aY09M1ckxtezydmTI6/R72R/RVuwZn42+phGekQLCkZWID1EXNQi19+leYyyZJWdH4p+E2EVgYm4k8EcilYM0Q=="
+ "version": "0.12.7",
+ "resolved": "https://registry.npmjs.org/@e2e-dev/mobile/-/mobile-0.12.7.tgz",
+ "integrity": "sha512-xssZhb7kQhA0tGqM+kPgm1dguW1HwnIhN8wnvRHh+90hENsl1WufxUEU45mEgyBVa1/ltKYtjZlYQA+lFr+x+g=="
},
"@openrouter/ai-sdk-provider": {
"version": "3.1.0",
@@ -42,9 +42,9 @@
"integrity": "sha512-nm8+qn36NQXO4Hjfj7SlbcNRhUyNXKtdoS9xhXr/z92lvdGFuPkzHmA2tFzhaUQy13IitNYrcw2QSNpEJC/iSA=="
},
"e2e": {
- "version": "0.17.0",
- "resolved": "https://registry.npmjs.org/e2e/-/e2e-0.17.0.tgz",
- "integrity": "sha512-Q8pgMUgp0wY7f5Zs2w0CLmFr1s95rdYyIquEFH8sjU7dYOTSVzvq/xkXCO2FVZFHdcgeO4mvFkdMg+7NyNG+LA=="
+ "version": "0.23.1",
+ "resolved": "https://registry.npmjs.org/e2e/-/e2e-0.23.1.tgz",
+ "integrity": "sha512-s4jTPadzzOt9OC2q1vKP80CfOvwLw5lvkFw5uvZnlh+pB5u7Rosx8yazK9Y/TbzSyRXzQr4t2FwQpQMXHlYZLg=="
},
"zod": {
"version": "4.6.7",
@@ -52,5 +52,5 @@
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg=="
}
},
- "lockfileSHA256": "fd430a6a7dde84a49d42c1763e3498a538895ca82a73f3e3b61ac555ce371edf"
+ "lockfileSHA256": "ba98f2453302f13563bdb90af28472ba524c0d562aa60379307d1e17abd72bc5"
}
From 93ec6dcbe6f375709e3fbb8390dd4ccf1af86366 Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Tue, 17 Nov 2026 12:20:55 +0500
Subject: [PATCH 07/23] feat(testing): run a test on several devices from a
lane registry
Replace the single-run globals with a registry of matrices and lanes, a
scheduler (default 3 at once, 1-8), per-lane device-pinned bundled config
and output dir, and mobile_testing_run_matrix / run_progress / cancel.
Lanes boot an off device and copy the app from another matrix device.
Co-Authored-By: Claude Sonnet 5.5
---
docs/test-matrix.md | 139 ++++++++++++++++
packages/core/src/plugin.ts | 3 +-
packages/core/src/testing-device.ts | 9 +
packages/core/src/testing-matrix.ts | 185 +++++++++++++++++++++
packages/core/src/testing-prepare.ts | 146 ++++++++++++++++
packages/core/src/testing-run.ts | 41 ++++-
packages/core/src/testing-tools.ts | 158 +++++++++++++-----
packages/core/test/testing-matrix.test.ts | 155 +++++++++++++++++
packages/core/test/testing-prepare.test.ts | 118 +++++++++++++
packages/core/test/testing-run.test.ts | 49 +++++-
10 files changed, 955 insertions(+), 48 deletions(-)
create mode 100644 docs/test-matrix.md
create mode 100644 packages/core/src/testing-matrix.ts
create mode 100644 packages/core/src/testing-prepare.ts
create mode 100644 packages/core/test/testing-matrix.test.ts
create mode 100644 packages/core/test/testing-prepare.test.ts
diff --git a/docs/test-matrix.md b/docs/test-matrix.md
new file mode 100644
index 00000000..47bb6df7
--- /dev/null
+++ b/docs/test-matrix.md
@@ -0,0 +1,139 @@
+# Test matrix — plan
+
+Status: **proposed, not started.**
+
+Run one recorded e2e test on several devices at once — e.g. iPhone 17, iPhone 16 and a Pixel emulator — from the Testing panel, or from chat through MCP.
+
+## Goals
+
+- Pick N devices (iOS simulators, Android emulators, connected phones) in the Testing panel and run the open test on all of them in parallel.
+- One lane of live progress and one result per device; a failure on one device does not stop the others.
+- Devices that are off get booted; devices missing the app get it installed.
+- At most **3** devices run at once by default; the user can change the limit. Extra devices queue.
+- The same backend tool serves the panel and chat agents ("run this test on 3 devices").
+- The project's own files are never modified: any config override lives in a throwaway temp file.
+
+## Non-goals (v1)
+
+- Sharding many test files across devices (the runner's device pool already does that; a matrix runs the *same* test on every device).
+- Hosted device farms (`DeviceProvider`).
+- Cross-device result diffing or screenshot comparison.
+
+## Where things are today
+
+| Concern | Today | File |
+|---|---|---|
+| Run trigger | `mobile_testing_run_test`, no `deviceId` sent | `packages/ui/src/testing-panel.ts:1208` |
+| Run state | module-level `progress` + `running`, one run at a time | `packages/core/src/testing-tools.ts:55` |
+| Run execution | `runRecordedTest` → `spawnRun`, one `e2e run` process | `packages/core/src/testing-run.ts:356,467` |
+| Bundled config | one target, `mobile({ platform })`, `workers: 1`, no device | `packages/core/src/testing-run.ts:419` |
+| Project config | temp wrapper importing the project's `e2e.config.ts` + progress reporter | `packages/core/src/testing-run.ts:174` (`progressConfigSource`) |
+| Device selection | single device, `DeviceAppsStore.selectDevice` | `packages/ui/src/device-apps.ts:53` |
+| Device lists | `mobile_list_simulators`, `mobile_list_ios_devices`, `mobile_list_android_devices` | `packages/ui/src/simulator-panel.ts:833` |
+| Boot | `bootAndroidEmulator`; iOS boot via agent-device catalog | `packages/core/src/android-emulator.ts:19`, `agent-device-catalog.ts` |
+| Install | `mobile_install_app` takes a built `.app`/`.apk` path | `packages/core/src/app-control/tools.ts:78` |
+
+## Architecture
+
+```mermaid
+flowchart LR
+ UI[Testing panel: Matrix] --> T[mobile_testing_run_matrix]
+ Chat[Chat agent via MCP] --> T
+ T --> Q[Scheduler: limit 3, queue rest]
+ Q --> P1[Prepare: boot → install → launch]
+ P1 --> R1[spawnRun with temp config pinned to device udid]
+ R1 --> S[runs: Map runId → lane state]
+ S --> PR[mobile_testing_run_progress matrixId]
+ PR --> UI
+```
+
+**Why one process per device, not one process with a device pool:** a pool hands *different files* to different devices. A matrix needs the *same* test on each device, independent progress, independent failure and independent cancel. One `spawnRun` per device gives all four with the existing code path.
+
+## Backend changes (`packages/core`)
+
+1. **Run registry** — replace `progress`/`running` globals in `testing-tools.ts` with:
+ ```ts
+ type LaneState = "queued" | "booting" | "installing" | "running" | "passed" | "failed" | "cancelled" | "error";
+ interface Lane { runId: string; deviceId: string; deviceName: string; platform: "ios" | "android";
+ state: LaneState; progress: TestRunProgress[]; result?: TestRunResult; error?: string; }
+ interface MatrixRun { matrixId: string; testPath: string; lanes: Lane[]; startedAt: number; limit: number; }
+ ```
+ A single-device run becomes a matrix of one, so there is one code path.
+
+2. **Tools**
+ - `mobile_testing_run_matrix { testPath, devices: {deviceId, platform}[], limit? }` → returns `{ matrixId }` immediately; work continues in the background.
+ - `mobile_testing_run_progress { matrixId }` → `{ lanes }`. Existing no-arg call keeps working by returning the latest run.
+ - `mobile_testing_cancel { matrixId, deviceId? }` → kills one lane or all.
+ - `mobile_testing_run_test` stays as a thin wrapper (matrix of one) for compatibility.
+
+3. **Scheduler** — a small promise pool with `limit` (default 3, from settings). Lanes start in selection order; a finished lane frees a slot.
+
+4. **Prepare step per lane** (before `spawnRun`)
+ - **Boot** if not booted: Android via `bootAndroidEmulator`; iOS via the existing agent-device/simctl boot path. Wait for boot-complete.
+ - **Install** if the app is missing (see *Install source* below).
+ - Reuse the existing pre-run `mobile_launch_app` behaviour per device.
+
+5. **Per-lane config, pinned to one device** — all in a per-lane temp dir, deleted after the run:
+ - *Bundled mode*: `bundledConfigSource` gains `device: ` → `mobile({ platform, device })`, and the target name becomes unique per lane.
+ - *Project mode*: `progressConfigSource` gains a `device` override that rewrites each mobile target for the lane's platform to that device (see *Risks* — needs an upstream hook).
+ - Each lane passes its own `--output /` so reports and artifacts don't collide.
+
+6. **Device leases** — `TestingDevices.release()` today frees the one recorder device. A matrix run releases the recorder/mirror only on devices in the matrix, and the panel marks those devices "busy" until their lane ends.
+
+7. **Per-platform app id** — the matrix request carries `{ ios?: bundleId, android?: packageName }`; a project may use different ids per platform. Lanes for a platform without an id fail fast with a clear message.
+
+## UI changes (`packages/ui`)
+
+1. **Matrix section in the setup popover** (`components/testing-setup.tsx`)
+ - Checklist grouped iOS / Android, from the same lists as the Platforms panel, with booted/off and "app not installed" badges.
+ - "Run up to [3] at once" number field.
+ - Selection and limit saved per project.
+
+2. **Run button** — shows "Run on N devices" when N > 1; plain "Run" otherwise.
+
+3. **Lanes view** (`components/testing-view.tsx`)
+ - One row per device: name, OS, state (Queued / Booting / Installing / Running step k of n / Passed / Failed), duration, cancel.
+ - Clicking a lane opens today's step-by-step source view for that lane's `progress`/`result`.
+ - Summary chip: "2 passed · 1 failed".
+
+4. **State** (`testing-panel.ts`) — `running: boolean` + single result become `matrix?: MatrixRun`; the 400 ms poll calls `run_progress { matrixId }` and stops when every lane is terminal.
+
+## Chat / MCP
+
+`mobile_testing_run_matrix` is a normal MCP tool, so a Codex/Claude chat can say "run checkout.e2e.ts on iPhone 17, iPhone 16 and the Pixel" → list devices → call the tool → poll progress. Tool descriptions should state the default limit and that devices will be booted and the app installed.
+
+## Settings
+
+| Key | Default | Notes |
+|---|---|---|
+| `testing.matrix.maxParallel` | 3 | 1–8 |
+| `testing.matrix.devices` | `[]` | per project, list of device ids |
+
+## Risks and open decisions
+
+1. **Overriding the device in a project config.** `mobile({...})` returns an opaque `EngineHandle`; its options can't be read or changed after the fact. Options:
+ - **a. Upstream hook (preferred):** add a device override to the e2e runner — e.g. `e2e run --device ` or an `E2E_DEVICE` env var the mobile engine honours. Clean, works for every project config.
+ - b. Rebuild the engine in the wrapper as `mobile({ platform, device })` — loses any other `mobile()` options the project set.
+ - c. Bundled-mode-only matrix in v1; project mode later.
+2. **Install source.** `mobile_install_app` needs a built `.app`/`.apk`. Proposed order: (1) copy from a device in the matrix that has it — iOS `simctl get_app_container app`, Android `adb shell pm path` + pull (split APKs need `install-multiple`); (2) project build output if known; (3) otherwise mark the lane "App not installed" with a hint to build.
+ - iOS simulator builds can't go onto physical iPhones; physical devices without the app fail that lane.
+3. **Model cost and rate limits.** Tests using `agent.act/assert/waitFor/extract` call the model per step per device; N devices ≈ N× calls. The default limit of 3 bounds this; show a note in the popover when the test needs a model.
+4. **Machine load.** Each booted simulator/emulator is heavy; the limit also bounds this. Booting counts against the limit.
+5. **Android ports.** Multiple emulators need distinct console/adb ports; `bootAndroidEmulator` must pick a free port per AVD. Verify.
+6. **Same-device conflict.** The recorder, mirror and a matrix lane can't share a device ("one session per device"). Disable recording on matrix devices while their lane runs.
+
+## Milestones
+
+1. **Backend registry + bundled-mode matrix**: run registry, `run_matrix`/`run_progress`/`cancel`, scheduler, device-pinned bundled config, per-lane output dir. Tests for scheduler and config generation.
+2. **Prepare step**: boot + install + launch per lane, with lane states.
+3. **UI**: device checklist, limit, lanes view, per-lane detail.
+4. **Project mode**: device override in the project config, via decision 1.
+5. **Docs**: update `docs/testing-panel.md` and `docs/mcp-tools.md`.
+
+## Done when
+
+- From the panel, selecting iPhone 17, iPhone 16 and a Pixel emulator and pressing Run produces three lanes that run concurrently, each ending in its own pass/fail with step detail.
+- With 4 devices selected and the default limit, the 4th lane queues until a slot frees.
+- An off simulator is booted and a device without the app gets it installed before its lane runs.
+- The same works from a chat agent through `mobile_testing_run_matrix`.
+- No file in the user's project is created or changed by a matrix run.
diff --git a/packages/core/src/plugin.ts b/packages/core/src/plugin.ts
index 905196ac..cee44d14 100644
--- a/packages/core/src/plugin.ts
+++ b/packages/core/src/plugin.ts
@@ -19,6 +19,7 @@ import { APP_FLOW_DIRECTORY, createAppFlowHost } from "./app-flow-host.ts";
import { AppFlowProjectChoices } from "./app-flow-projects.ts";
import { registerAppFlowTools } from "./app-flow-tools.ts";
import { registerTestingTools } from "./testing-tools.ts";
+import { systemDeviceOps } from "./testing-prepare.ts";
import { registerTestingAgentTools } from "./testing-agent.ts";
import { TestingDevices } from "./testing-device.ts";
import { TESTING_DIRECTORY, TestingProjectChoices } from "./testing-projects.ts";
@@ -125,7 +126,7 @@ export async function createPlugin(html: string | (() => Promise), o
// One store for both: the panel autosaves the flow it is holding and the agent keeps the flow it
// finished, and those are the same list of unsaved recordings.
const testDrafts = new TestDraftStore();
- const closeTestingDevices = registerTestingTools(server, new TestingProjectChoices(TESTING_DIRECTORY), testingDevices, testDrafts);
+ const closeTestingDevices = registerTestingTools(server, new TestingProjectChoices(TESTING_DIRECTORY), testingDevices, testDrafts, { ops: systemDeviceOps({ simulators, android, drivers }) });
registerTestingAgentTools(server, testingDevices, new TestingAgentRecordings(testingDevices, testDrafts));
const resource = async () => typeof html === "string" ? { html } : await html();
diff --git a/packages/core/src/testing-device.ts b/packages/core/src/testing-device.ts
index af22d31b..e9aff2ff 100644
--- a/packages/core/src/testing-device.ts
+++ b/packages/core/src/testing-device.ts
@@ -376,6 +376,15 @@ export class TestingDevices {
return run;
}
+ /**
+ * Releases the recorder only when it holds one of these devices. A matrix run touches only its own
+ * devices, so a recorder on some other device keeps its session.
+ */
+ async releaseOn(deviceIds: readonly string[]): Promise {
+ const held = this.attached?.split("\u0000")[1];
+ if (held !== undefined && deviceIds.includes(held)) await this.release();
+ }
+
private async releaseOnce(): Promise {
if (this.attached === undefined || this.client === undefined) return;
this.attached = undefined;
diff --git a/packages/core/src/testing-matrix.ts b/packages/core/src/testing-matrix.ts
new file mode 100644
index 00000000..b473a699
--- /dev/null
+++ b/packages/core/src/testing-matrix.ts
@@ -0,0 +1,185 @@
+import { randomUUID } from "node:crypto";
+import { errorMessage } from "@mobile-dev/shared/protocol.ts";
+import { expectedOutcome } from "@mobile-dev/shared/error-reporting.ts";
+import type { TestRunProgress, TestRunResult } from "./testing-run.ts";
+
+/**
+ * Runs one test on several devices: a registry of matrices and their lanes, and a scheduler that
+ * keeps at most `limit` lanes active at a time.
+ *
+ * One `e2e run` process per device, not the runner's own device pool: a pool hands *different
+ * files* to different devices, while a matrix needs the *same* test on each, with independent
+ * progress, failure and cancel. A single run is a matrix of one, so there is one code path.
+ */
+
+export type LaneState = "queued" | "booting" | "installing" | "running" | "passed" | "failed" | "cancelled" | "error";
+export type MatrixPlatform = "ios" | "android";
+
+const TERMINAL: ReadonlySet = new Set(["passed", "failed", "cancelled", "error"]);
+export const isTerminalLane = (state: LaneState): boolean => TERMINAL.has(state);
+
+/** The default number of lanes that run at once, and the range a caller may choose from. */
+export const DEFAULT_MATRIX_LIMIT = 3;
+export const MAX_MATRIX_LIMIT = 8;
+export function clampLimit(limit: number | undefined): number {
+ if (limit === undefined || !Number.isFinite(limit)) return DEFAULT_MATRIX_LIMIT;
+ return Math.min(MAX_MATRIX_LIMIT, Math.max(1, Math.floor(limit)));
+}
+
+export interface MatrixDevice { deviceId: string; platform: MatrixPlatform; name?: string }
+
+export interface Lane {
+ runId: string;
+ /** The device the caller asked for. An Android `avd:` name resolves to a serial once booted. */
+ deviceId: string;
+ deviceName: string;
+ platform: MatrixPlatform;
+ state: LaneState;
+ /** The device the run actually used, once it is known. */
+ resolvedDeviceId?: string;
+ progress: TestRunProgress[];
+ result?: TestRunResult;
+ error?: string;
+ startedAt?: number;
+ finishedAt?: number;
+}
+
+export interface MatrixRun {
+ matrixId: string;
+ testPath: string;
+ lanes: Lane[];
+ startedAt: number;
+ finishedAt?: number;
+ limit: number;
+}
+
+/** A promise pool: at most `limit` tasks run at once, the rest wait in submission order. */
+export class Scheduler {
+ readonly limit: number;
+ private active = 0;
+ private readonly waiting: (() => void)[] = [];
+
+ constructor(limit: number) { this.limit = clampLimit(limit); }
+
+ get running(): number { return this.active; }
+ get queued(): number { return this.waiting.length; }
+
+ async run(task: () => Promise): Promise {
+ if (this.active >= this.limit) await new Promise(resolve => this.waiting.push(resolve));
+ else this.active += 1;
+ try { return await task(); }
+ finally {
+ const next = this.waiting.shift();
+ // The slot passes straight to the next waiter, so `active` is unchanged.
+ if (next) next(); else this.active -= 1;
+ }
+ }
+}
+
+interface Entry { run: MatrixRun; aborts: Map }
+
+/** The matrices of this server, newest last. Old finished ones are dropped so memory stays bounded. */
+export class MatrixRegistry {
+ private readonly entries = new Map();
+ private readonly keep: number;
+
+ constructor(keep = 20) { this.keep = keep; }
+
+ create(testPath: string, devices: MatrixDevice[], limit: number): { run: MatrixRun; aborts: Map } {
+ const run: MatrixRun = {
+ matrixId: randomUUID(), testPath, startedAt: Date.now(), limit: clampLimit(limit),
+ lanes: devices.map(device => ({
+ runId: randomUUID(), deviceId: device.deviceId, deviceName: device.name ?? device.deviceId,
+ platform: device.platform, state: "queued" as LaneState, progress: [],
+ })),
+ };
+ const aborts = new Map(run.lanes.map(lane => [lane.runId, new AbortController()]));
+ this.entries.set(run.matrixId, { run, aborts });
+ this.prune();
+ return { run, aborts };
+ }
+
+ private prune() {
+ for (const [id, entry] of this.entries) {
+ if (this.entries.size <= this.keep) return;
+ if (entry.run.lanes.every(lane => isTerminalLane(lane.state))) this.entries.delete(id);
+ }
+ }
+
+ get(matrixId: string): MatrixRun | undefined { return this.entries.get(matrixId)?.run; }
+
+ latest(): MatrixRun | undefined { return [...this.entries.values()].at(-1)?.run; }
+
+ /** Whether any lane of any matrix is still queued or active. */
+ get busy(): boolean { return [...this.entries.values()].some(entry => entry.run.lanes.some(lane => !isTerminalLane(lane.state))); }
+
+ /** Device ids that a lane that has not finished is using or will use. */
+ busyDevices(): string[] {
+ return [...new Set([...this.entries.values()].flatMap(entry => entry.run.lanes
+ .filter(lane => !isTerminalLane(lane.state)).flatMap(lane => [lane.deviceId, ...(lane.resolvedDeviceId ? [lane.resolvedDeviceId] : [])])))];
+ }
+
+ /** Cancels one lane (by device) or every lane of the matrix. Returns the lanes that were cancelled. */
+ cancel(matrixId: string, deviceId?: string): Lane[] {
+ const entry = this.entries.get(matrixId);
+ if (!entry) return [];
+ const cancelled: Lane[] = [];
+ for (const lane of entry.run.lanes) {
+ if (isTerminalLane(lane.state)) continue;
+ if (deviceId !== undefined && lane.deviceId !== deviceId && lane.resolvedDeviceId !== deviceId) continue;
+ entry.aborts.get(lane.runId)?.abort();
+ // A lane that has not started yields at once; an active one is marked when its process ends.
+ if (lane.state === "queued") { lane.state = "cancelled"; lane.finishedAt = Date.now(); }
+ cancelled.push(lane);
+ }
+ return cancelled;
+ }
+}
+
+/** Everything a lane needs from the outside world; faked in tests. */
+export interface LaneExecutor {
+ /**
+ * Gets the device ready: boots it and installs the app when they are missing. Reports each phase
+ * through `setState` and returns the device id the run should use.
+ */
+ prepare(lane: Lane, lanes: readonly Lane[], signal: AbortSignal, setState: (state: "booting" | "installing") => void): Promise;
+ run(lane: Lane, deviceId: string, signal: AbortSignal, onProgress: (progress: TestRunProgress) => void): Promise;
+}
+
+/** How a finished runner status maps to a lane state. */
+export function laneStateFor(status: string): LaneState { return status === "passed" ? "passed" : "failed"; }
+
+/**
+ * Starts the matrix and returns immediately; the lanes advance in the background and the caller
+ * polls the registry. The returned promise settles when every lane is terminal (tests await it).
+ */
+export function startMatrix(registry: MatrixRegistry, input: { testPath: string; devices: MatrixDevice[]; limit?: number }, executor: LaneExecutor): { run: MatrixRun; done: Promise } {
+ const { run, aborts } = registry.create(input.testPath, input.devices, clampLimit(input.limit));
+ const scheduler = new Scheduler(run.limit);
+ const done = Promise.all(run.lanes.map(lane => scheduler.run(() => runLane(run, lane, aborts.get(lane.runId)!.signal, executor)))).then(() => { run.finishedAt = Date.now(); });
+ return { run, done };
+}
+
+async function runLane(run: MatrixRun, lane: Lane, signal: AbortSignal, executor: LaneExecutor): Promise {
+ if (signal.aborted || lane.state === "cancelled") { settle(lane, "cancelled"); return; }
+ lane.startedAt = Date.now();
+ try {
+ const deviceId = await executor.prepare(lane, run.lanes, signal, state => { lane.state = state; });
+ lane.resolvedDeviceId = deviceId;
+ signal.throwIfAborted();
+ lane.state = "running";
+ const result = await executor.run(lane, deviceId, signal, entry => { lane.progress.push(entry); });
+ lane.result = result;
+ settle(lane, laneStateFor(result.status));
+ } catch (error) {
+ if (signal.aborted || expectedOutcome(error) === "cancelled") settle(lane, "cancelled");
+ else { lane.error = errorMessage(error); settle(lane, "error"); }
+ }
+}
+
+function settle(lane: Lane, state: LaneState) { lane.state = state; lane.finishedAt = Date.now(); }
+
+/** A copy for the wire: the registry's own objects keep changing while the caller holds the answer. */
+export function snapshotMatrix(run: MatrixRun): MatrixRun {
+ return { ...run, lanes: run.lanes.map(lane => ({ ...lane, progress: [...lane.progress] })) };
+}
diff --git a/packages/core/src/testing-prepare.ts b/packages/core/src/testing-prepare.ts
new file mode 100644
index 00000000..abf60c26
--- /dev/null
+++ b/packages/core/src/testing-prepare.ts
@@ -0,0 +1,146 @@
+import { join } from "node:path";
+import { ExpectedOperationError } from "@mobile-dev/shared/error-reporting.ts";
+import { udidSchema } from "@mobile-dev/shared/protocol.ts";
+import { systemCommands, withTemporaryDirectory } from "./app-control/commands.ts";
+import type { Commands } from "./app-control/commands.ts";
+import type { DriverFactory } from "./app-control/tools.ts";
+import type { ServeEmu } from "./serve-emu.ts";
+import type { Simctl } from "./simctl.ts";
+import type { Lane, LaneExecutor, MatrixPlatform } from "./testing-matrix.ts";
+import type { TestRunProgress, TestRunResult } from "./testing-run.ts";
+
+/** The per-platform app ids of a matrix request: a project may use different ones on each platform. */
+export interface MatrixAppIds { ios?: string; android?: string }
+
+/** What preparing a device needs from the machine; faked in tests. */
+export interface DeviceOps {
+ isBooted(platform: MatrixPlatform, deviceId: string): Promise;
+ /** Boots the device and waits for it to be usable. Returns the id to run on (an Android AVD becomes a serial). */
+ boot(platform: MatrixPlatform, deviceId: string, signal: AbortSignal): Promise;
+ hasApp(platform: MatrixPlatform, deviceId: string, appId: string): Promise;
+ /** Installs the app on `to` from the copy already on `from`. */
+ copyApp(platform: MatrixPlatform, from: string, to: string, appId: string, signal: AbortSignal): Promise;
+ launch(platform: MatrixPlatform, deviceId: string, appId: string): Promise;
+}
+
+export interface LaneExecutorDeps {
+ ops: DeviceOps;
+ apps: MatrixAppIds;
+ runTest(lane: Lane, deviceId: string, signal: AbortSignal, onProgress: (progress: TestRunProgress) => void): Promise;
+}
+
+/**
+ * Boot if off, install if missing, launch, then run.
+ *
+ * The app is only ever copied from another device of the same matrix that already has it, so no
+ * build output is guessed at and nothing outside the matrix is touched. If no device has it the
+ * lane fails with a message that says what to do.
+ */
+export function createLaneExecutor(deps: LaneExecutorDeps): LaneExecutor {
+ return {
+ async prepare(lane, lanes, signal, setState) {
+ const appId = deps.apps[lane.platform];
+ if (!appId) throw new ExpectedOperationError("invalid_input", `No ${lane.platform === "ios" ? "iOS bundle id" : "Android package"} was given for this run, so ${lane.deviceName} cannot run it.`);
+ let deviceId = lane.deviceId;
+ if (!await deps.ops.isBooted(lane.platform, deviceId)) {
+ setState("booting");
+ deviceId = await deps.ops.boot(lane.platform, deviceId, signal);
+ lane.resolvedDeviceId = deviceId;
+ }
+ signal.throwIfAborted();
+ if (!await deps.ops.hasApp(lane.platform, deviceId, appId)) {
+ setState("installing");
+ const source = await findSource(deps.ops, lane, lanes, deviceId, appId);
+ if (!source) throw new ExpectedOperationError("app_unavailable", `App not installed: ${appId} is not on ${lane.deviceName}, and no other device in this run has it to copy. Build and install it once, then run again.`);
+ await deps.ops.copyApp(lane.platform, source, deviceId, appId, signal);
+ }
+ signal.throwIfAborted();
+ await deps.ops.launch(lane.platform, deviceId, appId);
+ return deviceId;
+ },
+ run: (lane, deviceId, signal, onProgress) => deps.runTest(lane, deviceId, signal, onProgress),
+ };
+}
+
+/** The first other device of the same platform in the matrix that has the app installed. */
+async function findSource(ops: DeviceOps, lane: Lane, lanes: readonly Lane[], own: string, appId: string): Promise {
+ for (const other of lanes) {
+ if (other.runId === lane.runId || other.platform !== lane.platform) continue;
+ const candidate = other.resolvedDeviceId ?? other.deviceId;
+ if (candidate === own) continue;
+ // A device that is off, offline or going away cannot be a source; that is not an error here.
+ try {
+ if (await ops.isBooted(lane.platform, candidate) && await ops.hasApp(lane.platform, candidate, appId)) return candidate;
+ } catch { /* try the next one */ }
+ }
+ return undefined;
+}
+
+const APK_PATH = /^\/[\w\-./=+@~]+\.apk$/;
+
+/** Parses `adb shell pm path` output: one `package:` line per APK, split APKs included. */
+export function parsePmPaths(output: string): string[] {
+ return output.split(/\r?\n/).map(line => line.trim()).filter(line => line.startsWith("package:")).map(line => line.slice("package:".length)).filter(path => APK_PATH.test(path));
+}
+
+/** The real thing: `simctl` for iOS simulators, the emulator through `ServeEmu` and `adb` for Android. */
+export function systemDeviceOps(deps: { simulators: Simctl; android: ServeEmu; drivers: DriverFactory; commands?: Commands }): DeviceOps {
+ const commands = deps.commands ?? systemCommands;
+ const simctl = (args: string[], timeout = 30_000) => commands.run("xcrun", ["simctl", ...args], { timeout });
+ const adb = async (serial: string, args: string[], timeout = 30_000) => commands.run(await commands.adb(), ["-s", serial, ...args], { timeout });
+ const ios = (id: string) => { udidSchema.parse(id); return id; };
+ return {
+ async isBooted(platform, deviceId) {
+ if (platform === "ios") return (await deps.simulators.device(ios(deviceId))).state === "Booted";
+ return (await deps.android.device(deviceId)).state === "Booted";
+ },
+ async boot(platform, deviceId, signal) {
+ if (platform === "ios") {
+ const udid = ios(deviceId);
+ await simctl(["boot", udid]).catch(error => {
+ // Another lane or the user may have started it between the check and here.
+ if (!/current state: Booted|already booted/i.test(String((error as { stderr?: string })?.stderr ?? error))) throw error;
+ });
+ signal.throwIfAborted();
+ // `-b` waits for the boot to finish, not just for the device to exist.
+ await commands.run("xcrun", ["simctl", "bootstatus", udid, "-b"], { timeout: 240_000 });
+ return udid;
+ }
+ const before = await deps.android.device(deviceId);
+ const status = await deps.android.boot(deviceId);
+ if (!deviceId.startsWith("avd:")) return deviceId;
+ const running = status.devices.find(device => device.kind === "emulator" && device.name === before.name && device.state === "Booted");
+ if (!running) throw new ExpectedOperationError("device_unavailable", `${before.name} did not come up as a running emulator.`);
+ return running.udid;
+ },
+ async hasApp(platform, deviceId, appId) {
+ try {
+ if (platform === "ios") { await simctl(["get_app_container", ios(deviceId), appId, "app"]); return true; }
+ return parsePmPaths(await adb(deviceId, ["shell", "pm", "path", appId])).length > 0;
+ } catch { return false; }
+ },
+ async copyApp(platform, from, to, appId, signal) {
+ if (platform === "ios") {
+ const path = (await simctl(["get_app_container", ios(from), appId, "app"])).trim();
+ signal.throwIfAborted();
+ await simctl(["install", ios(to), path], 300_000);
+ return;
+ }
+ const remotes = parsePmPaths(await adb(from, ["shell", "pm", "path", appId]));
+ if (remotes.length === 0) throw new ExpectedOperationError("app_unavailable", `${appId} is not installed on ${from}.`);
+ await withTemporaryDirectory(async directory => {
+ const files: string[] = [];
+ for (const [index, remote] of remotes.entries()) {
+ signal.throwIfAborted();
+ const local = join(directory, `${index}-${remote.split("/").at(-1)}`);
+ await adb(from, ["pull", remote, local], 120_000);
+ files.push(local);
+ }
+ signal.throwIfAborted();
+ // Split APKs only install together; a single one takes the plain path.
+ await adb(to, files.length === 1 ? ["install", "-r", files[0]!] : ["install-multiple", "-r", ...files], 300_000);
+ });
+ },
+ async launch(platform, deviceId, appId) { await deps.drivers({ platform, deviceId }).launch(appId); },
+ };
+}
diff --git a/packages/core/src/testing-run.ts b/packages/core/src/testing-run.ts
index b5450240..07136a64 100644
--- a/packages/core/src/testing-run.ts
+++ b/packages/core/src/testing-run.ts
@@ -256,11 +256,18 @@ export interface TestRunRequest {
/** Explicit runner/projection runtime. Project mode remains authoritative when compatible. */
runtime?: { mode: "project" | "bundled"; root: string };
/** Required only for a bundled run, whose ephemeral config cannot read a project target. */
- bundledTarget?: { platform: "ios" | "android"; bundleId: string };
+ bundledTarget?: BundledTarget;
/** Non-secret preference for a bundled test containing agent.* calls. */
model?: { provider: BundledModelProvider; model: string; endpoint?: string };
}
+/**
+ * The app a bundled run drives. `device` pins the run to one simulator UDID or emulator serial, which is
+ * what lets a test matrix run the same test on several devices at once; without it the runner takes
+ * whichever booted device it finds, as a single run always has.
+ */
+export interface BundledTarget { platform: "ios" | "android"; bundleId: string; device?: string }
+
export type BundledModelProvider = "vercel" | "openrouter" | "openai-compatible" | "chatgpt" | "copilot" | "opencode-console" | "grok";
/**
@@ -299,6 +306,8 @@ type Spawner = typeof spawn;
*/
export interface TestRunDeps {
spawner?: Spawner;
+ /** Kills the run's process when aborted, for a matrix lane the user cancels. */
+ signal?: AbortSignal;
release?: () => Promise;
/** Called for each live `step` event, as it arrives. */
onProgress?: (progress: TestRunProgress) => void;
@@ -416,7 +425,17 @@ function bundledModelSource(model: TestRunRequest["model"]): { imports: string[]
}
}
-export function bundledConfigSource(target: NonNullable, model?: TestRunRequest["model"]): string {
+/**
+ * The target name a bundled run uses and passes to `--target`. A pinned device gets its own name because
+ * the engine names its agent-device session after the target (`e2e--`), and two concurrent
+ * runs must never share a session.
+ */
+export function bundledTargetName(target: BundledTarget): string {
+ if (!target.device) return target.platform;
+ return `${target.platform}-${target.device.replace(/[^A-Za-z0-9_-]/g, "-").slice(0, 64)}`;
+}
+
+export function bundledConfigSource(target: BundledTarget, model?: TestRunRequest["model"]): string {
const selected = bundledModelSource(model);
return [
"import { mobile } from '@e2e-dev/mobile';",
@@ -424,7 +443,7 @@ export function bundledConfigSource(target: NonNullable void }): Promise {
+async function spawnRun(input: { command: string; commandArgs?: string[]; cwd: string; runPath: string; configName?: string; target?: string; output?: string; timeoutMs?: number; spawner: Spawner; signal?: AbortSignal; onProgress?: (progress: TestRunProgress) => void }): Promise {
+ input.signal?.throwIfAborted();
const child = input.spawner(input.command, [
...(input.commandArgs ?? []), "run", input.runPath, "--reporter", "json",
+ ...(input.output ? ["--output", input.output] : []),
...(input.target ? ["--target", input.target] : []), ...(input.configName ? ["--config", input.configName] : []),
], { cwd: input.cwd, stdio: ["ignore", "pipe", "pipe"], env: runnerEnv() });
let stdout = "", stderr = "", pending = "";
@@ -482,7 +506,10 @@ async function spawnRun(input: { command: string; commandArgs?: string[]; cwd: s
const timeoutMs = input.timeoutMs ?? 10 * 60_000;
const exitCode = await new Promise((resolve, reject) => {
const timer = setTimeout(() => { child.kill("SIGTERM"); reject(new ExpectedOperationError("resource_limit", `The test run did not finish within ${Math.round(timeoutMs / 1000)}s.`)); }, timeoutMs);
- timer.unref?.(); child.on("error", error => { clearTimeout(timer); reject(error); }); child.on("close", code => { clearTimeout(timer); resolve(code ?? 1); });
+ const cancel = () => { child.kill("SIGTERM"); reject(new ExpectedOperationError("cancelled", "The test run was cancelled.")); };
+ input.signal?.addEventListener("abort", cancel, { once: true });
+ const done = () => { clearTimeout(timer); input.signal?.removeEventListener("abort", cancel); };
+ timer.unref?.(); child.on("error", error => { done(); reject(error); }); child.on("close", code => { done(); resolve(code ?? 1); });
});
const report = parseReport(stdout);
const steps = report ? reportSteps(report, input.runPath) : [];
diff --git a/packages/core/src/testing-tools.ts b/packages/core/src/testing-tools.ts
index 13b883f6..d6a81eea 100644
--- a/packages/core/src/testing-tools.ts
+++ b/packages/core/src/testing-tools.ts
@@ -12,7 +12,11 @@ import { MAX_DRAFT_STEPS, recordedStepSchema, testDraftIdSchema } from "@mobile-
import type { TestDraft } from "@mobile-dev/shared/test-drafts.ts";
import { TestingDevices } from "./testing-device.ts";
import { runRecordedTest } from "./testing-run.ts";
-import type { TestRunProgress } from "./testing-run.ts";
+import type { TestRunRequest } from "./testing-run.ts";
+import { MatrixRegistry, MAX_MATRIX_LIMIT, snapshotMatrix, startMatrix } from "./testing-matrix.ts";
+import type { LaneExecutor, MatrixDevice, MatrixRun } from "./testing-matrix.ts";
+import { createLaneExecutor } from "./testing-prepare.ts";
+import type { DeviceOps } from "./testing-prepare.ts";
import { deviceIdSchema } from "@mobile-dev/shared/panel-target.ts";
import type { BundledModelProvider } from "./testing-run.ts";
import { answerTestingSetup, applyTestingSetup, cancelTestingSetup, inspectTestingSetup, planTestingSetup, readTestingModelPreference, saveTestingModelPreference, SETUP_PROVIDERS, startTestingLogin, testingSetupProgress } from "./testing-setup.ts";
@@ -43,17 +47,18 @@ function dataResult(data: Record, message?: string): CallToolRe
/** The Testing panel's project selection, and the device tree its recorder names selectors from. */
/** Returns the shutdown the plugin has to run: the recorder's device session, handed back. */
-export function registerTestingTools(server: McpServer, projects: TestingProjectChoices, devices = new TestingDevices(), drafts = new TestDraftStore()): () => Promise {
+export function registerTestingTools(server: McpServer, projects: TestingProjectChoices, devices = new TestingDevices(), drafts = new TestDraftStore(), matrix: { ops?: DeviceOps; registry?: MatrixRegistry; run?: typeof runRecordedTest } = {}): () => Promise {
/**
- * The live progress of the run in flight.
+ * Every run, as a matrix of lanes; a single run is a matrix of one.
*
- * A tool call is one request and one response, so the run's own call cannot report as it goes.
- * The panel polls this one instead, which is a few hundred bytes a second against a local server
- * for as long as a run takes — cheaper than holding a notification channel open for a feature
- * whose whole output is a spinner moving down a dozen lines.
+ * A tool call is one request and one response, so a run's own call cannot report as it goes.
+ * The panel polls `mobile_testing_run_progress` instead, which is a few hundred bytes a second
+ * against a local server for as long as a run takes — cheaper than holding a notification channel
+ * open for a feature whose whole output is a spinner moving down a dozen lines.
*/
- let progress: TestRunProgress[] = [];
- let running = false;
+ const registry = matrix.registry ?? new MatrixRegistry();
+ const runTest = matrix.run ?? runRecordedTest;
+ const matrixWire = (run: MatrixRun) => ({ ...snapshotMatrix(run), running: run.lanes.some(lane => !["passed", "failed", "cancelled", "error"].includes(lane.state)) });
registerAppTool(server, "mobile_testing_projects", {
title: "List testing projects",
description: "List the e2e project folders the Testing panel can record against, most recent first, and the private Studio workspace it uses when no project is open.",
@@ -309,10 +314,39 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
}, safe(async ({ projectPath: selected, relativePath, platform, bundleId }: { projectPath: string; relativePath: string; platform: "ios" | "android"; bundleId: string }) =>
dataResult({ pinned: await writeTestTarget(selected, relativePath, { platform, bundleId }) })));
+ const modelSchema = z.object({
+ provider: z.enum(["vercel", "openrouter", "openai-compatible", "chatgpt", "copilot", "opencode-console", "grok"]),
+ model: z.string().min(1).max(256), endpoint: z.string().url().max(2048).optional(),
+ });
+ type RunInput = { projectPath: string; relativePath: string; configPath?: string; timeoutMs?: number; target?: string; platform?: "ios" | "android"; bundleId?: string; pin?: boolean; model?: { provider: BundledModelProvider; model: string; endpoint?: string }; untilSource?: string };
+
+ /** Everything a run needs before a device is chosen: the same for a single run and for every lane. */
+ async function prepareRequest(input: RunInput) {
+ const { projectPath: selected, relativePath, configPath, timeoutMs, target, platform, bundleId, pin, model, untilSource } = input;
+ const project = await inspectProject(selected, platform && bundleId ? { platform, bundleId } : undefined);
+ if (pin && platform && bundleId) await writeTestTarget(selected, relativePath, { platform, bundleId }).catch(() => false);
+ const paths = await resolveTestRunPaths(selected, relativePath, project.runtimeMode === "project" ? configPath : undefined, untilSource !== undefined);
+ const selectedTarget = project.targets.find(entry => entry.name === target)
+ ?? project.targets.find(entry => entry.platform === platform && (!bundleId || entry.bundleId === bundleId))
+ ?? project.targets[0];
+ const bundledSource = project.runtimeMode === "bundled" ? (untilSource ?? await readTestFile(selected, relativePath)) : untilSource;
+ const request: TestRunRequest = { ...paths, ...(timeoutMs === undefined ? {} : { timeoutMs }), ...(target ? { target } : {}),
+ ...(bundledSource === undefined ? {} : { untilSource: bundledSource }), runtime: { mode: project.runtimeMode, root: project.runtime.root },
+ ...(project.runtimeMode === "bundled" && platform && bundleId ? { bundledTarget: { platform, bundleId } }
+ : project.runtimeMode === "bundled" && selectedTarget?.platform && selectedTarget.bundleId ? { bundledTarget: { platform: selectedTarget.platform as "ios" | "android", bundleId: selectedTarget.bundleId } } : {}),
+ ...(model ? { model } : {}) };
+ return { request, project };
+ }
+
+ /** Starts a matrix whose lanes run `request` and returns once it is registered. */
+ function launchMatrix(testPath: string, devices_: MatrixDevice[], limit: number | undefined, executor: LaneExecutor) {
+ return startMatrix(registry, { testPath, devices: devices_, ...(limit === undefined ? {} : { limit }) }, executor);
+ }
+
registerAppTool(server, "mobile_testing_run_test", {
title: "Run a recorded test",
description:
- "Run one saved test with the project's own e2e CLI and report each step with the line it came from. The recorder's device session is released first: the runner allows one session per device, so a run started while the recorder holds it fails with \"Device is already in use\".",
+ "Run one saved test with the project's own e2e CLI and report each step with the line it came from. The recorder's device session is released first: the runner allows one session per device, so a run started while the recorder holds it fails with \"Device is already in use\". Runs on the one device the runner picks; use mobile_testing_run_matrix to choose devices.",
inputSchema: {
projectPath,
relativePath: z.string().min(1).max(512).describe("The test to run, relative to the project, e.g. tests/a-recorded-flow.e2e.ts."),
@@ -322,50 +356,96 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
platform: z.enum(["ios", "android"]).optional().describe("The mirrored platform for a bundled run."),
bundleId: z.string().min(1).max(512).optional().describe("The app identifier for a bundled run: the test's pinned app, or the foreground app when it has none."),
pin: z.boolean().optional().describe("Pin platform and bundleId to the saved test before running, for a bundled test that has no app yet."),
- model: z.object({
- provider: z.enum(["vercel", "openrouter", "openai-compatible", "chatgpt", "copilot", "opencode-console", "grok"]),
- model: z.string().min(1).max(256), endpoint: z.string().url().max(2048).optional(),
- }).optional(),
+ model: modelSchema.optional(),
untilSource: z.string().min(1).max(400_000).optional().describe(
"Run this truncated copy of the test instead of the file itself, for \"play until here\": the same flow cut off after one step. It is written beside the test for the one run and removed afterwards; the file itself is not touched."),
},
// A test run drives the app on the device: it taps, types and changes the app's own state.
annotations: destructive,
_meta: appVisibility,
- }, safe(async ({ projectPath: selected, relativePath, configPath, timeoutMs, target, platform, bundleId, pin, model, untilSource }: { projectPath: string; relativePath: string; configPath?: string; timeoutMs?: number; target?: string; platform?: "ios" | "android"; bundleId?: string; pin?: boolean; model?: { provider: BundledModelProvider; model: string; endpoint?: string }; untilSource?: string }) => {
+ }, safe(async (input: RunInput) => {
// The release is a dependency of the run, not a step the caller is trusted to have taken: see
// `TestRunDeps`. The panel releases too, but a caller who forgets must not break the run.
- progress = [];
- running = true;
- try {
- const project = await inspectProject(selected, platform && bundleId ? { platform, bundleId } : undefined);
- if (pin && platform && bundleId) await writeTestTarget(selected, relativePath, { platform, bundleId }).catch(() => false);
- const paths = await resolveTestRunPaths(selected, relativePath, project.runtimeMode === "project" ? configPath : undefined, untilSource !== undefined);
- const selectedTarget = project.targets.find(entry => entry.name === target)
- ?? project.targets.find(entry => entry.platform === platform && (!bundleId || entry.bundleId === bundleId))
- ?? project.targets[0];
- const bundledSource = project.runtimeMode === "bundled" ? (untilSource ?? await readTestFile(selected, relativePath)) : untilSource;
- const result = await runRecordedTest(
- { ...paths, ...(timeoutMs === undefined ? {} : { timeoutMs }), ...(target ? { target } : {}),
- ...(bundledSource === undefined ? {} : { untilSource: bundledSource }), runtime: { mode: project.runtimeMode, root: project.runtime.root },
- ...(project.runtimeMode === "bundled" && platform && bundleId ? { bundledTarget: { platform, bundleId } }
- : project.runtimeMode === "bundled" && selectedTarget?.platform && selectedTarget.bundleId ? { bundledTarget: { platform: selectedTarget.platform as "ios" | "android", bundleId: selectedTarget.bundleId } } : {}),
- ...(model ? { model } : {}) },
- { release: () => devices.release(), onProgress: entry => { progress.push(entry); } });
- return dataResult({ ...result }, `${relativePath} ${result.status}.`);
- } finally {
- running = false;
- }
+ const { request } = await prepareRequest(input);
+ const executor: LaneExecutor = {
+ // No device is chosen and nothing is booted or installed: the runner picks, as it always has.
+ prepare: async () => "",
+ run: (_lane, _device, signal, onProgress) => runTest(request, { release: () => devices.release(), onProgress, signal }),
+ };
+ const { run, done } = launchMatrix(input.relativePath, [{ deviceId: "auto", platform: input.platform ?? "ios", name: "Default device" }], 1, executor);
+ await done;
+ const lane = run.lanes[0]!;
+ // A run that could not start at all is the caller's error, as it was before lanes existed.
+ if (lane.state === "error" || (lane.state === "cancelled" && !lane.result)) throw new Error(lane.error ?? "The test run was cancelled.");
+ return dataResult({ ...lane.result!, matrixId: run.matrixId }, `${input.relativePath} ${lane.result!.status}.`);
+ }));
+
+ registerAppTool(server, "mobile_testing_run_matrix", {
+ title: "Run a recorded test on several devices",
+ description:
+ "Run one saved test on several devices at once, one independent lane per device, and return a matrixId immediately; read progress with mobile_testing_run_progress. At most `limit` lanes run at once (default 3, max 8); the rest are queued. Devices that are off are booted, and a device missing the app gets it installed by copying it from another device in the run that has it; otherwise that lane fails with \"App not installed\". Bundled mode only. A failure on one device does not stop the others.",
+ inputSchema: {
+ projectPath,
+ relativePath: z.string().min(1).max(512).describe("The test to run, relative to the project."),
+ devices: z.array(z.object({
+ deviceId: deviceIdSchema.describe("An iOS simulator UDID, an Android serial, or an avd: id from the device lists."),
+ platform: z.enum(["ios", "android"]),
+ name: z.string().min(1).max(128).optional().describe("A label for the lane."),
+ })).min(1).max(16),
+ apps: z.object({ ios: z.string().min(1).max(512).optional(), android: z.string().min(1).max(512).optional() })
+ .describe("The app id per platform: the iOS bundle id and the Android package name."),
+ limit: z.number().int().min(1).max(MAX_MATRIX_LIMIT).optional().describe("How many devices run at once. Default 3."),
+ timeoutMs: z.number().int().min(10_000).max(30 * 60_000).optional(),
+ model: modelSchema.optional(),
+ untilSource: z.string().min(1).max(400_000).optional().describe("A truncated copy of the test to run instead of the file."),
+ },
+ annotations: destructive,
+ _meta: appVisibility,
+ }, safe(async (input: Omit & { devices: MatrixDevice[]; apps: { ios?: string; android?: string }; limit?: number }) => {
+ const unique = new Set(input.devices.map(device => device.deviceId));
+ if (unique.size !== input.devices.length) throw new ExpectedOperationError("invalid_input", "Each device can appear only once in a matrix.");
+ if (!matrix.ops) throw new ExpectedOperationError("unsupported_platform", "This server cannot prepare devices for a matrix run.");
+ const first = input.devices[0]!;
+ const { request, project } = await prepareRequest({ ...input, platform: first.platform, ...(input.apps[first.platform] ? { bundleId: input.apps[first.platform]! } : {}) });
+ if (project.runtimeMode !== "bundled") throw new ExpectedOperationError("invalid_input", "Running on several devices is available for Mobile Dev's bundled runner. This project uses its own e2e config, so run it on one device.");
+ // Only the devices of this matrix lose the recorder; a recorder on another device keeps its session.
+ await devices.releaseOn(input.devices.map(device => device.deviceId)).catch(() => undefined);
+ const executor = createLaneExecutor({
+ ops: matrix.ops, apps: input.apps,
+ runTest: (lane, deviceId, signal, onProgress) => runTest(
+ { ...request, bundledTarget: { platform: lane.platform, bundleId: input.apps[lane.platform]!, device: deviceId } },
+ { release: () => devices.releaseOn([lane.deviceId, deviceId]), onProgress, signal }),
+ });
+ const { run } = launchMatrix(input.relativePath, input.devices, input.limit, executor);
+ return dataResult({ matrixId: run.matrixId, limit: run.limit, lanes: snapshotMatrix(run).lanes }, `Started ${run.lanes.length} lanes, up to ${run.limit} at once.`);
}));
registerAppTool(server, "mobile_testing_run_progress", {
title: "Read a run's progress",
description:
- "Read the steps the run in flight has started and finished so far, as the runner's own event spine reports them. Each entry carries the step's index within its test, which is its position among the file's awaited calls.",
- inputSchema: {},
+ "Read the lanes of a matrix run: each device's state (queued, booting, installing, running, passed, failed, cancelled, error), the steps it has started and finished so far, and its result. Without a matrixId it reads the latest run, whose first lane's steps are also returned as `progress`. Each step carries its index within its test, which is its position among the file's awaited calls.",
+ inputSchema: { matrixId: z.string().min(1).max(128).optional() },
annotations: read,
_meta: appVisibility,
- }, safe(async () => dataResult({ running, progress: [...progress] })));
+ }, safe(async ({ matrixId }: { matrixId?: string }) => {
+ const run = matrixId ? registry.get(matrixId) : registry.latest();
+ if (matrixId && !run) throw new ExpectedOperationError("invalid_input", "That run is no longer available.");
+ if (!run) return dataResult({ running: false, progress: [], lanes: [], busyDevices: registry.busyDevices() });
+ const wire = matrixWire(run);
+ return dataResult({ ...wire, progress: wire.lanes[0]?.progress ?? [], busyDevices: registry.busyDevices() });
+ }));
+
+ registerAppTool(server, "mobile_testing_cancel", {
+ title: "Cancel a test run",
+ description: "Cancel one device's lane of a matrix run, or every lane that has not finished. A queued lane never starts; a running lane's process is stopped.",
+ inputSchema: { matrixId: z.string().min(1).max(128), deviceId: deviceIdSchema.optional().describe("Cancel only this device's lane.") },
+ annotations: write,
+ _meta: appVisibility,
+ }, safe(async ({ matrixId, deviceId }: { matrixId: string; deviceId?: string }) => {
+ if (!registry.get(matrixId)) throw new ExpectedOperationError("invalid_input", "That run is no longer available.");
+ const cancelled = registry.cancel(matrixId, deviceId);
+ return dataResult({ cancelled: cancelled.map(lane => lane.deviceId) }, `Cancelled ${cancelled.length} lane${cancelled.length === 1 ? "" : "s"}.`);
+ }));
registerAppTool(server, "mobile_testing_release_device", {
title: "Release the recorder's device",
diff --git a/packages/core/test/testing-matrix.test.ts b/packages/core/test/testing-matrix.test.ts
new file mode 100644
index 00000000..0936796f
--- /dev/null
+++ b/packages/core/test/testing-matrix.test.ts
@@ -0,0 +1,155 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { DEFAULT_MATRIX_LIMIT, MatrixRegistry, Scheduler, clampLimit, isTerminalLane, snapshotMatrix, startMatrix } from "../src/testing-matrix.ts";
+import type { Lane, LaneExecutor, MatrixDevice } from "../src/testing-matrix.ts";
+import { ExpectedOperationError } from "@mobile-dev/shared/error-reporting.ts";
+
+const devices = (n: number): MatrixDevice[] => Array.from({ length: n }, (_, i) => ({ deviceId: `dev-${i}`, platform: "ios" as const, name: `Phone ${i}` }));
+const tick = () => new Promise(resolve => setImmediate(resolve));
+
+test("the limit defaults to 3 and is clamped to 1–8", () => {
+ assert.equal(DEFAULT_MATRIX_LIMIT, 3);
+ assert.equal(clampLimit(undefined), 3);
+ assert.equal(clampLimit(0), 1);
+ assert.equal(clampLimit(99), 8);
+ assert.equal(clampLimit(2.7), 2);
+});
+
+test("the scheduler never runs more than its limit and starts tasks in order", async () => {
+ const scheduler = new Scheduler(2);
+ const started: number[] = [];
+ const gates = [0, 1, 2, 3].map(() => Promise.withResolvers());
+ let peak = 0;
+ const tasks = gates.map((gate, i) => scheduler.run(async () => {
+ started.push(i); peak = Math.max(peak, scheduler.running); await gate.promise;
+ }));
+ await tick();
+ assert.deepEqual(started, [0, 1]);
+ assert.equal(scheduler.queued, 2);
+ gates[0]!.resolve(); await tick();
+ assert.deepEqual(started, [0, 1, 2], "a finished task frees its slot for the next in line");
+ gates[1]!.resolve(); gates[2]!.resolve(); gates[3]!.resolve();
+ await Promise.all(tasks);
+ assert.equal(peak, 2);
+ assert.equal(scheduler.running, 0);
+});
+
+test("a failing task still frees its slot", async () => {
+ const scheduler = new Scheduler(1);
+ await assert.rejects(scheduler.run(async () => { throw new Error("boom"); }), /boom/);
+ assert.equal(await scheduler.run(async () => "ok"), "ok");
+});
+
+/** An executor whose lanes finish when the test says so. */
+function gated() {
+ const gates = new Map>();
+ const prepared: string[] = [];
+ const executor: LaneExecutor = {
+ async prepare(lane, _lanes, _signal, setState) { setState("booting"); prepared.push(lane.deviceId); return lane.deviceId; },
+ run(lane, _device, signal, onProgress) {
+ onProgress({ stepIndex: 0, phase: "start", api: "locator.tap", label: "tap" });
+ const gate = Promise.withResolvers();
+ gates.set(lane.deviceId, gate);
+ signal.addEventListener("abort", () => gate.reject(new ExpectedOperationError("cancelled", "cancelled")), { once: true });
+ return gate.promise.then(status => ({ status, exitCode: status === "passed" ? 0 : 1, steps: [] }));
+ },
+ };
+ return { executor, gates, prepared };
+}
+
+test("three of four lanes run at once under the default limit and the fourth queues", async () => {
+ const { executor, gates } = gated();
+ const registry = new MatrixRegistry();
+ const { run, done } = startMatrix(registry, { testPath: "t.e2e.ts", devices: devices(4) }, executor);
+ await tick();
+ assert.deepEqual(run.lanes.map(lane => lane.state), ["running", "running", "running", "queued"]);
+ assert.equal(run.limit, 3);
+ gates.get("dev-0")!.resolve("passed"); await tick();
+ assert.deepEqual(run.lanes.map(lane => lane.state), ["passed", "running", "running", "running"]);
+ for (const id of ["dev-1", "dev-2", "dev-3"]) gates.get(id)!.resolve("failed");
+ await done;
+ assert.deepEqual(run.lanes.map(lane => lane.state), ["passed", "failed", "failed", "failed"]);
+ assert.ok(run.finishedAt);
+ assert.ok(run.lanes.every(lane => isTerminalLane(lane.state)));
+});
+
+test("lanes keep their own progress and one failure does not stop the others", async () => {
+ const { executor, gates } = gated();
+ const { run, done } = startMatrix(new MatrixRegistry(), { testPath: "t", devices: devices(2) }, executor);
+ await tick();
+ gates.get("dev-0")!.resolve("failed"); gates.get("dev-1")!.resolve("passed");
+ await done;
+ assert.deepEqual(run.lanes.map(lane => lane.state), ["failed", "passed"]);
+ assert.ok(run.lanes.every(lane => lane.progress.length === 1));
+ assert.notEqual(run.lanes[0]!.progress, run.lanes[1]!.progress);
+});
+
+test("a lane whose prepare throws ends in error without touching its siblings", async () => {
+ const executor: LaneExecutor = {
+ async prepare(lane) { if (lane.deviceId === "dev-0") throw new Error("App not installed"); return lane.deviceId; },
+ async run() { return { status: "passed", exitCode: 0, steps: [] }; },
+ };
+ const { run, done } = startMatrix(new MatrixRegistry(), { testPath: "t", devices: devices(2) }, executor);
+ await done;
+ assert.equal(run.lanes[0]!.state, "error");
+ assert.equal(run.lanes[0]!.error, "App not installed");
+ assert.equal(run.lanes[1]!.state, "passed");
+});
+
+test("cancelling a queued lane means it never starts; cancelling a running one aborts it", async () => {
+ const { executor, gates, prepared } = gated();
+ const registry = new MatrixRegistry();
+ const { run, done } = startMatrix(registry, { testPath: "t", devices: devices(4), limit: 2 }, executor);
+ await tick();
+ assert.equal(registry.cancel(run.matrixId, "dev-3").length, 1);
+ assert.equal(run.lanes[3]!.state, "cancelled");
+ registry.cancel(run.matrixId, "dev-0"); await tick();
+ assert.equal(run.lanes[0]!.state, "cancelled");
+ gates.get("dev-1")!.resolve("passed"); await tick();
+ gates.get("dev-2")!.resolve("passed");
+ await done;
+ assert.deepEqual(run.lanes.map(lane => lane.state), ["cancelled", "passed", "passed", "cancelled"]);
+ assert.ok(!prepared.includes("dev-3"), "the cancelled lane was never prepared");
+});
+
+test("cancelling every lane of a matrix", async () => {
+ const { executor } = gated();
+ const registry = new MatrixRegistry();
+ const { run, done } = startMatrix(registry, { testPath: "t", devices: devices(3), limit: 1 }, executor);
+ await tick();
+ assert.equal(registry.cancel(run.matrixId).length, 3);
+ await done;
+ assert.ok(run.lanes.every(lane => lane.state === "cancelled"));
+ assert.equal(registry.busy, false);
+});
+
+test("the registry finds runs, reports busy devices and drops old finished ones", async () => {
+ const registry = new MatrixRegistry(2);
+ const instant: LaneExecutor = { prepare: async lane => lane.deviceId, run: async () => ({ status: "passed", exitCode: 0, steps: [] }) };
+ const first = startMatrix(registry, { testPath: "a", devices: devices(1) }, instant);
+ await first.done;
+ const { executor } = gated();
+ const second = startMatrix(registry, { testPath: "b", devices: devices(2) }, executor);
+ await tick();
+ assert.equal(registry.latest()?.matrixId, second.run.matrixId);
+ assert.deepEqual(registry.busyDevices().sort(), ["dev-0", "dev-1"]);
+ const third = startMatrix(registry, { testPath: "c", devices: devices(1) }, instant);
+ await third.done;
+ assert.equal(registry.get(first.run.matrixId), undefined, "the oldest finished matrix is pruned");
+ assert.ok(registry.get(second.run.matrixId), "an unfinished matrix is never pruned");
+});
+
+test("a snapshot does not change as the lane keeps running", async () => {
+ const { executor, gates } = gated();
+ const { run } = startMatrix(new MatrixRegistry(), { testPath: "t", devices: devices(1) }, executor);
+ await tick();
+ const copy = snapshotMatrix(run);
+ run.lanes[0]!.progress.push({ stepIndex: 1, phase: "end", api: "x", label: "x" });
+ assert.equal(copy.lanes[0]!.progress.length, 1);
+ gates.get("dev-0")!.resolve("passed");
+});
+
+test("lanes carry stable unique run ids", () => {
+ const { run } = new MatrixRegistry().create("t", devices(3), 3);
+ assert.equal(new Set(run.lanes.map((lane: Lane) => lane.runId)).size, 3);
+});
diff --git a/packages/core/test/testing-prepare.test.ts b/packages/core/test/testing-prepare.test.ts
new file mode 100644
index 00000000..26e21243
--- /dev/null
+++ b/packages/core/test/testing-prepare.test.ts
@@ -0,0 +1,118 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { createLaneExecutor, parsePmPaths, systemDeviceOps } from "../src/testing-prepare.ts";
+import type { DeviceOps } from "../src/testing-prepare.ts";
+import { MatrixRegistry, startMatrix } from "../src/testing-matrix.ts";
+import type { LaneState, MatrixDevice } from "../src/testing-matrix.ts";
+
+/** A fake machine: which devices are booted and which have the app, with a log of what was done to them. */
+function machine(state: Record) {
+ const log: string[] = [];
+ const ops: DeviceOps = {
+ async isBooted(_p, id) { if (!state[id]) throw new Error("gone"); return state[id]!.booted; },
+ async boot(_p, id) { log.push(`boot ${id}`); state[id]!.booted = true; return id.startsWith("avd:") ? `emulator-${id.slice(4)}` : id; },
+ async hasApp(_p, id, app) { return state[id]?.booted === true && state[id]!.apps.includes(app); },
+ async copyApp(_p, from, to, app) { log.push(`copy ${from}->${to}`); state[to]!.apps.push(app); },
+ async launch(_p, id) { log.push(`launch ${id}`); },
+ };
+ return { ops, log, state };
+}
+
+async function run(devices: MatrixDevice[], ops: DeviceOps, apps = { ios: "com.app", android: "com.app" }) {
+ const seen = new Map();
+ const executor = createLaneExecutor({ ops, apps, runTest: async (lane, deviceId) => { log.push(`run ${deviceId}`); return { status: "passed", exitCode: 0, steps: [] }; } });
+ const log: string[] = [];
+ const registry = new MatrixRegistry();
+ const { run: matrix, done } = startMatrix(registry, { testPath: "t", devices }, executor);
+ await done;
+ void seen;
+ return { matrix, log };
+}
+
+const ios = (...ids: string[]): MatrixDevice[] => ids.map(deviceId => ({ deviceId, platform: "ios" }));
+
+test("an off simulator is booted before its lane runs", async () => {
+ const { ops, log: ops_log } = machine({ A: { booted: false, apps: ["com.app"] } });
+ const { matrix, log } = await run(ios("A"), ops);
+ assert.equal(matrix.lanes[0]!.state, "passed");
+ assert.deepEqual(ops_log, ["boot A", "launch A"]);
+ assert.deepEqual(log, ["run A"]);
+});
+
+test("a device without the app gets it copied from another device that has it", async () => {
+ const { ops, log: ops_log } = machine({ A: { booted: true, apps: ["com.app"] }, B: { booted: true, apps: [] } });
+ const { matrix } = await run(ios("A", "B"), ops);
+ assert.deepEqual(matrix.lanes.map(lane => lane.state), ["passed", "passed"]);
+ assert.ok(ops_log.includes("copy A->B"));
+ assert.ok(ops_log.indexOf("copy A->B") < ops_log.indexOf("launch B"), "installed before launch");
+});
+
+test("a device that is off and lacks the app is booted, then installed", async () => {
+ const { ops, log } = machine({ A: { booted: true, apps: ["com.app"] }, B: { booted: false, apps: [] } });
+ await run(ios("A", "B"), ops);
+ assert.ok(log.indexOf("boot B") < log.indexOf("copy A->B"));
+});
+
+test("an Android AVD runs on the serial it booted as", async () => {
+ const { ops } = machine({ "avd:Pixel": { booted: false, apps: [] }, "emulator-5554": { booted: true, apps: ["com.app"] }, "emulator-Pixel": { booted: true, apps: [] } });
+ const { matrix } = await run([{ deviceId: "emulator-5554", platform: "android" }, { deviceId: "avd:Pixel", platform: "android" }], ops);
+ assert.equal(matrix.lanes[1]!.resolvedDeviceId, "emulator-Pixel");
+ assert.equal(matrix.lanes[1]!.state, "passed");
+});
+
+test("with no device that has the app the lane fails with App not installed", async () => {
+ const { ops } = machine({ A: { booted: true, apps: [] }, B: { booted: true, apps: [] } });
+ const { matrix } = await run(ios("A", "B"), ops);
+ assert.deepEqual(matrix.lanes.map(lane => lane.state), ["error", "error"]);
+ assert.match(matrix.lanes[0]!.error ?? "", /App not installed/);
+});
+
+test("a platform with no app id fails fast, and a source on another platform is never used", async () => {
+ const { ops, log } = machine({ A: { booted: true, apps: ["com.app"] }, "emulator-1": { booted: true, apps: [] } });
+ const { matrix } = await run([{ deviceId: "A", platform: "ios" }, { deviceId: "emulator-1", platform: "android" }], ops, { ios: "com.app" } as never);
+ assert.equal(matrix.lanes[0]!.state, "passed");
+ assert.equal(matrix.lanes[1]!.state, "error");
+ assert.match(matrix.lanes[1]!.error ?? "", /No Android package/);
+ assert.ok(!log.some(entry => entry.startsWith("copy")));
+});
+
+test("a lane reports booting and installing as it goes", async () => {
+ const { ops } = machine({ A: { booted: true, apps: ["com.app"] }, B: { booted: false, apps: [] } });
+ const states: string[] = [];
+ const executor = createLaneExecutor({ ops, apps: { ios: "com.app" }, runTest: async () => ({ status: "passed", exitCode: 0, steps: [] }) });
+ const { run: matrix } = startMatrix(new MatrixRegistry(), { testPath: "t", devices: [] }, executor);
+ const lanes = ios("A", "B").map((device, i) => ({ runId: String(i), deviceId: device.deviceId, deviceName: device.deviceId, platform: "ios" as const, state: "queued" as LaneState, progress: [] }));
+ void matrix;
+ await executor.prepare(lanes[1]!, lanes, new AbortController().signal, state => states.push(state));
+ assert.deepEqual(states, ["booting", "installing"]);
+});
+
+test("pm path output becomes the list of APKs, split ones included", () => {
+ assert.deepEqual(parsePmPaths("package:/data/app/~~x/com.app-1/base.apk\npackage:/data/app/~~x/com.app-1/split_config.arm64_v8a.apk\n"),
+ ["/data/app/~~x/com.app-1/base.apk", "/data/app/~~x/com.app-1/split_config.arm64_v8a.apk"]);
+ assert.deepEqual(parsePmPaths("package:/data/app/$(reboot).apk\nnoise"), [], "an unexpected path is refused");
+});
+
+test("system ops copy a split APK with install-multiple and an iOS app with get_app_container", async () => {
+ const calls: string[][] = [];
+ const commands = {
+ adb: async () => "adb", aapt2: async () => null,
+ run: async (file: string, args: string[]) => {
+ calls.push([file, ...args]);
+ if (args.includes("pm")) return "package:/data/app/a/base.apk\npackage:/data/app/a/split_x.apk\n";
+ if (args.includes("get_app_container")) return "/sim/App.app\n";
+ return "";
+ },
+ readBinary: async () => Buffer.alloc(0),
+ };
+ const ops = systemDeviceOps({ simulators: {} as never, android: {} as never, drivers: (() => ({})) as never, commands });
+ const controller = new AbortController();
+ await ops.copyApp("android", "emulator-5554", "emulator-5556", "com.app", controller.signal);
+ const install = calls.find(call => call.includes("install-multiple"));
+ assert.ok(install, "split APKs install together");
+ assert.deepEqual(install!.slice(0, 4), ["adb", "-s", "emulator-5556", "install-multiple"]);
+ assert.equal(calls.filter(call => call.includes("pull")).length, 2);
+ calls.length = 0;
+ await ops.copyApp("ios", "11111111-1111-4111-8111-111111111111", "22222222-2222-4222-8222-222222222222", "com.app", controller.signal);
+ assert.deepEqual(calls.at(-1), ["xcrun", "simctl", "install", "22222222-2222-4222-8222-222222222222", "/sim/App.app"]);
+});
diff --git a/packages/core/test/testing-run.test.ts b/packages/core/test/testing-run.test.ts
index 925e24cc..d403cabb 100644
--- a/packages/core/test/testing-run.test.ts
+++ b/packages/core/test/testing-run.test.ts
@@ -7,7 +7,7 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import { existsSync } from "node:fs";
import { readFileSync } from "node:fs";
-import { bundledConfigSource, parseProgressLine, parseReport, progressConfigSource, reportDuration, reportSteps, reportStatus, runRecordedTest, runnerBin, runnerEnv, untilTestPath } from "../src/testing-run.ts";
+import { bundledConfigSource, bundledTargetName, parseProgressLine, parseReport, progressConfigSource, reportDuration, reportSteps, reportStatus, runRecordedTest, runnerBin, runnerEnv, untilTestPath } from "../src/testing-run.ts";
import { bundledE2eRoot } from "../src/e2e-runtime.ts";
const FILE = "tests/a-recorded-flow.e2e.ts";
@@ -331,3 +331,50 @@ test("bundled deterministic tests need no model and agent tests request one", as
runtime: { mode: "bundled", root: bundledE2eRoot() }, bundledTarget: { platform: "android", bundleId: "com.example.app" },
}), /Choose a provider and model/);
});
+
+test("a device-pinned bundled config names the device and gives the target its own name", () => {
+ const source = bundledConfigSource({ platform: "ios", bundleId: "com.example.app", device: "A1B2-C3" });
+ assert.match(source, /name: "ios-A1B2-C3"/);
+ assert.match(source, /mobile\(\{ platform: "ios", device: "A1B2-C3" \}\)/);
+ assert.match(source, /workers: 1/);
+ assert.equal(bundledTargetName({ platform: "android", bundleId: "x", device: "emulator-5554" }), "android-emulator-5554");
+ assert.equal(bundledTargetName({ platform: "android", bundleId: "x", device: "avd:Pixel 8" }), "android-avd-Pixel-8");
+ // Without a device nothing changes from a single run.
+ const plain = bundledConfigSource({ platform: "ios", bundleId: "com.example.app" });
+ assert.match(plain, /name: "ios"/);
+ assert.doesNotMatch(plain, /device:/);
+});
+
+test("a pinned bundled run passes its own target and output directory, removed afterwards", async () => {
+ const root = await project();
+ const seen: { command?: string; args?: readonly string[]; cwd?: string } = {};
+ await runRecordedTest({
+ projectPath: root, relativePath: FILE, untilSource: 'test("x", async () => {});\n',
+ runtime: { mode: "bundled", root: bundledE2eRoot() },
+ bundledTarget: { platform: "android", bundleId: "com.example.app", device: "emulator-5554" },
+ }, { spawner: spawner(JSON.stringify(report([{ line: 1, status: "passed" }])), 0, seen) });
+ const args = seen.args ?? [];
+ assert.equal(args[args.indexOf("--target") + 1], "android-emulator-5554");
+ const output = args[args.indexOf("--output") + 1];
+ assert.ok(output?.startsWith(seen.cwd!), "the output lives inside the lane's own workspace");
+ assert.equal(existsSync(output!), false);
+});
+
+test("aborting a run kills its process and reports it as cancelled", async () => {
+ const root = await project();
+ let killed = false;
+ const controller = new AbortController();
+ const hanging = (() => {
+ const child = new EventEmitter() as EventEmitter & { stdout: Readable; stderr: Readable; kill: () => void };
+ child.stdout = Readable.from([]); child.stderr = Readable.from([]);
+ child.kill = () => { killed = true; };
+ return child;
+ }) as never;
+ const run = runRecordedTest({
+ projectPath: root, relativePath: FILE, untilSource: 'test("x", async () => {});\n',
+ runtime: { mode: "bundled", root: bundledE2eRoot() }, bundledTarget: { platform: "ios", bundleId: "a.b" },
+ }, { spawner: hanging, signal: controller.signal });
+ setTimeout(() => controller.abort(), 20);
+ await assert.rejects(run, /cancelled/);
+ assert.equal(killed, true);
+});
From 5adf64d9570e472152548b005cfa05e9652a974b Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Tue, 17 Nov 2026 12:27:24 +0500
Subject: [PATCH 08/23] feat(testing): matrix device checklist and per-device
lanes in the Testing panel
Tick devices and a parallel limit in E2E setup (saved per project), run on
N devices, and watch one lane per device with cancel and a per-lane step
view. Disabled with a note when a project config is in use.
Co-Authored-By: Claude Sonnet 5.5
---
packages/ui/src/components/testing-matrix.tsx | 105 ++++++++++
packages/ui/src/components/testing-setup.tsx | 3 +
packages/ui/src/components/testing-view.tsx | 9 +-
packages/ui/src/test-recorder.ts | 2 +-
packages/ui/src/testing-matrix.ts | 128 ++++++++++++
packages/ui/src/testing-panel.ts | 193 ++++++++++++++++++
packages/ui/test/testing-matrix.test.ts | 126 ++++++++++++
7 files changed, 563 insertions(+), 3 deletions(-)
create mode 100644 packages/ui/src/components/testing-matrix.tsx
create mode 100644 packages/ui/src/testing-matrix.ts
create mode 100644 packages/ui/test/testing-matrix.test.ts
diff --git a/packages/ui/src/components/testing-matrix.tsx b/packages/ui/src/components/testing-matrix.tsx
new file mode 100644
index 00000000..1fda013d
--- /dev/null
+++ b/packages/ui/src/components/testing-matrix.tsx
@@ -0,0 +1,105 @@
+import { useEffect, useSyncExternalStore } from "react";
+import { LoaderCircleIcon, RefreshCwIcon, SmartphoneIcon, XIcon } from "lucide-react";
+import type { TestingPanel } from "../testing-panel.ts";
+import { MAX_MATRIX_LIMIT, isTerminalLane, laneDuration, laneLabel, matrixFinished, matrixSummary } from "../testing-matrix.ts";
+import type { MatrixDeviceOption, MatrixLane } from "../testing-matrix.ts";
+import { formatRunDuration } from "../test-recorder.ts";
+import { Badge } from "./ui/badge.tsx";
+import { Button } from "./ui/button.tsx";
+import { Input } from "./ui/input.tsx";
+import { Label } from "./ui/label.tsx";
+
+/** One row of the checklist: a checkbox, the device, and what is true of it right now. */
+function DeviceRow({ device, checked, busy, appMissing, onToggle }: { device: MatrixDeviceOption; checked: boolean; busy: boolean; appMissing: boolean; onToggle: (value: boolean) => void }) {
+ const id = `matrix-${device.deviceId}`;
+ return
;
+}
+
+/**
+ * The matrix checklist in the setup popover: tick devices to run the open test on all of them.
+ * It is disabled when the project uses its own e2e config, which pins its own device.
+ */
+export function MatrixDevices({ panel }: { panel: TestingPanel }) {
+ const state = useSyncExternalStore(panel.subscribe, panel.getSnapshot);
+ const enabled = panel.matrixEnabled;
+ useEffect(() => { if (enabled) void panel.loadMatrixDevices(); }, [panel, enabled]);
+ const apps = panel.matrixApps();
+ const selected = new Set(state.matrixSelected);
+ const toggle = (id: string, value: boolean) => panel.setMatrixSelection(value ? [...state.matrixSelected, id] : state.matrixSelected.filter(entry => entry !== id));
+ if (!enabled) return
Running on several devices needs the bundled runner. This project uses its own e2e config, so tests run on one device.
{count > state.matrixLimit ? `${count - state.matrixLimit} will queue until a slot frees. ` : ""}Devices that are off are booted, and a missing app is copied from another selected device. Agent steps call the model once per device.
No {label} app id for this test, so these devices cannot run it.
}
)}
+ {only &&
This test was recorded on {only === "ios" ? "iOS" : "Android"} and doesn't have an {only === "ios" ? "Android" : "iOS"} target.
}
{state.matrixDevices.length === 0 &&
{state.matrixLoading ? "Looking for simulators and emulators…" : "No simulators or emulators found."}
}
diff --git a/packages/ui/src/testing-panel.ts b/packages/ui/src/testing-panel.ts
index 2404e50b..9a238ad5 100644
--- a/packages/ui/src/testing-panel.ts
+++ b/packages/ui/src/testing-panel.ts
@@ -1406,15 +1406,26 @@ export class TestingPanel {
/** The ticked devices that still exist. Zero when the matrix is unavailable. */
get matrixSelection(): MatrixDeviceOption[] {
if (!this.matrixEnabled) return [];
- const known = new Map(this.snapshot.matrixDevices.map(device => [device.deviceId, device]));
+ const only = this.matrixPlatform;
+ const known = new Map(this.snapshot.matrixDevices.filter(device => !only || device.platform === only).map(device => [device.deviceId, device]));
return this.snapshot.matrixSelected.flatMap(id => known.get(id) ?? []);
}
+ /**
+ * The one platform a pinned Studio test can run on: it was recorded against one app on one
+ * platform, and there is no app id for the other. Undefined when any platform may run.
+ */
+ get matrixPlatform(): "ios" | "android" | undefined {
+ return this.snapshot.runtimeMode === "bundled" ? this.storedTarget?.platform : undefined;
+ }
+
/** How many devices Run would use; a single device runs the plain way. */
get matrixRunCount(): number { return this.matrixSelection.length; }
/** The app a run would drive, per platform: the open test's own app first, then the project's targets. */
matrixApps(): { ios?: string; android?: string } {
+ const pinned = this.matrixPlatform ? this.storedTarget : undefined;
+ if (pinned) return { [pinned.platform]: pinned.bundleId };
const apps: { ios?: string; android?: string } = {};
for (const entry of this.snapshot.targets) {
const platform = entry.platform;
diff --git a/packages/ui/test/testing-panel.test.ts b/packages/ui/test/testing-panel.test.ts
index e075775a..ebe3a792 100644
--- a/packages/ui/test/testing-panel.test.ts
+++ b/packages/ui/test/testing-panel.test.ts
@@ -391,6 +391,22 @@ test("a pinned Studio test can run when its app is installed but not running", (
panel.dispose();
});
+test("a Studio test pinned to iOS only offers and runs on iOS devices", () => {
+ const panel = new TestingPanel(host({}, []), frontApps);
+ panel.setAvailable(true);
+ (panel as unknown as { update(fields: Record): void }).update({
+ projectPath: PROJECT, runtimeMode: "bundled", selectedTestPath: "tests/stored.e2e.ts", selectedTestSource: "x",
+ tests: [{ relativePath: "tests/stored.e2e.ts", name: "stored.e2e.ts", updatedAt: "", sizeBytes: 1, target: { platform: "ios", bundleId: "com.pinned.app" } }],
+ targets: [{ name: "android", platform: "android", bundleId: "com.stale.android" }],
+ matrixDevices: [{ deviceId: "sim", platform: "ios", name: "iPhone" }, { deviceId: "emu", platform: "android", name: "Pixel" }],
+ matrixSelected: ["sim", "emu"],
+ });
+ assert.equal(panel.matrixPlatform, "ios");
+ assert.deepEqual(panel.matrixSelection.map(device => device.deviceId), ["sim"]);
+ assert.deepEqual(panel.matrixApps(), { ios: "com.pinned.app" });
+ panel.dispose();
+});
+
test("Run is unavailable for a Studio test with neither a pinned app nor one in front", () => {
const panel = new TestingPanel(host({}, []), deviceApps);
panel.setAvailable(true);
From 541f5adcff3f790e5f85cf282e6d5d8e67e8df48 Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Wed, 18 Nov 2026 13:52:12 +0500
Subject: [PATCH 14/23] feat: add platform differences fix
---
packages/core/src/testing-projects.ts | 36 ++++-
packages/core/src/testing-run.ts | 47 ++++++-
packages/core/src/testing-tools.ts | 8 +-
packages/core/test/testing-panel-ui.test.ts | 20 ++-
packages/core/test/testing-projects.test.ts | 6 +
packages/core/test/testing-run.test.ts | 25 +++-
packages/ui/src/components/testing-matrix.tsx | 3 +-
packages/ui/src/components/testing-view.tsx | 70 ++++++++--
packages/ui/src/stored-test-steps.ts | 51 +++++++
packages/ui/src/test-recorder.ts | 59 +++++++-
packages/ui/src/testing-matrix.ts | 3 +-
packages/ui/src/testing-panel.ts | 126 +++++++++++++++---
packages/ui/test/stored-test-steps.test.ts | 28 +++-
packages/ui/test/test-recorder.test.ts | 27 ++++
packages/ui/test/testing-panel.test.ts | 79 ++++++++++-
15 files changed, 530 insertions(+), 58 deletions(-)
diff --git a/packages/core/src/testing-projects.ts b/packages/core/src/testing-projects.ts
index a14c41b3..b2708750 100644
--- a/packages/core/src/testing-projects.ts
+++ b/packages/core/src/testing-projects.ts
@@ -369,15 +369,26 @@ export interface StoredTest {
target?: TestTarget;
}
-/** The app a Studio test runs against, kept beside the test and never inside its source. */
-export interface TestTarget { platform: "ios" | "android"; bundleId: string }
+/**
+ * The app a Studio test runs against, kept beside the test and never inside its source.
+ * `platform` and `bundleId` are the app it was recorded or first pinned against; `apps` holds the
+ * app id the user added for the other platform, so the same test can run there too.
+ */
+export interface TestTarget { platform: "ios" | "android"; bundleId: string; apps?: { ios?: string; android?: string } }
const TARGETS_FILE = "targets.json";
+const validAppId = (value: unknown): value is string => typeof value === "string" && value.length > 0 && value.length <= 512;
+
function validTarget(value: unknown): TestTarget | undefined {
const entry = value as Partial | null;
- return (entry?.platform === "ios" || entry?.platform === "android") && typeof entry.bundleId === "string" && entry.bundleId.length > 0 && entry.bundleId.length <= 512
- ? { platform: entry.platform, bundleId: entry.bundleId } : undefined;
+ if (!(entry?.platform === "ios" || entry?.platform === "android") || !validAppId(entry.bundleId)) return undefined;
+ const apps: { ios?: string; android?: string } = {};
+ for (const platform of ["ios", "android"] as const) {
+ const id = entry.apps?.[platform];
+ if (platform !== entry.platform && validAppId(id)) apps[platform] = id;
+ }
+ return { platform: entry.platform, bundleId: entry.bundleId, ...(Object.keys(apps).length > 0 ? { apps } : {}) };
}
async function readTargets(root: string): Promise> {
@@ -405,14 +416,25 @@ async function changeTargets(root: string, change: (targets: Record {
+export async function writeTestTarget(projectPath: string, relativePath: string, target: TestTarget, mode: "replace" | "add" = "replace"): Promise {
const { project, root } = await testStorage(projectPath);
if (project.runtimeMode !== "bundled") return false;
const file = await resolveTestPath(root, relativePath);
if (!(await isFile(file))) throw new ExpectedOperationError("invalid_input", "Save the test before pinning an app to it.");
- const checked = validTarget(target);
+ const checked = validTarget({ platform: target.platform, bundleId: target.bundleId });
if (!checked) throw new ExpectedOperationError("invalid_input", "Choose an iOS or Android app identifier.");
- await changeTargets(root, targets => { targets[relativePath] = checked; });
+ await changeTargets(root, targets => {
+ const current = targets[relativePath];
+ // "add" gives the test an app on a second platform and leaves the recorded one in place.
+ if (mode === "add" && current && current.platform !== checked.platform) {
+ targets[relativePath] = { ...current, apps: { ...current.apps, [checked.platform]: checked.bundleId } };
+ return;
+ }
+ // Replacing the recorded app on its own platform keeps the one added for the other; a
+ // recorded app on another platform is a different test, so nothing of the old pin stays.
+ const kept = current?.platform === checked.platform ? current.apps : undefined;
+ targets[relativePath] = { ...checked, ...(kept ? { apps: kept } : {}) };
+ });
return true;
}
diff --git a/packages/core/src/testing-run.ts b/packages/core/src/testing-run.ts
index 1e95cbad..e49a4eb3 100644
--- a/packages/core/src/testing-run.ts
+++ b/packages/core/src/testing-run.ts
@@ -1,6 +1,6 @@
import { spawn } from "node:child_process";
import { existsSync } from "node:fs";
-import { mkdir, mkdtemp, readFile, readdir, rm, symlink, writeFile } from "node:fs/promises";
+import { mkdir, mkdtemp, readFile, readdir, realpath, rm, symlink, writeFile } from "node:fs/promises";
import { homedir, tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { pathToFileURL } from "node:url";
@@ -60,6 +60,8 @@ export interface TestRunResult {
durationMs?: number;
/** Set when the report could not be read at all, so the panel can say why rather than go quiet. */
output?: string;
+ /** Why the run failed, in one line, when the report says so: see `reportError`. */
+ error?: string;
}
function record(value: unknown): Record | undefined {
@@ -111,6 +113,32 @@ export function reportSteps(report: unknown, file: string): TestRunStep[] {
return steps;
}
+/**
+ * Why a failed run failed, in one line, from the report: the failing step's error, including a
+ * step with no line of its own such as `app.open`, else the attempt's error, else the run's.
+ * A step's line mark carries its own error, so this is what is left when no line could.
+ */
+export function reportError(report: unknown, file: string): string | undefined {
+ const run = record(record(report)?.run);
+ for (const entry of list(run?.results)) {
+ const result = record(entry);
+ if (!result || str(result.status) === "passed" || str(result.status) === "skipped") continue;
+ const attempts = list(result.attempts);
+ const attempt = record(attempts[attempts.length - 1]);
+ for (const item of list(attempt?.steps)) {
+ const step = record(item);
+ const source = record(step?.source);
+ if (!step || (str(source?.file) && str(source?.file) !== file)) continue;
+ const error = errorMessageOf(step.error);
+ if (error) return error;
+ }
+ const error = errorMessageOf(attempt?.error);
+ if (error) return error;
+ }
+ for (const item of list(run?.errors)) { const error = errorMessageOf(item); if (error) return error; }
+ return undefined;
+}
+
/**
* How long the run took, from the report itself rather than from the panel's own clock.
*
@@ -413,7 +441,8 @@ async function runProjectPreview(request: TestRunRequest, deps: TestRunDeps): Pr
if (!request.configPath || request.untilSource === undefined) throw new ExpectedOperationError("invalid_input", "Open the project's e2e config before running this preview.");
const bin = runnerBin(request.projectPath);
await deps.release?.();
- const workspace = await mkdtemp(join(tmpdir(), "mobile-dev-e2e-preview-"));
+ // The real path, for the reason `runBundledTest` gives.
+ const workspace = await realpath(await mkdtemp(join(tmpdir(), "mobile-dev-e2e-preview-")));
const configName = "e2e.config.mts";
try {
await mirrorProject(request.projectPath, workspace, new Set([request.relativePath, configName]));
@@ -483,7 +512,10 @@ async function runBundledTest(request: TestRunRequest, deps: TestRunDeps): Promi
const requiredKey = request.model?.provider === "vercel" ? "AI_GATEWAY_API_KEY" : request.model?.provider === "openrouter" ? "OPENROUTER_API_KEY" : undefined;
if (requiredKey && !process.env[requiredKey]) throw new ExpectedOperationError("invalid_input", `${requiredKey} is not set. Add it to Mobile Dev's environment, then run again.`);
await deps.release?.();
- const workspace = await mkdtemp(join(tmpdir(), "mobile-dev-e2e-run-"));
+ // The real path: macOS's tmpdir is under /var, a symlink to /private/var. The runner sees the
+ // test at its real path but the config at the linked one, cannot place its steps in the test,
+ // and reports every step at "unknown" line 1, which leaves the preview with no line marks.
+ const workspace = await realpath(await mkdtemp(join(tmpdir(), "mobile-dev-e2e-run-")));
const runPath = request.untilSource === undefined ? request.relativePath : untilTestPath(request.relativePath);
const config = join(workspace, "e2e.config.mts");
const progressConfig = join(workspace, PROGRESS_CONFIG);
@@ -536,7 +568,9 @@ async function spawnRun(input: { command: string; commandArgs?: string[]; cwd: s
const report = parseReport(stdout);
const steps = report ? reportSteps(report, input.runPath) : [];
const durationMs = report ? reportDuration(report) : undefined;
- return { status: reportStatus(report, exitCode), exitCode, steps, ...(durationMs === undefined ? {} : { durationMs }), ...(steps.length === 0 ? { output: tail(`${stdout}\n${stderr}`) } : {}) };
+ const status = reportStatus(report, exitCode);
+ const error = report && status !== "passed" ? reportError(report, input.runPath) : undefined;
+ return { status, exitCode, steps, ...(durationMs === undefined ? {} : { durationMs }), ...(error ? { error } : {}), ...(steps.length === 0 ? { output: tail(`${stdout}\n${stderr}`) } : {}) };
}
async function runOnce(request: TestRunRequest, deps: TestRunDeps): Promise {
@@ -605,11 +639,14 @@ async function runOnce(request: TestRunRequest, deps: TestRunDeps): Promise
- dataResult({ pinned: await writeTestTarget(selected, relativePath, { platform, bundleId }) })));
+ }, safe(async ({ projectPath: selected, relativePath, platform, bundleId, mode }: { projectPath: string; relativePath: string; platform: "ios" | "android"; bundleId: string; mode?: "replace" | "add" }) =>
+ dataResult({ pinned: await writeTestTarget(selected, relativePath, { platform, bundleId }, mode) })));
const modelSchema = z.object({
provider: z.enum(["vercel", "openrouter", "openai-compatible", "chatgpt", "copilot", "opencode-console", "grok"]),
diff --git a/packages/core/test/testing-panel-ui.test.ts b/packages/core/test/testing-panel-ui.test.ts
index 68a6cb65..753b9fb8 100644
--- a/packages/core/test/testing-panel-ui.test.ts
+++ b/packages/core/test/testing-panel-ui.test.ts
@@ -301,10 +301,14 @@ test("a run marks the preview line by line, and marks nothing it was not told ab
assert.equal(marks()[7], "is-failed", "a failure stays on the line the report blames");
assert.match(dom.window.document.body.textContent ?? "", /Timed out waiting for the element/);
- // A run that produced no report has no line to mark, so the runner's own words stand in.
+ // A run that produced no report has no line to mark. The runner's raw output is not shown.
await act(async () => { testRecorder.finishRun({ status: "failed", steps: [], output: "No tests matched" }); });
assert.deepEqual(marks().filter(mark => mark !== ""), [], "no invented marks");
- assert.match(dom.window.document.body.textContent ?? "", /No tests matched/);
+ assert.doesNotMatch(dom.window.document.body.textContent ?? "", /No tests matched/);
+
+ // A failure no line carries still shows its reason, in a chip under the verdict.
+ await act(async () => { testRecorder.finishRun({ status: "failed", steps: [], error: "App com.example.android is not installed" }); });
+ assert.equal(dom.window.document.querySelector("[data-testing-run-error]")?.textContent, "App com.example.android is not installed");
testRecorder.clearRun();
testRecorder.clearSteps();
@@ -824,7 +828,7 @@ test("a stored Studio test shows its pinned app and offers to re-pin it to the a
const deviceApps = { subscribe: () => () => undefined, getSnapshot: () => DEVICE_SNAPSHOT };
let repinned = 0;
const panel = { ...panelStub({ runtimeMode: "bundled", selectedTestPath: "tests/flow.e2e.ts", selectedTestSource: "await tap();\n" }),
- storedTarget: { platform: "ios", bundleId: "com.a" }, foregroundTarget: { platform: "ios", bundleId: "com.b" },
+ storedTarget: { platform: "ios", bundleId: "com.a" }, storedApps: { ios: "com.a" }, foregroundTarget: { platform: "ios", bundleId: "com.b" },
storedRunHint: "com.a is not installed on the mirrored device.", canRunStored: false, repinStoredTest: async () => { repinned += 1; } };
await act(async () => { root.render(createElement(TestingView, { panel, deviceApps })); });
assert.match(dom.window.document.querySelector("[data-testing-pinned-app]")?.textContent ?? "", /com\.a/);
@@ -832,6 +836,16 @@ test("a stored Studio test shows its pinned app and offers to re-pin it to the a
assert.equal((dom.window.document.querySelector("[data-testing-run]") as HTMLButtonElement).disabled, true);
await act(async () => { (dom.window.document.querySelector("[data-testing-repin]") as HTMLElement).click(); });
assert.equal(repinned, 1);
+ assert.equal(dom.window.document.querySelector("[data-testing-repin]")?.textContent, "Use current app");
+ // With an Android app in front, the button adds it for Android and keeps the iOS app.
+ const android = { ...panel, foregroundTarget: { platform: "android", bundleId: "com.b.android" } };
+ await act(async () => { root.render(createElement(TestingView, { panel: android, deviceApps })); });
+ assert.equal(dom.window.document.querySelector("[data-testing-repin]")?.textContent, "Add Android app");
+ // Once added, both apps show, and the app in front needs no button.
+ const both = { ...android, storedTarget: { platform: "ios", bundleId: "com.a", apps: { android: "com.b.android" } }, storedApps: { ios: "com.a", android: "com.b.android" } };
+ await act(async () => { root.render(createElement(TestingView, { panel: both, deviceApps })); });
+ assert.match(dom.window.document.querySelector('[data-testing-added-app="android"]')?.textContent ?? "", /com\.b\.android/);
+ assert.equal(dom.window.document.querySelector("[data-testing-repin]"), null);
await act(async () => { root.render(createElement("div")); });
await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
onTeardown(async () => { await act(async () => { root.unmount(); }); });
diff --git a/packages/core/test/testing-projects.test.ts b/packages/core/test/testing-projects.test.ts
index cd38da68..0741e19c 100644
--- a/packages/core/test/testing-projects.test.ts
+++ b/packages/core/test/testing-projects.test.ts
@@ -235,6 +235,12 @@ test("a Studio test is pinned to its app beside the source, listed, re-pinned an
assert.equal(await readTestFile(studio, "tests/flow.e2e.ts"), SOURCE, "the source carries no target");
await writeTestTarget(studio, "tests/flow.e2e.ts", { platform: "android", bundleId: "com.b" });
assert.deepEqual(await readTestTarget(studio, "tests/flow.e2e.ts"), { platform: "android", bundleId: "com.b" });
+ // Adding an app for the other platform keeps the recorded one, and re-pinning the recorded
+ // platform keeps the added one.
+ await writeTestTarget(studio, "tests/flow.e2e.ts", { platform: "ios", bundleId: "com.c" }, "add");
+ assert.deepEqual(await readTestTarget(studio, "tests/flow.e2e.ts"), { platform: "android", bundleId: "com.b", apps: { ios: "com.c" } });
+ await writeTestTarget(studio, "tests/flow.e2e.ts", { platform: "android", bundleId: "com.d" });
+ assert.deepEqual(await readTestTarget(studio, "tests/flow.e2e.ts"), { platform: "android", bundleId: "com.d", apps: { ios: "com.c" } });
await deleteTestFile(studio, "tests/flow.e2e.ts");
await writeTestFile(studio, "tests/flow.e2e.ts", SOURCE);
assert.equal(await readTestTarget(studio, "tests/flow.e2e.ts"), undefined, "a deleted test leaves no pin behind");
diff --git a/packages/core/test/testing-run.test.ts b/packages/core/test/testing-run.test.ts
index 0fb3b8a0..33d978a9 100644
--- a/packages/core/test/testing-run.test.ts
+++ b/packages/core/test/testing-run.test.ts
@@ -5,9 +5,9 @@ import { Readable } from "node:stream";
import { mkdtemp, mkdir, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { dirname, isAbsolute, join } from "node:path";
-import { existsSync } from "node:fs";
+import { existsSync, realpathSync } from "node:fs";
import { readFileSync } from "node:fs";
-import { RUNNER_CWD, bundledConfigSource, bundledTargetName, parseProgressLine, parseReport, progressConfigSource, reportDuration, reportSteps, reportStatus, runRecordedTest, runnerBin, runnerEnv, untilTestPath } from "../src/testing-run.ts";
+import { RUNNER_CWD, bundledConfigSource, bundledTargetName, parseProgressLine, parseReport, progressConfigSource, reportDuration, reportError, reportSteps, reportStatus, runRecordedTest, runnerBin, runnerEnv, untilTestPath } from "../src/testing-run.ts";
import { bundledE2eRoot } from "../src/e2e-runtime.ts";
const FILE = "tests/a-recorded-flow.e2e.ts";
@@ -52,6 +52,25 @@ test("a step with no line of its own is not attributed to one", () => {
assert.deepEqual(reportSteps(raw, FILE).map(step => step.line), [8]);
});
+test("a failure no line can carry is still the run's reason", () => {
+ // `app.open` failing on a device has no source line, so no mark can show it; the reason must not
+ // be lost with the mark.
+ const raw = report([], "failed");
+ raw.run.results[0].attempts[0].steps.push({
+ id: "a:open", index: 0, kind: "app", api: "app.open", label: "", status: "failed", durationMs: 90,
+ source: { file: "", line: 0, column: 0 }, error: { message: "App com.example.android is not installed\nstack" },
+ } as never);
+ assert.equal(reportError(raw, FILE), "App com.example.android is not installed");
+ // With no failing step, the attempt's own error is the reason, then the run's.
+ const attempt = report([], "failed");
+ (attempt.run.results[0].attempts[0] as Record).error = { message: "Device disconnected" };
+ assert.equal(reportError(attempt, FILE), "Device disconnected");
+ const run = report([], "failed");
+ (run.run as Record).errors = [{ message: "No target matched android" }];
+ assert.equal(reportError(run, FILE), "No target matched android");
+ assert.equal(reportError(report([{ line: 8, status: "passed" }], "passed"), FILE), undefined);
+});
+
test("a retried test is read from the attempt that decided it", () => {
const raw = report([{ line: 8, status: "failed" }], "passed");
raw.run.results[0].attempts.push({
@@ -327,6 +346,8 @@ test("bundled mode runs and cleans an isolated Studio workspace", async () => {
assert.ok(seen.args?.some((value, index) => value === "--target" && seen.args?.[index + 1] === "ios"));
const config = seen.args![seen.args!.indexOf("--config") + 1];
assert.ok(isAbsolute(config) && dirname(config).includes("mobile-dev-e2e-run-"), "the CLI gets the workspace's config by absolute path");
+ // macOS's tmpdir is a symlink; a linked config path makes the runner report every step at "unknown".
+ assert.ok(config.startsWith(realpathSync(tmpdir())), "the workspace is given by its real path");
assert.equal(existsSync(dirname(config)), false, "temporary config, test and node_modules link are cleaned");
assert.equal(seen.cwd, runnerCwd, "the daemon a run starts must not inherit the workspace it outlives");
assert.equal(existsSync(seen.cwd!), true, "the spawn cwd survives the workspace's removal");
diff --git a/packages/ui/src/components/testing-matrix.tsx b/packages/ui/src/components/testing-matrix.tsx
index 5ac04b7e..ded80bbb 100644
--- a/packages/ui/src/components/testing-matrix.tsx
+++ b/packages/ui/src/components/testing-matrix.tsx
@@ -1,5 +1,6 @@
import { useEffect, useSyncExternalStore } from "react";
import { LoaderCircleIcon, RefreshCwIcon, SmartphoneIcon, XIcon } from "lucide-react";
+import { platformLabel } from "../testing-panel.ts";
import type { TestingPanel } from "../testing-panel.ts";
import { MAX_MATRIX_LIMIT, isTerminalLane, laneDuration, laneLabel, matrixFinished, matrixSummary } from "../testing-matrix.ts";
import type { MatrixDeviceOption, MatrixLane } from "../testing-matrix.ts";
@@ -51,7 +52,7 @@ export function MatrixDevices({ panel }: { panel: TestingPanel }) {
busy={panel.matrixBusy(device.deviceId)} appMissing={!apps[device.platform]} onToggle={value => toggle(device.deviceId, value)} />)}
{!apps[devices[0]!.platform] &&
No {label} app id for this test, so these devices cannot run it.
}
)}
- {only &&
This test was recorded on {only === "ios" ? "iOS" : "Android"} and doesn't have an {only === "ios" ? "Android" : "iOS"} target.
}
+ {only &&
This test was recorded on {platformLabel(only)} and doesn't have an {platformLabel(only === "ios" ? "android" : "ios")} target. To add one, open the app on an {platformLabel(only === "ios" ? "android" : "ios")} device in the mirror and choose Add {platformLabel(only === "ios" ? "android" : "ios")} app.
}
{state.matrixDevices.length === 0 &&
{state.matrixLoading ? "Looking for simulators and emulators…" : "No simulators or emulators found."}
}
diff --git a/packages/ui/src/components/testing-view.tsx b/packages/ui/src/components/testing-view.tsx
index d48cd099..26455fd8 100644
--- a/packages/ui/src/components/testing-view.tsx
+++ b/packages/ui/src/components/testing-view.tsx
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";
import { BotIcon, CheckIcon, ChevronDownIcon, ChevronRightIcon, CircleIcon, CircleXIcon, CopyIcon, FileCode2Icon, FilePlus2Icon, FlaskConicalIcon, FolderOpenIcon, GripVerticalIcon, HistoryIcon, LoaderCircleIcon, MoreHorizontalIcon, PlayIcon, SaveIcon, SquareIcon, Trash2Icon, UserIcon, XIcon } from "lucide-react";
import type { DeviceAppsStore } from "../device-apps.ts";
+import { platformLabel } from "../testing-panel.ts";
import type { TestingPanel } from "../testing-panel.ts";
import { OPEN_STEP, formatRunDuration, testRecorder } from "../test-recorder.ts";
import type { DevicePlatform, TestRunView } from "../test-recorder.ts";
@@ -699,21 +700,71 @@ function SourceStepMenu({ source, step, index, mode, onEdit, editable }: {
}
/** A project file's awaited calls can be edited in a temporary working copy. */
-/** The app a Studio test is pinned to, with a way to pin it to the app in front instead. */
+/**
+ * The apps a Studio test runs against, one per platform, with a way to take the app in front: on
+ * the recorded platform it replaces that app, on the other it adds one so the test runs on both.
+ */
function PinnedApp({ panel }: { panel: TestingPanel }) {
const state = useSyncExternalStore(panel.subscribe, panel.getSnapshot);
const pinned = panel.storedTarget;
const front = panel.foregroundTarget;
- const canRepin = Boolean(front) && !state.running && (!pinned || pinned.bundleId !== front!.bundleId || pinned.platform !== front!.platform);
- return
-
+ const apps = panel.storedApps;
+ const added = pinned ? (["ios", "android"] as const).filter(platform => platform !== pinned.platform && apps[platform]) : [];
+ const current = front ? apps[front.platform] : undefined;
+ const canRepin = Boolean(front) && !state.running && current !== front!.bundleId;
+ const label = !pinned || !front ? "Pin current app"
+ : front.platform === pinned.platform ? "Use current app"
+ : current ? `Use current ${platformLabel(front.platform)} app` : `Add ${platformLabel(front.platform)} app`;
+ return
+ {pinned ? pinned.bundleId : "No app pinned"}
- {pinned && {pinned.platform}}
+ {pinned && {platformLabel(pinned.platform)}}
- {canRepin && void panel.repinStoredTest()}>{pinned ? "Use current app" : "Pin current app"}}
+ {added.map(platform =>
+ {apps[platform]}
+ {platformLabel(platform)}
+ )}
+ {canRepin && void panel.repinStoredTest()}>{label}}
;
}
+/** Why the run failed, as a chip under the verdict, so a long reason does not crowd the header. */
+function RunFailureReason({ run }: { run: { state: string; error?: string } | null | undefined }) {
+ if (run?.state !== "failed" || !run.error) return null;
+ return
+ {run.error}
+ ;
+}
+
+/**
+ * After a Studio test fails on the platform it was not recorded on: offers to pick the failed
+ * line's element on this platform, which keeps the recorded locator for the other one behind a
+ * `platform` branch. While picking, says what to do on the mirror.
+ */
+function ReRecordLine({ panel }: { panel: TestingPanel }) {
+ useSyncExternalStore(panel.subscribe, panel.getSnapshot);
+ const recorder = useSyncExternalStore(testRecorder.subscribe, testRecorder.getSnapshot);
+ const mirrored = panel.mirroredPlatform;
+ if (recorder.picking && mirrored) return
+ {recorder.preparing ? : null}
+ Right-click the element on the {platformLabel(mirrored)} mirror to use it for this step.
+ panel.cancelReRecord()}>Cancel
+
;
+ const target = panel.reRecord;
+ if (!target) return null;
+ const { line } = target;
+ const label = platformLabel(target.platform);
+ if (!target.ready || !mirrored) return
+ Line {line} may differ on {label}. Mirror an {target.platform === "ios" ? "iOS simulator" : "Android device"} to re-record it.
+
;
+ return
+ Line {line} may differ on {platformLabel(mirrored)}.
+ void panel.reRecordStoredLine(line)}
+ title={`Pick the element on the ${platformLabel(mirrored)} mirror. Line ${line} keeps its current locator on the other platform.`}>Re-record on {platformLabel(mirrored)}
+
;
+}
+
function StoredTestPreview({ panel, source, path, loading }: { panel: TestingPanel; source: string; path: string; loading: boolean }) {
const panelState = useSyncExternalStore(panel.subscribe, panel.getSnapshot);
const recorder = useSyncExternalStore(testRecorder.subscribe, testRecorder.getSnapshot);
@@ -747,8 +798,10 @@ function StoredTestPreview({ panel, source, path, loading }: { panel: TestingPan
disabled={editing || panelState.running || panelState.saving} onClick={() => setEditing(true)}>Edit
{recorder.run?.state === "running" && Running…}
{recorder.run?.state === "passed" && Passed}
- {recorder.run?.state === "failed" && {recorder.run.error ?? "Failed"}}
+ {recorder.run?.state === "failed" && Failed}
+
+
{editing ? setEditing(false)} onSave={value => { panel.editStoredTest(value); setEditing(false); void panel.saveStoredTest(); }} />
: }
{state.run?.state === "passed" && Passed}
{state.run?.state === "failed" &&
- {state.run.error ?? "Failed"}
+ Failed
}
{/* The runner's own number, beside its verdict and on a failure too: how long a run took
before it gave up is part of reading it. It is not the panel's `ui.testing.run`
@@ -888,6 +941,7 @@ function TestingRecorder({ panel, recordable, deviceId }: { panel: TestingPanel;
{state.run?.stale && · before your edits}
+
{editing ? setEditing(false)} onSave={value => { testRecorder.editSource(value); setEditing(false); void panel.saveTest(); }} />
: : `, possibly in parentheses. */
+const BRANCH = /^platform === "(ios|android)" \? (screen\..+?\)) : (.+)$/;
+
+/**
+ * Gives one step a locator for one platform and keeps the one it had for every other:
+ * `expect(screen.getByTestId("Home"))` becomes
+ * `expect(platform === "android" ? screen.getByText("Home") : screen.getByTestId("Home"))`.
+ *
+ * A step that already branches on that platform has its branch replaced rather than nested. The
+ * test callback gains the `platform` fixture the branch reads. Anything this cannot rewrite with
+ * certainty — a multi-line call, a step whose locator it cannot find — comes back unchanged.
+ */
+export function branchStoredStepLocator(source: string, line: number, platform: "ios" | "android", locator: string): string {
+ const step = storedTestSteps(source).find(entry => entry.line === line);
+ const current = step && stepLocator(step.label);
+ if (!step || !current || !locator.startsWith("screen.")) return source;
+ // An action's branch is wrapped in parentheses so `.tap()` applies to it; read it without them.
+ const existing = (/^\(.*\)$/.test(current) ? current.slice(1, -1) : current).match(BRANCH);
+ // An action needs the branch parenthesised for `.tap()` to apply to its result; an argument does not.
+ const isAction = /\.(?:tap|doubleTap|longPress)\(\)$/.test(step.label) && !step.label.startsWith("expect(");
+ // Two platforms, so one branch is enough: an existing branch keeps its other side and takes the
+ // new locator on this platform's side, whichever side that is.
+ const branch = !existing ? `platform === "${platform}" ? ${locator} : ${current}`
+ : existing[1] === platform ? `platform === "${platform}" ? ${locator} : ${existing[3]}`
+ : `platform === "${existing[1]}" ? ${existing[2]} : ${locator}`;
+ const replacement = isAction ? `(${branch})` : branch;
+ const changed = editLine(source, line, (lines, index) => {
+ const text = lines[index]!;
+ const at = text.indexOf(current);
+ if (at >= 0) lines[index] = text.slice(0, at) + replacement + text.slice(at + current.length);
+ });
+ return changed === source ? source : withPlatformFixture(changed);
+}
+
+/** Adds `platform` to the test callback's destructured fixtures when it is not there yet. */
+function withPlatformFixture(source: string): string {
+ return source.replace(/(\btest\s*\([^,]+,\s*async\s*\(\s*\{)([^}]*)(\}\s*\)\s*=>)/, (whole, open: string, fixtures: string, close: string) => {
+ if (/\bplatform\b/.test(fixtures)) return whole;
+ const names = fixtures.trim().replace(/,$/, "");
+ return `${open} ${names ? `${names}, ` : ""}platform ${close}`;
+ });
+}
diff --git a/packages/ui/src/test-recorder.ts b/packages/ui/src/test-recorder.ts
index 0320479e..07258281 100644
--- a/packages/ui/src/test-recorder.ts
+++ b/packages/ui/src/test-recorder.ts
@@ -1,4 +1,4 @@
-import { agentStepLabel, allStepOffers, anchorSelector, emitE2eTest, emitE2eTestLines, hitLadder, isAgentStep, resolveSelector, stepEffect, stepIsAssertion, stepLabel, stepNeedsValue, stepOffers, swipeDirection, swipePath, treeHealth } from "@mobile-dev/shared/test-recording.ts";
+import { agentStepLabel, allStepOffers, anchorSelector, emitE2eTest, emitE2eTestLines, hitLadder, isAgentStep, resolveSelector, selectorSource, stepEffect, stepIsAssertion, stepLabel, stepNeedsValue, stepOffers, swipeDirection, swipePath, treeHealth } from "@mobile-dev/shared/test-recording.ts";
import type { AgentParams, AgentStep, AgentStepKind, PinnedStep, PinnedStepKind, RecordedStep, StepOffer, StepTarget, SwipeDirection, VisionMode } from "@mobile-dev/shared/test-recording.ts";
import type { ScreenBounds, ScreenComponent, ScreenPoint, ScreenSize } from "@mobile-dev/shared/screen-annotations.ts";
import { countUiEvent, recordUiTiming, setUiGauge } from "./telemetry.ts";
@@ -147,6 +147,11 @@ export type TestRecorderSnapshot = {
* holds this until that read lands, which is the moment selection actually works.
*/
preparing: boolean;
+ /**
+ * The recorder is armed to pick one element rather than record steps: the next right-click on the
+ * mirror hands that element's locator to whoever asked, and recording stops. No step is added.
+ */
+ picking: boolean;
/**
* What a tap at the pointer would record, for the outline drawn over the mirror: the bounds of
* the element the selector would name, the step it would add, and the screen those bounds are
@@ -262,7 +267,7 @@ export class TestRecorder {
/** That element's rectangle, which is the box a scoped swipe is drawn inside. */
private lastBounds?: ScreenBounds;
private snapshot: TestRecorderSnapshot = {
- recordingDeviceId: "", recordingPlatform: "", agentDeviceId: "", steps: [], title: DEFAULT_TITLE, revision: 0, flowId: newFlowId(), resolving: false, preparing: false, error: "",
+ recordingDeviceId: "", recordingPlatform: "", agentDeviceId: "", steps: [], title: DEFAULT_TITLE, revision: 0, flowId: newFlowId(), resolving: false, preparing: false, picking: false, error: "",
};
private fadeTimer?: ReturnType;
@@ -440,7 +445,8 @@ export class TestRecorder {
// A flow that is not being resumed is a different recording, however much of the old one is
// still on screen a moment before. Anything holding on to the last flow — the panel's kept
// draft above all — has to be told, or the next thing written lands on the wrong one.
- this.update({ recordingDeviceId: deviceId, recordingPlatform: platform, error: "", menu: undefined, preparing: true, ...(keepSteps ? {} : { steps: [], sourceOverride: undefined, flowId: newFlowId() }) });
+ this.pickHandler = undefined;
+ this.update({ recordingDeviceId: deviceId, recordingPlatform: platform, error: "", menu: undefined, preparing: true, picking: false, ...(keepSteps ? {} : { steps: [], sourceOverride: undefined, flowId: newFlowId() }) });
countUiEvent("ui.testing.record_start");
// The first tree read is what makes an element selectable, and it is the slow part: the
// session attaches to the app and the tree is projected before anything can be named. Warming
@@ -473,10 +479,35 @@ export class TestRecorder {
}
}
+ /**
+ * Arms the mirror to pick one element, for a step that needs a locator on this device rather
+ * than a new step: the outline follows the pointer as when recording, and the next right-click
+ * resolves that element and hands its locator code (`screen.getByText("Home")`) to `onPick`.
+ *
+ * Unlike `start` it leaves the recording, its steps and the last run's marks alone: picking is
+ * about a saved test, and the flow on screen is not the one being changed.
+ */
+ pickElement(deviceId: string, platform: DevicePlatform, onPick: (locator: string) => void) {
+ const reader = this.readers.get(this.deviceKey(deviceId, platform));
+ if (!deviceId || !reader || this.snapshot.agentDeviceId || this.snapshot.recordingDeviceId) return false;
+ if (this.reader !== reader) {
+ this.reader?.release?.();
+ this.reader = reader;
+ }
+ this.invalidate();
+ this.clearHover();
+ this.pickHandler = onPick;
+ this.update({ recordingDeviceId: deviceId, recordingPlatform: platform, error: "", menu: undefined, preparing: true, picking: true });
+ void this.prepare(deviceId, platform);
+ return true;
+ }
+ private pickHandler: ((locator: string) => void) | undefined;
+
stop() {
if (!this.snapshot.recordingDeviceId) return;
this.clearHover();
- this.update({ recordingDeviceId: "", recordingPlatform: "", agentDeviceId: "", resolving: false, preparing: false, menu: undefined });
+ this.pickHandler = undefined;
+ this.update({ recordingDeviceId: "", recordingPlatform: "", agentDeviceId: "", resolving: false, preparing: false, picking: false, menu: undefined });
// The steps stay; the device does not. See `RecorderReader.release`.
this.reader?.release?.();
countUiEvent("ui.testing.record_stop");
@@ -573,7 +604,7 @@ export class TestRecorder {
this.clearHover();
this.clearRun();
this.update({
- recordingDeviceId: "", recordingPlatform: "", resolving: false, preparing: false, error: "", menu: undefined,
+ recordingDeviceId: "", recordingPlatform: "", resolving: false, preparing: false, picking: false, error: "", menu: undefined,
steps: [...steps], sourceOverride: source, flowId: newFlowId(), ...(title ? { title } : {}),
});
countUiEvent("ui.testing.draft_restore");
@@ -752,11 +783,25 @@ export class TestRecorder {
const innermost = hitLadder(components, point, this.reader?.screen())[0]?.nodeId;
if (innermost !== this.hoverInnermost) { this.hoverInnermost = innermost; this.hoverLevel = 0; }
this.showHover(components);
+ if (this.pickHandler) { this.pick(components, point); return; }
this.menuPoint = point;
this.showMenu(components);
countUiEvent("ui.testing.menu_open");
}
+ /** Hands the outlined element's locator to the pick in progress, then stops picking. */
+ private pick(components: ScreenComponent[], point: ScreenPoint) {
+ const screen = this.reader?.screen();
+ const onPick = this.pickHandler;
+ if (!screen || !onPick) return;
+ const { selector } = resolveSelector(components, point, screen, this.hoverLevel);
+ // A coordinate is not a locator: it cannot stand in for one in an assertion, and on another
+ // device it would name something else.
+ if (selector.kind === "point") { this.update({ error: "Nothing here can be named by the test runner. Pick another element, or walk out to its container with the scroll wheel." }); return; }
+ this.stop();
+ onPick(selectorSource(selector));
+ }
+
/** The menu for the element the outline currently shows, resolved from the cached tree. */
private showMenu(components: ScreenComponent[]) {
const point = this.menuPoint;
@@ -939,7 +984,7 @@ export class TestRecorder {
* that failed stays for good, since it is the only thing on screen that says where. See
* `fadePassedMarks`.
*/
- finishRun(result: { status: string; steps: { line: number; status: string; error?: string }[]; output?: string; durationMs?: number }) {
+ finishRun(result: { status: string; steps: { line: number; status: string; error?: string }[]; error?: string; output?: string; durationMs?: number }) {
this.stopFade();
const lines: Record = {};
let error: string | undefined;
@@ -951,6 +996,8 @@ export class TestRecorder {
if (mark === "failed" && !error) error = step.error ?? `${step.status} at line ${step.line}`;
}
const passed = result.status === "passed" && error === undefined;
+ // A failure no line could carry, such as the app failing to open, still says why.
+ if (!passed && !error && result.error) error = result.error;
// How far the run was asked to go is a fact about the run, so it outlives the run's own report:
// "Passed" on a flow that stopped three steps in has to keep saying so.
const untilLine = this.snapshot.run?.untilLine;
diff --git a/packages/ui/src/testing-matrix.ts b/packages/ui/src/testing-matrix.ts
index 1fb647a2..c4ab731b 100644
--- a/packages/ui/src/testing-matrix.ts
+++ b/packages/ui/src/testing-matrix.ts
@@ -11,7 +11,7 @@ export const DEFAULT_MATRIX_LIMIT = 3;
export const MAX_MATRIX_LIMIT = 8;
export type LaneProgress = { stepIndex: number; phase: "start" | "end"; status?: string; error?: string };
-export type LaneResult = { status: string; steps: { line: number; status: string; error?: string }[]; output?: string; durationMs?: number };
+export type LaneResult = { status: string; steps: { line: number; status: string; error?: string }[]; error?: string; output?: string; durationMs?: number };
export type MatrixLane = {
runId: string; deviceId: string; deviceName: string; platform: MatrixPlatform; state: LaneState;
progress: LaneProgress[]; result?: LaneResult; error?: string; startedAt?: number; finishedAt?: number;
@@ -83,6 +83,7 @@ export function parseMatrix(value: unknown): MatrixView | null {
status: str(result.status) || "failed",
steps: (Array.isArray(result.steps) ? result.steps : []).map(record).filter((step): step is Record => step !== null && typeof step.line === "number" && step.line > 0)
.map(step => ({ line: step.line as number, status: str(step.status), ...(str(step.error) ? { error: str(step.error) } : {}) })),
+ ...(str(result.error) ? { error: str(result.error) } : {}),
...(str(result.output) ? { output: str(result.output) } : {}),
...(typeof result.durationMs === "number" ? { durationMs: result.durationMs } : {}),
} } : {}),
diff --git a/packages/ui/src/testing-panel.ts b/packages/ui/src/testing-panel.ts
index 9a238ad5..e2512263 100644
--- a/packages/ui/src/testing-panel.ts
+++ b/packages/ui/src/testing-panel.ts
@@ -7,7 +7,7 @@ import { isRecordableDevice, recordablePlatform } from "@mobile-dev/shared/panel
import type { ScreenComponent } from "@mobile-dev/shared/screen-annotations.ts";
import { screenSize } from "@mobile-dev/shared/screen-annotations.ts";
import { testFileSlug } from "@mobile-dev/shared/test-recording.ts";
-import { storedTestCallLines, storedTestUntilSource } from "./stored-test-steps.ts";
+import { branchStoredStepLocator, storedTestCallLines, storedTestUntilSource } from "./stored-test-steps.ts";
import type { RecordedStep } from "@mobile-dev/shared/test-recording.ts";
import type { TestDraftSummary } from "@mobile-dev/shared/test-drafts.ts";
import { DEFAULT_MATRIX_LIMIT, clampLimit, isTerminalLane, matrixFinished, parseMatrix, parseMatrixDevices, readMatrixPreferences, writeMatrixPreferences } from "./testing-matrix.ts";
@@ -20,7 +20,7 @@ import type { MatrixDeviceOption, MatrixLane, MatrixView } from "./testing-matri
* project already holds. A saved recording moves from one to the other, which is the whole reason
* this exists — the draft is deleted on save, so before this the test left the list entirely.
*/
-export type StoredTestSummary = { relativePath: string; name: string; updatedAt: string; sizeBytes: number; /** The app a Studio test is pinned to. */ target?: { platform: "ios" | "android"; bundleId: string } };
+export type StoredTestSummary = { relativePath: string; name: string; updatedAt: string; sizeBytes: number; /** The app a Studio test is pinned to, and any app added for the other platform. */ target?: { platform: "ios" | "android"; bundleId: string; apps?: { ios?: string; android?: string } } };
/**
* An agent recording, as the server reports it.
@@ -155,6 +155,9 @@ function object(value: unknown): Record | null {
return value && typeof value === "object" ? value as Record : null;
}
function text(value: unknown): string { return typeof value === "string" ? value : ""; }
+/** How a platform reads in the panel. */
+export function platformLabel(platform: "ios" | "android"): string { return platform === "ios" ? "iOS" : "Android"; }
+
function projectName(projectPath: string): string { return projectPath.split("/").filter(Boolean).at(-1) ?? projectPath; }
/** The targets a `mobile_testing_project_config` result lists, keeping only named entries. */
@@ -736,6 +739,61 @@ export class TestingPanel {
});
}
+ /**
+ * The line a re-record would change: the selected Studio test's first failed line, when the last
+ * run failed on the other platform than the one it was recorded on and the mirror shows that one.
+ * Zero when there is nothing to offer.
+ */
+ get reRecordLine(): number { return this.reRecord?.line ?? 0; }
+
+ /**
+ * The failed line that can take a locator for the platform it failed on, and whether the mirror
+ * shows that platform: the element is picked on the mirror, so a failure on an Android lane
+ * while an iOS device is mirrored can be named but not re-recorded yet.
+ */
+ get reRecord(): { line: number; platform: "ios" | "android"; ready: boolean } | undefined {
+ const stored = this.storedTarget;
+ const platform = this.runPlatform ?? this.mirroredPlatform;
+ const run = testRecorder.getSnapshot().run;
+ if (!stored || !platform || platform === stored.platform || !this.storedAppOn(platform) || run?.state !== "failed" || this.snapshot.running || this.snapshot.saving) return;
+ const failed = Object.entries(run.lines).filter(([, mark]) => mark === "failed").map(([line]) => Number(line)).sort((a, b) => a - b)[0] ?? 0;
+ // Only a line whose locator can be swapped: a multi-line call or an agent step stays the user's to edit.
+ if (!failed || branchStoredStepLocator(this.snapshot.selectedTestSource, failed, platform, "screen.getByText(\"\")") === this.snapshot.selectedTestSource) return;
+ return { line: failed, platform, ready: this.mirroredPlatform === platform };
+ }
+
+ /**
+ * Re-records one failed line's locator on the mirrored platform: the user right-clicks the
+ * element on the mirror, and the line keeps its locator for the recorded platform and takes the
+ * picked one on this platform behind a `platform` branch. The test is then saved.
+ */
+ async reRecordStoredLine(line: number) {
+ const mirrored = this.mirroredPlatform;
+ const app = mirrored ? this.storedAppOn(mirrored) : undefined;
+ const device = this.deviceApps.getSnapshot().device;
+ if (!mirrored || !app || !device || line <= 0) return;
+ this.update({ error: null });
+ // The element tree is read from the app in front, so it has to be this platform's app.
+ if (this.deviceApps.getSnapshot().foregroundApp?.bundleId !== app.bundleId) {
+ try { await this.call("mobile_launch_app", { platform: app.platform, deviceId: device.udid, bundleId: app.bundleId }, 120_000); }
+ catch (error) { this.update({ error: `Could not open ${app.bundleId}: ${error instanceof Error ? error.message : String(error)}` }); return; }
+ }
+ const relativePath = this.snapshot.selectedTestPath;
+ const armed = testRecorder.pickElement(device.udid, mirrored, locator => {
+ const source = this.snapshot.selectedTestSource;
+ if (this.snapshot.selectedTestPath !== relativePath) return;
+ const next = branchStoredStepLocator(source, line, mirrored, locator);
+ if (next === source) { this.update({ error: `Line ${line} could not be changed. Edit it in Preview.` }); return; }
+ countUiEvent("ui.testing.rerecord_line");
+ this.editStoredTest(next);
+ void this.saveStoredTest();
+ });
+ if (!armed) this.update({ error: "The mirror is busy recording. Stop the recording, then try again." });
+ }
+
+ /** Leaves a re-record without changing the test. */
+ cancelReRecord() { if (testRecorder.getSnapshot().picking) testRecorder.stop(); }
+
async saveStoredTest() {
const { projectPath, selectedTestPath: relativePath } = this.snapshot;
if (!projectPath || !relativePath || !this.snapshot.selectedTestStaged || this.snapshot.saving) return;
@@ -1188,6 +1246,24 @@ export class TestingPanel {
return this.snapshot.tests.find(test => test.relativePath === this.snapshot.selectedTestPath)?.target;
}
+ /** Every app id the selected Studio test has, per platform: the recorded one and any added one. */
+ get storedApps(): { ios?: string; android?: string } {
+ const stored = this.storedTarget;
+ return stored ? { ...stored.apps, [stored.platform]: stored.bundleId } : {};
+ }
+
+ /** The selected Studio test's app on one platform, if it has one there. */
+ storedAppOn(platform: "ios" | "android"): { platform: "ios" | "android"; bundleId: string } | undefined {
+ const bundleId = this.storedApps[platform];
+ return bundleId ? { platform, bundleId } : undefined;
+ }
+
+ /** The platform of the mirrored device, when it is one Studio can record and run on. */
+ get mirroredPlatform(): "ios" | "android" | undefined {
+ const { device } = this.deviceApps.getSnapshot();
+ return device && isRecordableDevice(device) ? recordablePlatform(device) : undefined;
+ }
+
/** The app in front on the mirrored device, as a Studio target. */
get foregroundTarget(): NonNullable | undefined {
const { device, foregroundApp } = this.deviceApps.getSnapshot();
@@ -1199,8 +1275,11 @@ export class TestingPanel {
if (this.snapshot.runtimeMode !== "bundled" || !this.snapshot.selectedTestPath) return "";
const pinned = this.storedTarget;
if (!pinned) return this.foregroundTarget ? "" : "This test has no app yet. Open the app in the mirror to run it; Studio will pin it.";
- const { device } = this.deviceApps.getSnapshot();
- if (device && isRecordableDevice(device) && recordablePlatform(device) !== pinned.platform) return `This test is pinned to ${pinned.bundleId} (${pinned.platform}). Mirror an ${pinned.platform === "ios" ? "iOS simulator" : "Android emulator"} to run it.`;
+ const mirrored = this.mirroredPlatform;
+ if (mirrored && !this.storedAppOn(mirrored)) {
+ const recorded = platformLabel(pinned.platform), other = platformLabel(mirrored);
+ return `This test was recorded on ${recorded} and doesn't have an ${other} target. Open the app on this ${other} device and choose Add ${other} app, or mirror an ${pinned.platform === "ios" ? "iOS simulator" : "Android emulator"}.`;
+ }
// `deviceApps.apps` lists running apps, not installed ones, so it cannot say the pinned app is
// missing; Run opens it and reports a launch failure if it really is not on the device.
return "";
@@ -1214,13 +1293,18 @@ export class TestingPanel {
? { platform: target.platform, bundleId: target.bundleId } : {};
}
- /** Pins the selected Studio test to the app in front, replacing the one it had. */
+ /**
+ * Pins the selected Studio test to the app in front. On the recorded platform it replaces that
+ * app; on the other platform it adds the app there, so the test runs on both.
+ */
async repinStoredTest() {
const { projectPath, selectedTestPath: relativePath } = this.snapshot;
const target = this.foregroundTarget;
if (!projectPath || !relativePath || !target || this.snapshot.running) return;
+ const stored = this.storedTarget;
+ const mode = stored && stored.platform !== target.platform ? "add" : "replace";
try {
- await this.call("mobile_testing_set_target", { projectPath, relativePath, ...target }, 10_000);
+ await this.call("mobile_testing_set_target", { projectPath, relativePath, ...target, mode }, 10_000);
await this.refreshTests();
} catch (error) {
this.update({ error: error instanceof Error ? error.message : String(error) });
@@ -1255,8 +1339,11 @@ export class TestingPanel {
if (!this.hasBundledModel(untilSource, { kind: "stored", ...(untilLine === undefined ? {} : { untilLine }) })) return;
// A Studio test runs against the app it is pinned to, never whichever app is in front. A test
// with no app yet takes the one in front and keeps it, so later runs are pinned.
- const pinned = this.storedTarget;
- const runTarget = pinned ?? this.foregroundTarget;
+ // A test with an app on both platforms runs the one for the mirrored device's platform.
+ const stored = this.storedTarget;
+ const mirrored = this.mirroredPlatform;
+ const pinned = stored && mirrored ? this.storedAppOn(mirrored) : stored;
+ const runTarget = pinned ?? (stored ? undefined : this.foregroundTarget);
if (this.snapshot.runtimeMode === "bundled" && !runTarget) return;
if (this.matrixRunCount > 1) { await this.runMatrix({ relativePath, source: untilSource, ...(untilLine === undefined ? {} : { untilLine }), callLines: storedTestCallLines(source) }); return; }
this.update({ running: true, error: null });
@@ -1270,6 +1357,7 @@ export class TestingPanel {
}
}
testRecorder.clearRun();
+ this.runPlatform = runTarget?.platform ?? mirrored;
testRecorder.beginRun(untilLine);
if (untilLine !== undefined) countUiEvent("ui.testing.run_until");
const startedAt = performance.now(), telemetryContext = getUiTelemetryAttributes();
@@ -1281,13 +1369,13 @@ export class TestingPanel {
await this.stageWrite;
await this.call("mobile_testing_release_device", {}, 30_000).catch(() => undefined);
// The server pins before the run starts, so the badge shows it now rather than when the run ends.
- if (!pinned && runTarget && this.snapshot.runtimeMode === "bundled") this.notePinned(relativePath, runTarget);
+ if (!stored && runTarget && this.snapshot.runtimeMode === "bundled") this.notePinned(relativePath, runTarget);
const response = await this.call("mobile_testing_run_test", {
projectPath, relativePath, untilSource,
...(this.snapshot.configPath ? { configPath: this.snapshot.configPath } : {}),
...(this.snapshot.targetName ? { target: this.snapshot.targetName } : {}),
...this.bundledRunArguments(runTarget),
- ...(!pinned && runTarget ? { pin: true } : {}),
+ ...(!stored && runTarget ? { pin: true } : {}),
}, 15 * 60_000);
const data = object(response.structuredContent) ?? {};
const steps = (Array.isArray(data.steps) ? data.steps : []).map(entry => object(entry))
@@ -1295,6 +1383,7 @@ export class TestingPanel {
.map(entry => ({ line: typeof entry.line === "number" ? entry.line : 0, status: text(entry.status), ...(text(entry.error) ? { error: text(entry.error) } : {}) }))
.filter(step => step.line > 0);
testRecorder.finishRun({ status: text(data.status) || "failed", steps,
+ ...(text(data.error) ? { error: text(data.error) } : {}),
...(text(data.output) ? { output: text(data.output) } : {}),
...(typeof data.durationMs === "number" ? { durationMs: data.durationMs } : {}) });
countUiEvent(text(data.status) === "passed" ? "ui.testing.run_passed" : "ui.testing.run_failed");
@@ -1308,7 +1397,7 @@ export class TestingPanel {
if (getUiTelemetryAttributes() === telemetryContext) recordUiTiming("ui.testing.run", performance.now() - startedAt);
this.update({ running: false });
testRecorder.invalidate();
- if (!pinned && runTarget) void this.refreshTests();
+ if (!stored && runTarget) void this.refreshTests();
}
}
@@ -1380,6 +1469,7 @@ export class TestingPanel {
const durationMs = typeof data.durationMs === "number" && Number.isFinite(data.durationMs) ? data.durationMs : undefined;
testRecorder.finishRun({
status: text(data.status) || "failed", steps,
+ ...(text(data.error) ? { error: text(data.error) } : {}),
...(text(data.output) ? { output: text(data.output) } : {}),
...(durationMs === undefined ? {} : { durationMs }),
});
@@ -1413,10 +1503,11 @@ export class TestingPanel {
/**
* The one platform a pinned Studio test can run on: it was recorded against one app on one
- * platform, and there is no app id for the other. Undefined when any platform may run.
+ * platform and has no app added for the other. Undefined when any platform may run.
*/
get matrixPlatform(): "ios" | "android" | undefined {
- return this.snapshot.runtimeMode === "bundled" ? this.storedTarget?.platform : undefined;
+ const stored = this.snapshot.runtimeMode === "bundled" ? this.storedTarget : undefined;
+ return stored && !stored.apps?.[stored.platform === "ios" ? "android" : "ios"] ? stored.platform : undefined;
}
/** How many devices Run would use; a single device runs the plain way. */
@@ -1424,8 +1515,8 @@ export class TestingPanel {
/** The app a run would drive, per platform: the open test's own app first, then the project's targets. */
matrixApps(): { ios?: string; android?: string } {
- const pinned = this.matrixPlatform ? this.storedTarget : undefined;
- if (pinned) return { [pinned.platform]: pinned.bundleId };
+ // A pinned Studio test runs only the apps it has; the project's targets are not its apps.
+ if (this.snapshot.runtimeMode === "bundled" && this.storedTarget) return this.storedApps;
const apps: { ios?: string; android?: string } = {};
for (const entry of this.snapshot.targets) {
const platform = entry.platform;
@@ -1480,6 +1571,8 @@ export class TestingPanel {
private matrixCallLines?: readonly number[];
private matrixUntilLine?: number;
private laneSignature = "";
+ /** The platform the run on the preview ran on: a matrix lane's, not the mirror's. */
+ private runPlatform: "ios" | "android" | undefined;
selectLane(runId: string) {
this.update({ selectedLane: runId });
@@ -1509,9 +1602,10 @@ export class TestingPanel {
const signature = `${lane.runId}|${lane.state}|${lane.progress.length}|${lane.result?.steps.length ?? -1}`;
if (signature === this.laneSignature) return;
this.laneSignature = signature;
+ this.runPlatform = lane.platform;
testRecorder.beginRun(this.matrixUntilLine);
testRecorder.applyRunProgress(lane.progress, this.matrixCallLines);
- if (lane.result) testRecorder.finishRun({ status: lane.result.status, steps: lane.result.steps,
+ if (lane.result) testRecorder.finishRun({ status: lane.result.status, steps: lane.result.steps, ...(lane.result.error ? { error: lane.result.error } : {}),
...(lane.result.output ? { output: lane.result.output } : {}), ...(lane.result.durationMs === undefined ? {} : { durationMs: lane.result.durationMs }) });
else if (lane.state === "error" || lane.state === "cancelled") testRecorder.failRun(lane.error ?? (lane.state === "cancelled" ? "This device's run was cancelled." : "The run failed to start."));
}
diff --git a/packages/ui/test/stored-test-steps.test.ts b/packages/ui/test/stored-test-steps.test.ts
index e389e4e9..ae419755 100644
--- a/packages/ui/test/stored-test-steps.test.ts
+++ b/packages/ui/test/stored-test-steps.test.ts
@@ -1,6 +1,6 @@
import test from "node:test";
import assert from "node:assert/strict";
-import { changeStoredStepCommand, duplicateStoredStep, moveStoredStep, removeStoredStep, storedStepCommands, storedTestCallLines, storedTestSteps, storedTestUntilSource } from "../src/stored-test-steps.ts";
+import { branchStoredStepLocator, changeStoredStepCommand, duplicateStoredStep, moveStoredStep, removeStoredStep, storedStepCommands, storedTestCallLines, storedTestSteps, storedTestUntilSource } from "../src/stored-test-steps.ts";
test("saved tests show awaited calls at their source lines", () => {
const source = `import { test } from "@e2e-dev/mobile";
@@ -38,3 +38,29 @@ test("reorder, duplicate and command changes edit source without losing its wrap
assert.doesNotMatch(removeStoredStep(withoutSemicolon, 4), /getByText\("A"\)/);
assert.equal(storedTestUntilSource('await expect(\n screen.getByText("A")\n).toBeVisible();', 1), undefined);
});
+
+test("a failed line takes another platform's locator behind a platform branch, and keeps its own", () => {
+ const source = `import { test } from "@e2e-dev/mobile";
+import { expect } from "e2e";
+
+test("flow", async ({ app, screen }) => {
+ await app.open();
+ await expect(screen.getByTestId("Home")).toBeVisible();
+ await screen.getByRole("button", "see users").tap();
+});
+`;
+ let next = branchStoredStepLocator(source, 6, "android", 'screen.getByText("Home")');
+ next = branchStoredStepLocator(next, 7, "android", 'screen.getByRole("button", "SEE USERS")');
+ const lines = next.split("\n");
+ assert.equal(lines[3], 'test("flow", async ({ app, screen, platform }) => {', "the branch reads the platform fixture");
+ assert.equal(lines[5], ' await expect(platform === "android" ? screen.getByText("Home") : screen.getByTestId("Home")).toBeVisible();');
+ assert.equal(lines[6], ' await (platform === "android" ? screen.getByRole("button", "SEE USERS") : screen.getByRole("button", "see users")).tap();');
+ // Re-recording a branched line replaces that platform's side rather than nesting another branch.
+ const again = branchStoredStepLocator(next, 6, "android", 'screen.getByText("Start")').split("\n")[5];
+ assert.equal(again, ' await expect(platform === "android" ? screen.getByText("Start") : screen.getByTestId("Home")).toBeVisible();');
+ const ios = branchStoredStepLocator(next, 7, "ios", 'screen.getByText("see users")').split("\n")[6];
+ assert.equal(ios, ' await (platform === "android" ? screen.getByRole("button", "SEE USERS") : screen.getByText("see users")).tap();');
+ // A line with no locator to swap, and a coordinate, are left alone.
+ assert.equal(branchStoredStepLocator(source, 5, "android", 'screen.getByText("Home")'), source);
+ assert.equal(branchStoredStepLocator(source, 6, "android", "tapAt({ x: 1, y: 2 })"), source);
+});
diff --git a/packages/ui/test/test-recorder.test.ts b/packages/ui/test/test-recorder.test.ts
index 1baacc22..2a792c45 100644
--- a/packages/ui/test/test-recorder.test.ts
+++ b/packages/ui/test/test-recorder.test.ts
@@ -47,6 +47,21 @@ test("a tap row records the step and takes it on the device", async () => {
assert.deepEqual(done, [{ kind: "tap", point: { x: 50, y: 820 } }]);
});
+test("picking an element hands back its locator and records nothing", async () => {
+ const reads = { count: 0 };
+ const recorder = new TestRecorder();
+ recorder.attach(UDID, "android", reader([tab("SEE USERS", 800)], reads));
+ const picked: string[] = [];
+ assert.equal(recorder.pickElement(UDID, "android", locator => { picked.push(locator); }), true);
+ assert.equal(recorder.getSnapshot().picking, true);
+ await recorder.openMenu({ x: 50, y: 820 });
+ assert.deepEqual(picked, ['screen.getByRole("button", "SEE USERS")']);
+ assert.equal(recorder.getSnapshot().steps.length, 0, "a pick is not a step");
+ assert.equal(recorder.getSnapshot().menu, undefined, "and opens no menu");
+ assert.equal(recorder.getSnapshot().picking, false);
+ assert.equal(recorder.getSnapshot().recordingDeviceId, "", "the mirror stops picking after one element");
+});
+
test("an assertion is recorded from the element menu without touching the app", async () => {
const reads = { count: 0 };
const recorder = new TestRecorder();
@@ -397,6 +412,18 @@ test("the verdict stays, the ticks go, and a failing mark stays with them gone",
recorder.detach(UDID, "ios");
});
+test("a failed run with no failing line keeps the runner's reason", () => {
+ const recorder = new TestRecorder();
+ recorder.beginRun();
+ recorder.finishRun({ status: "failed", steps: [], error: "App com.example.android is not installed" });
+ assert.equal(recorder.getSnapshot().run?.error, "App com.example.android is not installed");
+ // A failing line's own error is the more precise one, so it wins.
+ recorder.beginRun();
+ recorder.finishRun({ status: "failed", steps: [{ line: 9, status: "failed", error: "Timed out" }], error: "Test failed" });
+ assert.equal(recorder.getSnapshot().run?.error, "Timed out");
+ recorder.clearRun();
+});
+
test("a run's marks go when the steps move out from under them, and the verdict is flagged", async () => {
const recorder = new TestRecorder();
recorder.attach(UDID, "ios", reader([tab("Explore", 800)], { count: 0 }));
diff --git a/packages/ui/test/testing-panel.test.ts b/packages/ui/test/testing-panel.test.ts
index ebe3a792..c81b6083 100644
--- a/packages/ui/test/testing-panel.test.ts
+++ b/packages/ui/test/testing-panel.test.ts
@@ -399,14 +399,85 @@ test("a Studio test pinned to iOS only offers and runs on iOS devices", () => {
tests: [{ relativePath: "tests/stored.e2e.ts", name: "stored.e2e.ts", updatedAt: "", sizeBytes: 1, target: { platform: "ios", bundleId: "com.pinned.app" } }],
targets: [{ name: "android", platform: "android", bundleId: "com.stale.android" }],
matrixDevices: [{ deviceId: "sim", platform: "ios", name: "iPhone" }, { deviceId: "emu", platform: "android", name: "Pixel" }],
- matrixSelected: ["sim", "emu"],
});
- assert.equal(panel.matrixPlatform, "ios");
- assert.deepEqual(panel.matrixSelection.map(device => device.deviceId), ["sim"]);
- assert.deepEqual(panel.matrixApps(), { ios: "com.pinned.app" });
+ panel.setMatrixSelection(["sim", "emu"]);
+ try {
+ assert.equal(panel.matrixPlatform, "ios");
+ assert.deepEqual(panel.matrixSelection.map(device => device.deviceId), ["sim"]);
+ assert.deepEqual(panel.matrixApps(), { ios: "com.pinned.app" });
+ } finally { panel.dispose(); }
+});
+
+const androidFront = { subscribe: () => () => undefined, getSnapshot: () => ({ device: { udid: "emulator-5554", name: "Pixel", state: "Booted", runtime: "", platform: "android", kind: "emulator" }, apps: [], foregroundApp: { bundleId: "com.example.android", pid: 3 }, ready: true }) } as unknown as DeviceAppsStore;
+const iosOnly = { relativePath: "tests/stored.e2e.ts", name: "stored.e2e.ts", updatedAt: "", sizeBytes: 1, target: { platform: "ios", bundleId: "com.pinned.app" } };
+
+test("an iOS-only Studio test on an Android mirror says so and adds the Android app in front", async () => {
+ const calls: { name: string; arguments: Record }[] = [];
+ const panel = new TestingPanel(host({ mobile_testing_set_target: { pinned: true } }, calls), androidFront);
+ panel.setAvailable(true);
+ (panel as unknown as { update(fields: Record): void }).update({ projectPath: PROJECT, runtimeMode: "bundled", selectedTestPath: "tests/stored.e2e.ts", selectedTestSource: "x", tests: [iosOnly] });
+ assert.match(panel.storedRunHint, /recorded on iOS and doesn't have an Android target/);
+ assert.equal(panel.canRunStored, false);
+ await panel.repinStoredTest();
+ const set = calls.find(call => call.name === "mobile_testing_set_target")!;
+ assert.deepEqual([set.arguments.platform, set.arguments.bundleId, set.arguments.mode], ["android", "com.example.android", "add"]);
+ panel.dispose();
+});
+
+test("a Studio test with apps on both platforms runs the mirrored platform's app and offers both in the matrix", async () => {
+ const calls: { name: string; arguments: Record }[] = [];
+ const source = 'test("stored", async ({ app }) => {\n await app.open();\n});\n';
+ const panel = new TestingPanel(host({ mobile_testing_run_test: { status: "passed", exitCode: 0, steps: [] } }, calls), androidFront);
+ panel.setAvailable(true);
+ (panel as unknown as { update(fields: Record): void }).update({ projectPath: PROJECT, runtimeMode: "bundled", selectedTestPath: "tests/stored.e2e.ts", selectedTestSource: source,
+ tests: [{ ...iosOnly, target: { ...iosOnly.target, apps: { android: "com.pinned.android" } } }] });
+ assert.equal(panel.storedRunHint, "");
+ assert.equal(panel.matrixPlatform, undefined);
+ assert.deepEqual(panel.matrixApps(), { ios: "com.pinned.app", android: "com.pinned.android" });
+ await panel.runStoredTest();
+ const run = calls.find(call => call.name === "mobile_testing_run_test")!;
+ assert.deepEqual([run.arguments.platform, run.arguments.bundleId, run.arguments.pin], ["android", "com.pinned.android", undefined]);
+ panel.dispose();
+});
+
+test("a line that failed on Android is re-recorded there behind a platform branch, and saved", async () => {
+ const calls: { name: string; arguments: Record }[] = [];
+ const source = 'import { test } from "@e2e-dev/mobile";\nimport { expect } from "e2e";\ntest("flow", async ({ app, screen }) => {\n await app.open();\n await expect(screen.getByTestId("Home")).toBeVisible();\n});\n';
+ const panel = new TestingPanel(host({ mobile_testing_save_staged_file: { saved: true, originalHash: "h2" } }, calls), androidFront);
+ panel.setAvailable(true);
+ (panel as unknown as { update(fields: Record): void }).update({ projectPath: PROJECT, runtimeMode: "bundled", selectedTestPath: "tests/stored.e2e.ts", selectedTestSource: source, selectedTestOriginalHash: "h1",
+ tests: [{ ...iosOnly, target: { ...iosOnly.target, apps: { android: "com.example.android" } } }] });
+ testRecorder.attach("emulator-5554", "android", { readComponents: async () => [{ name: "Home", label: "Home", text: "Home", role: "text", depth: 1, source: "accessibility", nodeId: "home", bounds: { x: 0, y: 100, width: 200, height: 40 } }], screen: () => ({ width: 402, height: 874 }) });
+ testRecorder.beginRun();
+ testRecorder.finishRun({ status: "failed", steps: [{ line: 5, status: "failed", error: "Not found" }] });
+ assert.equal(panel.reRecordLine, 5);
+ await panel.reRecordStoredLine(5);
+ assert.equal(testRecorder.getSnapshot().picking, true);
+ await testRecorder.openMenu({ x: 100, y: 120 });
+ await new Promise(resolve => setTimeout(resolve, 0));
+ const staged = calls.find(call => call.name === "mobile_testing_stage_file")!;
+ assert.match(staged.arguments.source as string, /async \(\{ app, screen, platform \}\)/);
+ assert.match(staged.arguments.source as string, /expect\(platform === "android" \? screen\.getByText\("Home"\) : screen\.getByTestId\("Home"\)\)/);
+ assert.ok(calls.some(call => call.name === "mobile_testing_save_staged_file"), "the change is saved");
+ testRecorder.detach("emulator-5554", "android");
panel.dispose();
});
+test("a line that failed on an Android lane while an iOS device is mirrored is named, not re-recordable yet", () => {
+ const iosFront = { subscribe: () => () => undefined, getSnapshot: () => ({ device: { udid: "sim", name: "iPhone", state: "Booted", runtime: "", platform: "ios", kind: "simulator" }, apps: [], foregroundApp: { bundleId: "com.pinned.app", pid: 3 }, ready: true }) } as unknown as DeviceAppsStore;
+ const source = 'test("flow", async ({ app, screen }) => {\n await app.open();\n await expect(screen.getByTestId("Home")).toBeVisible();\n});\n';
+ const panel = new TestingPanel(host({}, []), iosFront);
+ panel.setAvailable(true);
+ (panel as unknown as { update(fields: Record): void }).update({ projectPath: PROJECT, runtimeMode: "bundled", selectedTestPath: "tests/stored.e2e.ts", selectedTestSource: source,
+ tests: [{ ...iosOnly, target: { ...iosOnly.target, apps: { android: "com.example.android" } } }] });
+ // What showLane records for the Android lane of a matrix run.
+ (panel as unknown as { runPlatform: string }).runPlatform = "android";
+ testRecorder.beginRun();
+ testRecorder.finishRun({ status: "failed", steps: [{ line: 3, status: "failed", error: "Not found" }] });
+ try { assert.deepEqual(panel.reRecord, { line: 3, platform: "android", ready: false }); }
+ finally { panel.dispose(); }
+});
+
test("Run is unavailable for a Studio test with neither a pinned app nor one in front", () => {
const panel = new TestingPanel(host({}, []), deviceApps);
panel.setAvailable(true);
From 9584ee9b235190525dae77ea04a15b858e114ff8 Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Wed, 18 Nov 2026 16:02:15 +0500
Subject: [PATCH 15/23] fix: bugs
---
packages/core/src/testing-run.ts | 20 +++++--
packages/core/test/testing-panel-ui.test.ts | 25 +++++----
packages/core/test/testing-run.test.ts | 6 ++
packages/mcp-app/src/workspace-app.tsx | 1 +
packages/ui/src/components/simulator-view.tsx | 2 +-
.../src/components/test-recorder-overlay.tsx | 45 +++++++++++++--
packages/ui/src/components/testing-matrix.tsx | 9 +--
packages/ui/src/components/testing-note.tsx | 24 ++++++++
packages/ui/src/components/testing-view.tsx | 55 ++++++++++---------
packages/ui/src/device-workspace.ts | 12 ++++
packages/ui/src/test-recorder.ts | 35 ++++++++----
packages/ui/src/testing-panel.ts | 50 +++++++++++++++--
packages/ui/test/test-recorder.test.ts | 20 ++++++-
packages/ui/test/testing-panel.test.ts | 55 +++++++++++++++++--
14 files changed, 285 insertions(+), 74 deletions(-)
create mode 100644 packages/ui/src/components/testing-note.tsx
diff --git a/packages/core/src/testing-run.ts b/packages/core/src/testing-run.ts
index e49a4eb3..c39a62fa 100644
--- a/packages/core/src/testing-run.ts
+++ b/packages/core/src/testing-run.ts
@@ -4,6 +4,7 @@ import { mkdir, mkdtemp, readFile, readdir, realpath, rm, symlink, writeFile } f
import { homedir, tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { pathToFileURL } from "node:url";
+import { APP_FLOW_DIRECTORY } from "./app-flow-host.ts";
import { ExpectedOperationError } from "@mobile-dev/shared/error-reporting.ts";
/**
@@ -394,11 +395,20 @@ export function runnerBin(projectPath: string): string {
* reason that has nothing to do with their test. Run exists to be the same run they would get from
* a terminal, so it gets the state directory a terminal would give it: its own.
*/
-export function runnerEnv(environment: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEnv {
+export function runnerEnv(environment: NodeJS.ProcessEnv = process.env, stateDir?: string): NodeJS.ProcessEnv {
const { AGENT_DEVICE_STATE_DIR: _pinned, ...rest } = environment;
- return { ...rest, FORCE_COLOR: "0", NO_COLOR: "1" };
+ return { ...rest, ...(stateDir ? { AGENT_DEVICE_STATE_DIR: stateDir } : {}), FORCE_COLOR: "0", NO_COLOR: "1" };
}
+/**
+ * The state directory bundled (Studio) runs use: the app's own, never agent-device's default
+ * `~/.agent-device`. That default is shared with every other agent-device user on the machine, and two
+ * daemons racing to register there produce "Daemon registration ownership could not be verified" until
+ * the folder is deleted. The bundled runner is the same build as the app's own clients, so sharing the
+ * app's directory is safe, and it keeps the recorder and the runner same-state-dir peers.
+ */
+export const BUNDLED_STATE_DIR = join(APP_FLOW_DIRECTORY, "agent-device");
+
/**
* Whether the run died over the generated config rather than over the test.
*
@@ -531,7 +541,7 @@ async function runBundledTest(request: TestRunRequest, deps: TestRunDeps): Promi
cwd: await runnerCwd(deps), runPath, configName: deps.onProgress ? progressConfig : config,
// Reports and artifacts go beside the run's own config, so concurrent lanes never share a directory
// and the workspace removal below takes them away.
- output: join(workspace, "output"),
+ output: join(workspace, "output"), stateDir: BUNDLED_STATE_DIR,
target: bundledTargetName(request.bundledTarget), timeoutMs: request.timeoutMs, spawner: deps.spawner ?? spawn,
onProgress: deps.onProgress, signal: deps.signal,
});
@@ -540,13 +550,13 @@ async function runBundledTest(request: TestRunRequest, deps: TestRunDeps): Promi
}
}
-async function spawnRun(input: { command: string; commandArgs?: string[]; cwd: string; runPath: string; configName?: string; target?: string; output?: string; timeoutMs?: number; spawner: Spawner; signal?: AbortSignal; onProgress?: (progress: TestRunProgress) => void }): Promise {
+async function spawnRun(input: { command: string; commandArgs?: string[]; cwd: string; runPath: string; configName?: string; target?: string; output?: string; stateDir?: string; timeoutMs?: number; spawner: Spawner; signal?: AbortSignal; onProgress?: (progress: TestRunProgress) => void }): Promise {
input.signal?.throwIfAborted();
const child = input.spawner(input.command, [
...(input.commandArgs ?? []), "run", input.runPath, "--reporter", "json",
...(input.output ? ["--output", input.output] : []),
...(input.target ? ["--target", input.target] : []), ...(input.configName ? ["--config", input.configName] : []),
- ], { cwd: input.cwd, stdio: ["ignore", "pipe", "pipe"], env: runnerEnv() });
+ ], { cwd: input.cwd, stdio: ["ignore", "pipe", "pipe"], env: runnerEnv(process.env, input.stateDir) });
let stdout = "", stderr = "", pending = "";
child.stdout?.setEncoding("utf8"); child.stderr?.setEncoding("utf8");
child.stdout?.on("data", chunk => { stdout += chunk; });
diff --git a/packages/core/test/testing-panel-ui.test.ts b/packages/core/test/testing-panel-ui.test.ts
index 753b9fb8..7bb5dd49 100644
--- a/packages/core/test/testing-panel-ui.test.ts
+++ b/packages/core/test/testing-panel-ui.test.ts
@@ -35,7 +35,7 @@ test("the element menu renders the runner's own steps over the mirror and record
testRecorder.start("udid", "ios");
const root = createRoot(dom.window.document.getElementById("root")!);
- await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations })); });
+ await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations, platform: "ios" })); });
onTeardown(async () => {
await act(async () => { root.unmount(); });
await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
@@ -109,7 +109,7 @@ test("a row that needs a value asks for it instead of emitting an empty string",
});
testRecorder.start("udid", "ios");
const root = createRoot(dom.window.document.getElementById("root")!);
- await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations })); });
+ await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations, platform: "ios" })); });
onTeardown(async () => {
await act(async () => { root.unmount(); });
await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
@@ -329,7 +329,7 @@ test("the element menu survives a tree invalidation that takes the hover outline
testRecorder.attach("udid", "ios", { readComponents: async () => [button], screen: () => SCREEN, release: () => undefined });
testRecorder.start("udid", "ios");
const root = createRoot(dom.window.document.getElementById("root")!);
- await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations })); });
+ await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations, platform: "ios" })); });
onTeardown(async () => {
await act(async () => { root.unmount(); });
await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
@@ -363,7 +363,7 @@ test("a coordinate gets the tap row and is told why that is all", async t => {
testRecorder.attach("udid", "ios", { readComponents: async () => [button], screen: () => SCREEN, release: () => undefined });
testRecorder.start("udid", "ios");
const root = createRoot(dom.window.document.getElementById("root")!);
- await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations })); });
+ await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations, platform: "ios" })); });
onTeardown(async () => {
await act(async () => { root.unmount(); });
await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
@@ -413,7 +413,7 @@ test("the command list is a submenu of its own, opened by pointing at its row",
testRecorder.attach("udid", "ios", { readComponents: async () => [button], screen: () => SCREEN, release: () => undefined });
testRecorder.start("udid", "ios");
const root = createRoot(dom.window.document.getElementById("root")!);
- await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations })); });
+ await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations, platform: "ios" })); });
onTeardown(async () => {
await act(async () => { root.unmount(); });
await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
@@ -481,7 +481,7 @@ test("the agentic branches cascade to the side, and record a sentence with its p
});
testRecorder.start("udid", "ios");
const root = createRoot(dom.window.document.getElementById("root")!);
- await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations })); });
+ await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations, platform: "ios" })); });
onTeardown(async () => {
await act(async () => { root.unmount(); });
await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
@@ -676,7 +676,7 @@ test("Record says the mirror is not ready yet, until selection actually is", asy
testRecorder.attach("udid", "ios", { readComponents: () => tree, screen: () => SCREEN, release: () => undefined });
const root = createRoot(dom.window.document.getElementById("root")!);
- await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations })); });
+ await act(async () => { root.render(createElement(TestRecorderOverlay, { store: annotations, platform: "ios" })); });
onTeardown(async () => {
await act(async () => { root.unmount(); });
await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
@@ -837,12 +837,15 @@ test("a stored Studio test shows its pinned app and offers to re-pin it to the a
await act(async () => { (dom.window.document.querySelector("[data-testing-repin]") as HTMLElement).click(); });
assert.equal(repinned, 1);
assert.equal(dom.window.document.querySelector("[data-testing-repin]")?.textContent, "Use current app");
- // With an Android app in front, the button adds it for Android and keeps the iOS app.
- const android = { ...panel, foregroundTarget: { platform: "android", bundleId: "com.b.android" } };
+ // With an Android app in front, the warning itself offers to add it for Android, and the header does not.
+ const android = { ...panel, foregroundTarget: { platform: "android", bundleId: "com.b.android" }, canAddForegroundApp: true };
await act(async () => { root.render(createElement(TestingView, { panel: android, deviceApps })); });
- assert.equal(dom.window.document.querySelector("[data-testing-repin]")?.textContent, "Add Android app");
+ assert.equal(dom.window.document.querySelector("[data-testing-run-hint] [data-testing-add-app]")?.textContent, "Add Android app");
+ assert.equal(dom.window.document.querySelector("[data-testing-repin]"), null);
+ await act(async () => { (dom.window.document.querySelector("[data-testing-add-app]") as HTMLElement).click(); });
+ assert.equal(repinned, 2);
// Once added, both apps show, and the app in front needs no button.
- const both = { ...android, storedTarget: { platform: "ios", bundleId: "com.a", apps: { android: "com.b.android" } }, storedApps: { ios: "com.a", android: "com.b.android" } };
+ const both = { ...android, canAddForegroundApp: false, storedTarget: { platform: "ios", bundleId: "com.a", apps: { android: "com.b.android" } }, storedApps: { ios: "com.a", android: "com.b.android" } };
await act(async () => { root.render(createElement(TestingView, { panel: both, deviceApps })); });
assert.match(dom.window.document.querySelector('[data-testing-added-app="android"]')?.textContent ?? "", /com\.b\.android/);
assert.equal(dom.window.document.querySelector("[data-testing-repin]"), null);
diff --git a/packages/core/test/testing-run.test.ts b/packages/core/test/testing-run.test.ts
index 33d978a9..ce8237f7 100644
--- a/packages/core/test/testing-run.test.ts
+++ b/packages/core/test/testing-run.test.ts
@@ -197,6 +197,12 @@ test("the runner is not handed the app's pinned agent-device state directory", (
assert.equal(environment.NO_COLOR, "1", "the json reporter's output must not carry escape codes");
});
+test("a bundled run gets the app's own state directory, never agent-device's shared default", () => {
+ const environment = runnerEnv({ PATH: "/usr/bin", AGENT_DEVICE_STATE_DIR: "/elsewhere" }, "/app/own-state");
+ assert.equal(environment.AGENT_DEVICE_STATE_DIR, "/app/own-state");
+ assert.equal(environment.PATH, "/usr/bin");
+});
+
test("the generated config adds a reporter and changes nothing else", () => {
const source = progressConfigSource("/app/e2e.config.ts");
// The project's own config is spread, so its targets, agents and workers all stand.
diff --git a/packages/mcp-app/src/workspace-app.tsx b/packages/mcp-app/src/workspace-app.tsx
index e3924fb5..de77c2ca 100644
--- a/packages/mcp-app/src/workspace-app.tsx
+++ b/packages/mcp-app/src/workspace-app.tsx
@@ -44,6 +44,7 @@ export function startWorkspaceApp(options: WorkspaceOptions = {}) {
flushSync(() => { renderWorkspace(); });
const devices = new DeviceWorkspace(app, panels, { onAutomaticLayout: renderWorkspace, connectionFailed });
+ panels.testing.setMirrorFocus(platform => devices.focusPlatform(platform));
panels.logs.setLayout(document.documentElement.dataset.view === "workspace");
devices.changeLayout("none");
diff --git a/packages/ui/src/components/simulator-view.tsx b/packages/ui/src/components/simulator-view.tsx
index e28c8309..da95a50e 100644
--- a/packages/ui/src/components/simulator-view.tsx
+++ b/packages/ui/src/components/simulator-view.tsx
@@ -37,7 +37,7 @@ export const SimulatorView = memo(function SimulatorView({ platform, visible }:
Device stoppedStart device
-
+
)}
- {only &&
This test was recorded on {platformLabel(only)} and doesn't have an {platformLabel(only === "ios" ? "android" : "ios")} target. To add one, open the app on an {platformLabel(only === "ios" ? "android" : "ios")} device in the mirror and choose Add {platformLabel(only === "ios" ? "android" : "ios")} app.
}
+ {only && This test was recorded on {platformLabel(only)} and doesn't have an {platformLabel(only === "ios" ? "android" : "ios")} target. To add one, open the app on an {platformLabel(only === "ios" ? "android" : "ios")} device in the mirror and choose Add {platformLabel(only === "ios" ? "android" : "ios")} app.}
{state.matrixDevices.length === 0 &&
{state.matrixLoading ? "Looking for simulators and emulators…" : "No simulators or emulators found."}
}
@@ -61,7 +62,7 @@ export function MatrixDevices({ panel }: { panel: TestingPanel }) {
at once
{count > state.matrixLimit ? `${count - state.matrixLimit} will queue until a slot frees. ` : ""}Devices that are off are booted, and a missing app is copied from another selected device. Agent steps call the model once per device.
+ {count > state.matrixLimit ? `${count - state.matrixLimit} will queue until a slot frees. ` : ""}Devices that are off are booted, and a missing app is copied from another selected device. Agent steps call the model once per device.
;
}
diff --git a/packages/ui/src/components/testing-note.tsx b/packages/ui/src/components/testing-note.tsx
new file mode 100644
index 00000000..0b04ee1e
--- /dev/null
+++ b/packages/ui/src/components/testing-note.tsx
@@ -0,0 +1,24 @@
+import type { ReactNode } from "react";
+import { InfoIcon, TriangleAlertIcon } from "lucide-react";
+
+/**
+ * A short note in the Testing panel: "info" explains how something works, "warning" says why
+ * something cannot run as it is. Both are boxed with an icon so they do not read as body text, and
+ * the one thing to do about it, if there is one, sits inside the note as its `action`.
+ */
+export function TestingNote({ tone = "info", icon, action, children, ...attributes }: {
+ tone?: "info" | "warning"; icon?: ReactNode; action?: ReactNode; children: ReactNode;
+} & Record<`data-${string}`, string | boolean | number | undefined>) {
+ const warning = tone === "warning";
+ const Icon = warning ? TriangleAlertIcon : InfoIcon;
+ return
}
+ {blocker && !state.agent?.active && !(state.selectedTestPath && panel.storedRunHint) && {blocker}}
@@ -704,6 +707,14 @@ function SourceStepMenu({ source, step, index, mode, onEdit, editable }: {
* The apps a Studio test runs against, one per platform, with a way to take the app in front: on
* the recorded platform it replaces that app, on the other it adds one so the test runs on both.
*/
+/** One app a Studio test runs: its platform as a tag, then its id, cut short with the whole id on hover. */
+function AppBadge({ platform, bundleId, title, ...attributes }: { platform: "ios" | "android"; bundleId: string; title: string } & Record<`data-${string}`, string | undefined>) {
+ return
+ {platformLabel(platform)}
+ {bundleId}
+ ;
+}
+
function PinnedApp({ panel }: { panel: TestingPanel }) {
const state = useSyncExternalStore(panel.subscribe, panel.getSnapshot);
const pinned = panel.storedTarget;
@@ -711,19 +722,15 @@ function PinnedApp({ panel }: { panel: TestingPanel }) {
const apps = panel.storedApps;
const added = pinned ? (["ios", "android"] as const).filter(platform => platform !== pinned.platform && apps[platform]) : [];
const current = front ? apps[front.platform] : undefined;
- const canRepin = Boolean(front) && !state.running && current !== front!.bundleId;
+ // Adding the other platform's app is the run hint's action, beside the reason it is needed.
+ const canRepin = Boolean(front) && !state.running && current !== front!.bundleId && !panel.canAddForegroundApp;
const label = !pinned || !front ? "Pin current app"
: front.platform === pinned.platform ? "Use current app"
: current ? `Use current ${platformLabel(front.platform)} app` : `Add ${platformLabel(front.platform)} app`;
return
-
- {pinned ? pinned.bundleId : "No app pinned"}
- {pinned && {platformLabel(pinned.platform)}}
-
- {added.map(platform =>
- {apps[platform]}
- {platformLabel(platform)}
- )}
+ {pinned ?
+ : No app pinned}
+ {added.map(platform => )}
{canRepin && void panel.repinStoredTest()}>{label}}
;
}
@@ -746,23 +753,21 @@ function ReRecordLine({ panel }: { panel: TestingPanel }) {
useSyncExternalStore(panel.subscribe, panel.getSnapshot);
const recorder = useSyncExternalStore(testRecorder.subscribe, testRecorder.getSnapshot);
const mirrored = panel.mirroredPlatform;
- if (recorder.picking && mirrored) return
- {recorder.preparing ? : null}
- Right-click the element on the {platformLabel(mirrored)} mirror to use it for this step.
- panel.cancelReRecord()}>Cancel
-
;
+ if (recorder.picking && mirrored) return : }
+ action={ panel.cancelReRecord()}>Cancel}>
+ {recorder.preparing ? `Reading the ${platformLabel(mirrored)} screen…` : <>Right-click the element on the {platformLabel(mirrored)} mirror, then choose Insert.>}
+ ;
const target = panel.reRecord;
if (!target) return null;
const { line } = target;
const label = platformLabel(target.platform);
- if (!target.ready || !mirrored) return
- Line {line} may differ on {label}. Mirror an {target.platform === "ios" ? "iOS simulator" : "Android device"} to re-record it.
-
;
- return
- Line {line} may differ on {platformLabel(mirrored)}.
- void panel.reRecordStoredLine(line)}
- title={`Pick the element on the ${platformLabel(mirrored)} mirror. Line ${line} keeps its current locator on the other platform.`}>Re-record on {platformLabel(mirrored)}
-
;
+ // The same note whichever mirror is active: the button brings the failing platform's mirror forward.
+ return }
+ action={ void panel.reRecordStoredLine(line)}
+ title={`Pick the element on the ${label} mirror. Line ${line} keeps its current locator on the other platform.`}>Re-record on {label}}>
+ Line {line} may need a different locator on {label}. Pick the element there, and the other platform keeps its own.
+ ;
}
function StoredTestPreview({ panel, source, path, loading }: { panel: TestingPanel; source: string; path: string; loading: boolean }) {
diff --git a/packages/ui/src/device-workspace.ts b/packages/ui/src/device-workspace.ts
index 263b3f3f..99e57760 100644
--- a/packages/ui/src/device-workspace.ts
+++ b/packages/ui/src/device-workspace.ts
@@ -74,6 +74,18 @@ export class DeviceWorkspace {
}
}
+ /**
+ * Makes one platform's mirror the active one, when it is showing a device. Nothing is opened or
+ * booted: a platform the layout hides, or one with no device, answers false.
+ */
+ focusPlatform(platform: Platform): boolean {
+ const panel = this.panels.find(entry => entry.platform === platform);
+ if (!panel || panel.root.hidden || !panel.selected) return false;
+ this.activePlatform = platform;
+ this.updateSelection();
+ return true;
+ }
+
/** Opens the devices a tool call or host intent names. */
open(target: PanelTarget) { return this.devices.open(target); }
setAvailable(available: boolean) { return this.devices.setAvailable(available); }
diff --git a/packages/ui/src/test-recorder.ts b/packages/ui/src/test-recorder.ts
index 07258281..411b99e2 100644
--- a/packages/ui/src/test-recorder.ts
+++ b/packages/ui/src/test-recorder.ts
@@ -194,6 +194,11 @@ export type TestRecorderSnapshot = {
*/
bounds: ScreenBounds;
screen: ScreenSize;
+ /**
+ * Set while a pick is in progress: the menu only offers to insert this element's locator into
+ * the step being re-recorded. No locator means the element cannot be named.
+ */
+ pick?: { locator?: string };
};
run?: TestRunView;
error: string;
@@ -236,6 +241,14 @@ function newFlowId(): string {
return crypto.randomUUID();
}
+/**
+ * Whether the mirror of `panel` draws the recorder's hover, step tag and menu. The recorder is one
+ * snapshot shared by both mirrors, so without this a re-record or pick shows its UI on both.
+ */
+export function recorderShowsOn(recording: string, panel: string): boolean {
+ return recording === "" || recording === panel;
+}
+
export class TestRecorder {
private readonly listeners = new Set<() => void>();
private reader?: RecorderReader;
@@ -783,23 +796,18 @@ export class TestRecorder {
const innermost = hitLadder(components, point, this.reader?.screen())[0]?.nodeId;
if (innermost !== this.hoverInnermost) { this.hoverInnermost = innermost; this.hoverLevel = 0; }
this.showHover(components);
- if (this.pickHandler) { this.pick(components, point); return; }
this.menuPoint = point;
this.showMenu(components);
countUiEvent("ui.testing.menu_open");
}
- /** Hands the outlined element's locator to the pick in progress, then stops picking. */
- private pick(components: ScreenComponent[], point: ScreenPoint) {
- const screen = this.reader?.screen();
+ /** Hands the locator the pick menu shows to the pick in progress, then stops picking. */
+ confirmPick() {
+ const locator = this.snapshot.menu?.pick?.locator;
const onPick = this.pickHandler;
- if (!screen || !onPick) return;
- const { selector } = resolveSelector(components, point, screen, this.hoverLevel);
- // A coordinate is not a locator: it cannot stand in for one in an assertion, and on another
- // device it would name something else.
- if (selector.kind === "point") { this.update({ error: "Nothing here can be named by the test runner. Pick another element, or walk out to its container with the scroll wheel." }); return; }
+ if (!locator || !onPick) return;
this.stop();
- onPick(selectorSource(selector));
+ onPick(locator);
}
/** The menu for the element the outline currently shows, resolved from the cached tree. */
@@ -810,6 +818,13 @@ export class TestRecorder {
const { selector, ambiguous, component, matches } = resolveSelector(components, point, screen, this.hoverLevel);
// Nothing resolved is still somewhere: the menu marks the coordinate a tap here would record.
const bounds = component?.bounds ?? { x: point.x - 12, y: point.y - 12, width: 24, height: 24 };
+ // A coordinate is not a locator: it cannot stand in for one in an assertion, and on another
+ // device it would name something else. The pick menu says so rather than offering it.
+ if (this.pickHandler) {
+ this.update({ menu: { label: stepLabel("tap", selector), ambiguous, matches, offers: [], commands: [], bounds, screen,
+ pick: selector.kind === "point" ? {} : { locator: selectorSource(selector) } } });
+ return;
+ }
this.update({ menu: {
label: stepLabel("tap", selector), ambiguous, matches,
offers: stepOffers(selector, component),
diff --git a/packages/ui/src/testing-panel.ts b/packages/ui/src/testing-panel.ts
index e2512263..fd7efdca 100644
--- a/packages/ui/src/testing-panel.ts
+++ b/packages/ui/src/testing-panel.ts
@@ -239,8 +239,8 @@ export class TestingPanel {
void this.reportContext();
const front = deviceApps.getSnapshot().foregroundApp?.bundleId;
if (this.snapshot.projectPath && this.snapshot.runtimeMode === "bundled" && front) {
- if (this.snapshot.targets.length === 0) void this.selectProject(this.snapshot.projectPath);
- else if (this.snapshot.targets.every(entry => entry.bundleId !== front)) void this.refreshStudioTargets();
+ // Only the targets: reloading the whole project here would close the test the user has open.
+ if (this.snapshot.targets.every(entry => entry.bundleId !== front)) void this.refreshStudioTargets();
}
});
// Every change to what would be written bumps the recorder's revision, which is exactly the
@@ -361,7 +361,20 @@ export class TestingPanel {
if (!device || !target?.platform) return "";
const mirrored = recordablePlatform(device);
if (target.platform === mirrored) return "";
- return `Target "${target.name}" is ${target.platform}, but the mirror shows ${mirrored === "ios" ? "an iOS" : "an Android"} device. Choose ${mirrored === "ios" ? "an iOS" : "an Android"} target.`;
+ // Studio's target follows the app in front, which is unknown for a moment after the mirror changes:
+ // `selectDevice` clears it and `refreshStudioTargets` re-reads the target once it is found. Until
+ // then the target is still the other mirror's, and warning about it only flashes. Say nothing until
+ // the new device has answered and its target is in.
+ if (this.noProject) {
+ const { ready, foregroundApp } = this.deviceApps.getSnapshot();
+ if (!ready || this.refreshingTargets) return "";
+ if (foregroundApp?.bundleId && this.snapshot.targets.every(entry => entry.bundleId !== foregroundApp.bundleId)) return "";
+ }
+ const shown = mirrored === "ios" ? "an iOS simulator" : "an Android emulator";
+ const other = target.platform === "ios" ? "an iOS simulator" : "an Android emulator";
+ // Studio's targets are the app in front, so its only target names are internal: say what to do on the device instead.
+ if (this.noProject) return `The mirror shows ${shown}, but the app was picked up on ${platformLabel(target.platform)}. Open the app on this device to record here, or switch the mirror to ${other}.`;
+ return `The "${target.name}" target runs on ${platformLabel(target.platform)}, but the mirror shows ${shown}. Choose ${mirrored === "ios" ? "an iOS" : "an Android"} target, or switch the mirror to ${other}.`;
}
/** Whether a launch is possible: a bundle id to launch and a booted device to launch it on. */
@@ -767,12 +780,27 @@ export class TestingPanel {
* element on the mirror, and the line keeps its locator for the recorded platform and takes the
* picked one on this platform behind a `platform` branch. The test is then saved.
*/
+ /**
+ * The device workspace's way of making one platform's mirror the active one. It answers false
+ * when that platform has no device showing, which only the user can change.
+ */
+ private focusMirror: ((platform: "ios" | "android") => boolean) | undefined;
+ setMirrorFocus(focus: ((platform: "ios" | "android") => boolean) | undefined) { this.focusMirror = focus; }
+
async reRecordStoredLine(line: number) {
+ const platform = this.reRecord?.platform;
+ if (!platform || line <= 0) return;
+ this.update({ error: null });
+ // The element is picked on the mirror, so the failing platform's mirror has to be the active one.
+ if (this.mirroredPlatform !== platform) this.focusMirror?.(platform);
+ if (this.mirroredPlatform !== platform) {
+ this.update({ error: `Show a booted ${platform === "ios" ? "iOS simulator" : "Android emulator"} in the mirror to re-record line ${line}.` });
+ return;
+ }
const mirrored = this.mirroredPlatform;
const app = mirrored ? this.storedAppOn(mirrored) : undefined;
const device = this.deviceApps.getSnapshot().device;
- if (!mirrored || !app || !device || line <= 0) return;
- this.update({ error: null });
+ if (!mirrored || mirrored !== platform || !app || !device) return;
// The element tree is read from the app in front, so it has to be this platform's app.
if (this.deviceApps.getSnapshot().foregroundApp?.bundleId !== app.bundleId) {
try { await this.call("mobile_launch_app", { platform: app.platform, deviceId: device.udid, bundleId: app.bundleId }, 120_000); }
@@ -1278,13 +1306,23 @@ export class TestingPanel {
const mirrored = this.mirroredPlatform;
if (mirrored && !this.storedAppOn(mirrored)) {
const recorded = platformLabel(pinned.platform), other = platformLabel(mirrored);
- return `This test was recorded on ${recorded} and doesn't have an ${other} target. Open the app on this ${other} device and choose Add ${other} app, or mirror an ${pinned.platform === "ios" ? "iOS simulator" : "Android emulator"}.`;
+ const back = pinned.platform === "ios" ? "an iOS simulator" : "an Android emulator";
+ // With this platform's app in front, the note carries the Add button; without it, the app has to be opened first.
+ return this.foregroundTarget
+ ? `This test was recorded on ${recorded} and has no ${other} app yet. Add ${this.foregroundTarget.bundleId}, the app in front, to run it here too.`
+ : `This test was recorded on ${recorded} and has no ${other} app yet. Open the app on this ${other} device to add it, or mirror ${back}.`;
}
// `deviceApps.apps` lists running apps, not installed ones, so it cannot say the pinned app is
// missing; Run opens it and reports a launch failure if it really is not on the device.
return "";
}
+ /** Whether the run hint can offer to add the app in front as this test's app on the mirrored platform. */
+ get canAddForegroundApp(): boolean {
+ const pinned = this.storedTarget, front = this.foregroundTarget;
+ return this.snapshot.runtimeMode === "bundled" && Boolean(pinned && front) && front!.platform !== pinned!.platform && !this.storedAppOn(front!.platform) && !this.snapshot.running;
+ }
+
/** The platform and bundle id sent with a save, so a Studio test is pinned to the app it was recorded against. */
private pinArguments() {
// Studio's `targets` can lag the mirror, so the app actually in front wins.
diff --git a/packages/ui/test/test-recorder.test.ts b/packages/ui/test/test-recorder.test.ts
index 2a792c45..4e31ff12 100644
--- a/packages/ui/test/test-recorder.test.ts
+++ b/packages/ui/test/test-recorder.test.ts
@@ -1,7 +1,7 @@
import test from "node:test";
import assert from "node:assert/strict";
import type { ScreenComponent } from "../../shared/src/screen-annotations.ts";
-import { TestRecorder, formatRunDuration } from "../src/test-recorder.ts";
+import { TestRecorder, formatRunDuration, recorderShowsOn } from "../src/test-recorder.ts";
import { agentActSuggestion } from "../../shared/src/test-recording.ts";
const UDID = "11111111-2222-3333-4444-555555555555";
@@ -47,7 +47,7 @@ test("a tap row records the step and takes it on the device", async () => {
assert.deepEqual(done, [{ kind: "tap", point: { x: 50, y: 820 } }]);
});
-test("picking an element hands back its locator and records nothing", async () => {
+test("picking an element offers its locator to insert, hands it back on Insert, and records nothing", async () => {
const reads = { count: 0 };
const recorder = new TestRecorder();
recorder.attach(UDID, "android", reader([tab("SEE USERS", 800)], reads));
@@ -55,9 +55,16 @@ test("picking an element hands back its locator and records nothing", async () =
assert.equal(recorder.pickElement(UDID, "android", locator => { picked.push(locator); }), true);
assert.equal(recorder.getSnapshot().picking, true);
await recorder.openMenu({ x: 50, y: 820 });
+ assert.deepEqual(picked, [], "nothing is written until Insert");
+ assert.deepEqual(recorder.getSnapshot().menu?.pick, { locator: 'screen.getByRole("button", "SEE USERS")' });
+ assert.deepEqual(recorder.getSnapshot().menu?.offers, [], "the pick menu offers no steps");
+ recorder.closeMenu();
+ assert.equal(recorder.getSnapshot().picking, true, "Cancel in the popover keeps picking");
+ await recorder.openMenu({ x: 50, y: 820 });
+ recorder.confirmPick();
assert.deepEqual(picked, ['screen.getByRole("button", "SEE USERS")']);
assert.equal(recorder.getSnapshot().steps.length, 0, "a pick is not a step");
- assert.equal(recorder.getSnapshot().menu, undefined, "and opens no menu");
+ assert.equal(recorder.getSnapshot().menu, undefined);
assert.equal(recorder.getSnapshot().picking, false);
assert.equal(recorder.getSnapshot().recordingDeviceId, "", "the mirror stops picking after one element");
});
@@ -804,3 +811,10 @@ test("recording an Android emulator reads the tree with its serial and platform"
assert.deepEqual(seen[0], ["emulator-5554", "android"]);
recorder.stop();
});
+
+test("only the mirror of the platform being recorded or picked draws the recorder's overlay", () => {
+ assert.equal(recorderShowsOn("android", "android"), true);
+ assert.equal(recorderShowsOn("android", "ios"), false, "a re-record on Android must not paint the iOS mirror");
+ assert.equal(recorderShowsOn("ios", "android"), false);
+ assert.equal(recorderShowsOn("", "ios"), true, "nothing recording: nothing to hide");
+});
diff --git a/packages/ui/test/testing-panel.test.ts b/packages/ui/test/testing-panel.test.ts
index c81b6083..8185357b 100644
--- a/packages/ui/test/testing-panel.test.ts
+++ b/packages/ui/test/testing-panel.test.ts
@@ -306,11 +306,31 @@ test("a booted Android emulator is recordable and a target of the wrong platform
const panel = new TestingPanel(host({}, []), store);
const update = (panel as unknown as { update(fields: Record): void }).update.bind(panel);
update({ targets: [{ name: "ios", platform: "ios", bundleId: "a" }, { name: "android", platform: "android", bundleId: "a" }], targetName: "ios" });
- assert.match(panel.targetMismatch, /is ios, but the mirror shows an Android device/);
+ assert.match(panel.targetMismatch, /runs on iOS, but the mirror shows an Android emulator/);
update({ targetName: "android" });
assert.equal(panel.targetMismatch, "");
});
+test("Studio does not flash a mirror mismatch while the switched device's app is still unknown", () => {
+ // Switching the mirror clears the foreground app and re-reads Studio's target once it is found.
+ // In between, the target is still the other platform's: warning then makes the message flicker.
+ const emulator = { udid: "emulator-5554", name: "Pixel", state: "Booted", runtime: "", platform: "android", kind: "emulator" };
+ let snapshot: Record = { device: emulator, apps: [], foregroundApp: null, ready: false };
+ const store = { subscribe: () => () => undefined, getSnapshot: () => snapshot } as unknown as DeviceAppsStore;
+ const panel = new TestingPanel(host({}, []), store);
+ const update = (panel as unknown as { update(fields: Record): void }).update.bind(panel);
+ update({ studioPath: PROJECT, projectPath: PROJECT, targets: [{ name: "ios", platform: "ios", bundleId: "com.ios" }], targetName: "ios" });
+ assert.equal(panel.targetMismatch, "", "device just switched: nothing is known yet");
+ snapshot = { ...snapshot, ready: true, foregroundApp: { bundleId: "com.android", pid: 1 } };
+ assert.equal(panel.targetMismatch, "", "the foreground app is found but its target has not been re-read");
+ update({ targets: [{ name: "android", platform: "android", bundleId: "com.android" }], targetName: "android" });
+ assert.equal(panel.targetMismatch, "");
+ // Steady when it truly applies: the app in front is the target and it is on the other platform.
+ update({ targets: [{ name: "ios", platform: "ios", bundleId: "com.android" }], targetName: "ios" });
+ assert.match(panel.targetMismatch, /The mirror shows an Android emulator/);
+ panel.dispose();
+});
+
test("a Studio test with no app pins the one in front on its first run, then runs against the pin", async () => {
const calls: { name: string; arguments: Record }[] = [];
const source = 'test("stored", async ({ app }) => {\n await app.open();\n});\n';
@@ -416,7 +436,8 @@ test("an iOS-only Studio test on an Android mirror says so and adds the Android
const panel = new TestingPanel(host({ mobile_testing_set_target: { pinned: true } }, calls), androidFront);
panel.setAvailable(true);
(panel as unknown as { update(fields: Record): void }).update({ projectPath: PROJECT, runtimeMode: "bundled", selectedTestPath: "tests/stored.e2e.ts", selectedTestSource: "x", tests: [iosOnly] });
- assert.match(panel.storedRunHint, /recorded on iOS and doesn't have an Android target/);
+ assert.match(panel.storedRunHint, /recorded on iOS and has no Android app yet. Add com\.example\.android/);
+ assert.equal(panel.canAddForegroundApp, true);
assert.equal(panel.canRunStored, false);
await panel.repinStoredTest();
const set = calls.find(call => call.name === "mobile_testing_set_target")!;
@@ -454,6 +475,7 @@ test("a line that failed on Android is re-recorded there behind a platform branc
await panel.reRecordStoredLine(5);
assert.equal(testRecorder.getSnapshot().picking, true);
await testRecorder.openMenu({ x: 100, y: 120 });
+ testRecorder.confirmPick();
await new Promise(resolve => setTimeout(resolve, 0));
const staged = calls.find(call => call.name === "mobile_testing_stage_file")!;
assert.match(staged.arguments.source as string, /async \(\{ app, screen, platform \}\)/);
@@ -463,7 +485,7 @@ test("a line that failed on Android is re-recorded there behind a platform branc
panel.dispose();
});
-test("a line that failed on an Android lane while an iOS device is mirrored is named, not re-recordable yet", () => {
+test("re-recording a line that failed on an Android lane brings the Android mirror forward first", async () => {
const iosFront = { subscribe: () => () => undefined, getSnapshot: () => ({ device: { udid: "sim", name: "iPhone", state: "Booted", runtime: "", platform: "ios", kind: "simulator" }, apps: [], foregroundApp: { bundleId: "com.pinned.app", pid: 3 }, ready: true }) } as unknown as DeviceAppsStore;
const source = 'test("flow", async ({ app, screen }) => {\n await app.open();\n await expect(screen.getByTestId("Home")).toBeVisible();\n});\n';
const panel = new TestingPanel(host({}, []), iosFront);
@@ -474,8 +496,31 @@ test("a line that failed on an Android lane while an iOS device is mirrored is n
(panel as unknown as { runPlatform: string }).runPlatform = "android";
testRecorder.beginRun();
testRecorder.finishRun({ status: "failed", steps: [{ line: 3, status: "failed", error: "Not found" }] });
- try { assert.deepEqual(panel.reRecord, { line: 3, platform: "android", ready: false }); }
- finally { panel.dispose(); }
+ const focused: string[] = [];
+ panel.setMirrorFocus(platform => { focused.push(platform); return false; });
+ try {
+ assert.deepEqual(panel.reRecord, { line: 3, platform: "android", ready: false });
+ await panel.reRecordStoredLine(3);
+ assert.deepEqual(focused, ["android"], "the Android mirror is brought forward");
+ assert.match(panel.getSnapshot().error ?? "", /Show a booted Android emulator in the mirror to re-record line 3/);
+ } finally { panel.dispose(); }
+});
+
+test("opening an app on the mirror keeps the open Studio test selected", async () => {
+ const listeners = new Set<() => void>();
+ let snapshot: Record = { device: { udid: "emulator-5554", name: "Pixel", state: "Booted", runtime: "", platform: "android", kind: "emulator" }, apps: [], foregroundApp: null, ready: true };
+ const apps = { subscribe: (listener: () => void) => { listeners.add(listener); return () => listeners.delete(listener); }, getSnapshot: () => snapshot } as unknown as DeviceAppsStore;
+ const calls: { name: string; arguments: Record }[] = [];
+ const panel = new TestingPanel(host({ mobile_testing_project_config: { runtimeMode: "bundled", targets: [{ name: "android", platform: "android", bundleId: "com.example.android" }] } }, calls), apps);
+ panel.setAvailable(true);
+ (panel as unknown as { update(fields: Record): void }).update({ projectPath: PROJECT, runtimeMode: "bundled", targets: [], selectedTestPath: "tests/stored.e2e.ts", selectedTestSource: "x", tests: [iosOnly] });
+ snapshot = { ...snapshot, foregroundApp: { bundleId: "com.example.android", pid: 3 } };
+ for (const listener of listeners) listener();
+ await new Promise(resolve => setTimeout(resolve, 0));
+ try {
+ assert.equal(panel.getSnapshot().selectedTestPath, "tests/stored.e2e.ts");
+ assert.deepEqual(panel.getSnapshot().targets.map(target => target.bundleId), ["com.example.android"]);
+ } finally { panel.dispose(); }
});
test("Run is unavailable for a Studio test with neither a pinned app nor one in front", () => {
From be455ca0a5c7bf2f1aca5c811bc7c1788503dae9 Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Wed, 18 Nov 2026 16:55:13 +0500
Subject: [PATCH 16/23] feat: wire agents
---
docs/agent-recording.md | 30 +-
packages/core/src/plugin.ts | 12 +-
packages/core/src/testing-agent.ts | 114 +++++-
packages/core/src/testing-failure.ts | 60 +++
packages/core/src/testing-matrix.ts | 3 +
packages/core/src/testing-prepare.ts | 11 +-
packages/core/src/testing-tools.ts | 249 +++++++++--
packages/core/test/mobile-dev-skill.test.ts | 23 +-
.../core/test/testing-agent-panel.test.ts | 87 +++-
packages/core/test/testing-prepare.test.ts | 15 +
.../core/test/testing-studio-agent.test.ts | 387 ++++++++++++++++++
packages/shared/src/panel-target.ts | 3 +
.../{ui => shared}/src/stored-test-steps.ts | 2 +-
.../test/stored-test-steps.test.ts | 0
packages/skills/mobile-dev-testing/SKILL.md | 71 +++-
packages/ui/src/components/testing-view.tsx | 20 +-
packages/ui/src/testing-matrix.ts | 4 +-
packages/ui/src/testing-panel.ts | 126 +++++-
18 files changed, 1119 insertions(+), 98 deletions(-)
create mode 100644 packages/core/src/testing-failure.ts
create mode 100644 packages/core/test/testing-studio-agent.test.ts
rename packages/{ui => shared}/src/stored-test-steps.ts (99%)
rename packages/{ui => shared}/test/stored-test-steps.test.ts (100%)
diff --git a/docs/agent-recording.md b/docs/agent-recording.md
index e798741a..c7cd3d7a 100644
--- a/docs/agent-recording.md
+++ b/docs/agent-recording.md
@@ -59,7 +59,7 @@ in `packages/core/src/app-flow-tools.ts`):
| `mobile_testing_agent_begin` | `{ title, goal }` | Opens the Testing tab, starts one session against the panel's current project, device and bundle id. Refuses, with what is missing, when any of the three is unset. |
| `mobile_testing_agent_screen` | `{}` | The runner's element tree as the agent's eyes: one compact row per element — `ref`, `role`, `name`, `text`, `placeholder`, `value`, `testId`, `enabled`, `selected`, `bounds` — **and the selector the recorder would emit for it**, with its rank and whether it is unique. The agent never writes a locator; it names a `ref`. |
| `mobile_testing_agent_step` | `{ ref?, kind, value?, direction?, instruction? }` | Records one step and performs it. `kind` is a `PinnedStepKind`; `instruction` with no `ref` records an `AgentStep`. Assertions record without touching the device, mirroring the element menu. An acting step answers with `navigated: true` when it replaced the screen — see "Where a flow ends". |
-| `mobile_testing_agent_finish` | `{ note? }` | Ends the session with the steps left dirty in the panel. Saves nothing, runs nothing, and keeps the device session for the panel's recorder. |
+| `mobile_testing_agent_finish` | `{ note? }` | Ends the session. In a project the steps are left dirty in the panel and nothing is saved; in Studio the test is saved, pinned to the recorded app, and its `relativePath` returned. Runs nothing either way. |
| `mobile_testing_agent_abort` | `{ reason }` | Drops the session; whatever was recorded stays in the panel. |
App-only:
@@ -69,9 +69,31 @@ App-only:
| `mobile_testing_agent_state` | `{}` | `{ active, status, revision, title, goal, steps, note, error }`. The panel polls it. |
| `mobile_testing_set_context` | `{ projectPath, udid, bundleId }` | The panel reports its selection whenever it changes. This is the only thing that knows the selected device, and `agent_begin` reads it. |
-The eight existing `mobile_testing_*` tools stay app-only. A narrow, intention-shaped surface is
-what keeps `write_file` and `run_test` out of the model's hands, which is what
-`packages/core/src/testing-tools.ts:17` already says.
+## Studio mode: the agent saves, runs and repairs
+
+In No project (Studio) mode the agent drives the whole loop, so more of `testing-tools.ts` is
+model-visible (`sharedVisibility`): `run_test`, `run_matrix`, `run_progress`, `cancel`, `set_target`,
+`read_file`, `tests`, plus two new tools. The rest (`write_file`, `stage_file`, `save_staged_file`,
+`delete_file`, drafts, setup) stay app-only.
+
+- **Gate.** Each model-visible tool refuses unless the Testing tab has reported a project
+ (`mobile_testing_set_context`), and `projectPath` defaults to it. The agent never needs to know
+ where Studio lives.
+- **`agent_finish` saves** in bundled mode: `tests/.e2e.ts`, never replacing a name that is
+ taken, pinned to the recorded platform and bundle id. It returns `relativePath`; no draft is kept.
+ In a project it still hands over unsaved.
+- **`mobile_testing_wait_for_app({ platform, timeoutMs })`** polls the booted devices of a
+ platform for a foreground app (home screens and launchers excluded) and returns its `bundleId`,
+ or `found: false` with a message to relay.
+- **`mobile_testing_branch_line({ relativePath, line, platform, locator })`** applies
+ `branchStoredStepLocator` (now `packages/shared/src/stored-test-steps.ts`, one copy for core and
+ the panel) and writes the result. Only the locator changes, so an assertion cannot be weakened
+ through it.
+- **Failure context.** A failed lane gets `failure: { line, source, error, elements }` before it
+ settles: the failing line and the device's tree as `role "name" → screen.getBy…` rows (at most 60).
+ `run_test` and `run_progress` both carry it.
+- **Panel.** The panel polls `run_progress`; a run it did not start is adopted as live lanes
+ (`agentRun`) and locks the same controls as `agent.active`. A saved recording refreshes the test list.
One session at a time. A second `agent_begin` refuses rather than stomping on the first.
diff --git a/packages/core/src/plugin.ts b/packages/core/src/plugin.ts
index cee44d14..dc790f49 100644
--- a/packages/core/src/plugin.ts
+++ b/packages/core/src/plugin.ts
@@ -126,8 +126,16 @@ export async function createPlugin(html: string | (() => Promise), o
// One store for both: the panel autosaves the flow it is holding and the agent keeps the flow it
// finished, and those are the same list of unsaved recordings.
const testDrafts = new TestDraftStore();
- const closeTestingDevices = registerTestingTools(server, new TestingProjectChoices(TESTING_DIRECTORY), testingDevices, testDrafts, { ops: systemDeviceOps({ simulators, android, drivers }) });
- registerTestingAgentTools(server, testingDevices, new TestingAgentRecordings(testingDevices, testDrafts));
+ // One recordings object too: it holds the panel's context, which the model-visible run tools check.
+ const testingRecordings = new TestingAgentRecordings(testingDevices, testDrafts);
+ const closeTestingDevices = registerTestingTools(server, new TestingProjectChoices(TESTING_DIRECTORY), testingDevices, testDrafts, {
+ ops: systemDeviceOps({
+ simulators, android, drivers,
+ foreground: async (platform, deviceId) => (await readDeviceApps(deviceId, undefined, platform, platform === "ios" ? "simulator" : undefined, { ...deviceAppSources, simulator: simulatorForeground })).foregroundApp?.bundleId ?? null,
+ }),
+ panel: testingRecordings,
+ });
+ registerTestingAgentTools(server, testingDevices, testingRecordings);
const resource = async () => typeof html === "string" ? { html } : await html();
const page = async () => configureUI((await resource()).html);
diff --git a/packages/core/src/testing-agent.ts b/packages/core/src/testing-agent.ts
index e8aee672..20485e2d 100644
--- a/packages/core/src/testing-agent.ts
+++ b/packages/core/src/testing-agent.ts
@@ -4,7 +4,7 @@ import { registerAppTool } from "@modelcontextprotocol/ext-apps/server";
import { z } from "zod";
import { errorMessage } from "@mobile-dev/shared/protocol.ts";
import { ExpectedOperationError } from "@mobile-dev/shared/error-reporting.ts";
-import { deviceIdSchema } from "@mobile-dev/shared/panel-target.ts";
+import { PANEL_HEARTBEAT_MS, deviceIdSchema } from "@mobile-dev/shared/panel-target.ts";
import {
agentStepLabel, anchorSelector, emitE2eTest, resolveComponentSelector, selectorSource, stepEffect, stepExpression,
stepLabel, stepNeedsValue, swipeDirection, swipePath,
@@ -18,6 +18,7 @@ import { TestingDevices } from "./testing-device.ts";
import { TestDraftStore } from "./testing-drafts.ts";
import type { TestingDeviceTarget } from "./testing-device.ts";
import { captureServerError, recordTestingAgentRead } from "./telemetry.ts";
+import { inspectProject, writeTestFile, writeTestTarget } from "./testing-projects.ts";
/**
* Recording an e2e test from the user's own coding agent, into the Testing panel the user is
@@ -49,6 +50,10 @@ const RANK_LABEL: Record = {
*/
const MAX_ELEMENTS = 200;
+/** How often the open Testing tab re-sends its selection, and how long silence is believed (three beats). */
+export { PANEL_HEARTBEAT_MS };
+export const PANEL_EXPIRY_MS = PANEL_HEARTBEAT_MS * 3;
+
/** What the panel's selection is, as the panel reports it. Nothing here is inferred. */
export type TestingAgentContext = { projectPath: string; deviceId: string; platform: "ios" | "android"; bundleId: string };
@@ -74,6 +79,12 @@ export type TestingAgentState = {
* same draft instead of leaving a second copy of the same flow in the list.
*/
draftId: string;
+ /**
+ * Where the finished session was saved as a test, or "" when it was only kept as a draft.
+ * Set in Studio (bundled) mode, where finishing writes the test; the panel refreshes its list
+ * from it instead of adopting a draft.
+ */
+ savedPath: string;
};
type Session = {
@@ -103,6 +114,8 @@ type Session = {
identities: Set;
/** Set once the session ends and its steps are kept as an unsaved recording. */
draftId: string;
+ /** Set once a Studio session's steps are written as a test, relative to its tests folder root. */
+ savedPath: string;
};
/** One element of a screen read, as the agent sees it. */
@@ -191,15 +204,47 @@ export class TestingAgentRecordings {
private readonly devices: TestingDevices;
private readonly drafts: TestDraftStore;
private context?: TestingAgentContext;
+ /** The project the Testing panel reports, whether or not a device is selected: proof the tab is open. */
+ private panelProject = "";
private session?: Session;
private revision = 0;
- constructor(devices: TestingDevices, drafts = new TestDraftStore()) { this.devices = devices; this.drafts = drafts; }
+ /** When the panel last reported, on `now`'s clock; 0 before the first report. */
+ private reportedAt = 0;
+ private readonly now: () => number;
+ private readonly expiryMs: number;
+
+ /**
+ * `expiryMs` is how long the server believes a panel that has stopped reporting: about three of
+ * the panel's heartbeats (`PANEL_HEARTBEAT_MS`). Both it and the clock are injectable so tests
+ * need not sleep.
+ */
+ constructor(devices: TestingDevices, drafts = new TestDraftStore(), options: { now?: () => number; expiryMs?: number } = {}) {
+ this.devices = devices; this.drafts = drafts;
+ this.now = options.now ?? Date.now;
+ this.expiryMs = options.expiryMs ?? PANEL_EXPIRY_MS;
+ }
+
+ /** Forgets a panel that has gone quiet: a closed tab or window reports nothing, and nothing else marks it closed. */
+ private expire() {
+ if (this.reportedAt !== 0 && this.now() - this.reportedAt > this.expiryMs) {
+ this.reportedAt = 0;
+ this.panelProject = "";
+ this.context = undefined;
+ }
+ }
/** The panel's current project, device and bundle id. The only thing that knows the selection. */
setContext(context: TestingAgentContext) { this.context = context; }
clearContext() { this.context = undefined; }
+ /** The panel reports its project on every selection change, even with no device; empty means it has none. */
+ setPanelProject(projectPath: string) { this.panelProject = projectPath; this.reportedAt = projectPath ? this.now() : 0; }
+ /** The project the Testing panel has selected, or undefined when the tab has not reported one. */
+ panelProjectPath(): string | undefined { this.expire(); return this.panelProject || undefined; }
+ /** The panel's full selection, when it has a device and an app selected. */
+ panelContext(): TestingAgentContext | undefined { this.expire(); return this.context; }
+
state(): TestingAgentState {
const session = this.session;
return {
@@ -212,6 +257,7 @@ export class TestingAgentRecordings {
note: session?.note ?? "",
error: session?.error ?? "",
draftId: session?.draftId ?? "",
+ savedPath: session?.savedPath ?? "",
};
}
@@ -237,6 +283,7 @@ export class TestingAgentRecordings {
if (this.session?.status === "recording") {
refused(`An agent recording is already in flight: "${this.session.title}". Finish it with mobile_testing_agent_finish, or drop it with mobile_testing_agent_abort.`);
}
+ this.expire();
const context = this.context;
const missing = [
context?.projectPath ? "" : "an e2e project",
@@ -250,7 +297,7 @@ export class TestingAgentRecordings {
target: { deviceId: context.deviceId, platform: context.platform, projectPath: context.projectPath, bundleId: context.bundleId },
title: input.title.trim() || "a recorded flow",
goal: input.goal.trim(),
- steps: [], status: "recording", note: "", error: "", draftId: "",
+ steps: [], status: "recording", note: "", error: "", draftId: "", savedPath: "",
readId: 0, refs: new Map(), components: [], rows: [], truncated: 0, readAt: 0, identities: new Set(),
};
this.changed();
@@ -471,26 +518,63 @@ export class TestingAgentRecordings {
}
/**
- * Ends the recording with the steps left dirty in the panel.
+ * Ends the recording.
*
- * Nothing is saved and nothing is run. The user adjusts the flow, names the file and saves it
- * themselves — a run would also reset the app and take the device session, which is the one
- * thing the panel's recorder still needs.
+ * In Studio (bundled) mode the test is written into Studio, pinned to the recorded platform and
+ * app, and its path is returned: there is no project file for a user to review, and the agent
+ * runs the test next. In a project the steps stay unsaved in the panel for the user to adjust,
+ * name and save themselves. Nothing is run either way — a run resets the app and takes the
+ * device session.
*/
async finish(input: { note?: string }) {
const session = this.recording();
session.status = "finished";
session.note = input.note?.trim() ?? "";
- await this.keep(session);
+ const source = emitE2eTest(session.steps, { title: session.title });
+ const saved = await this.saveToStudio(session, source);
+ if (!saved.relativePath) await this.keep(session);
this.changed();
+ const count = `${session.steps.length} step${session.steps.length === 1 ? "" : "s"}`;
return {
ok: true,
steps: session.steps.length,
- source: emitE2eTest(session.steps, { title: session.title }),
- next: `${session.steps.length} step${session.steps.length === 1 ? "" : "s"} are waiting in Mobile Dev's Testing panel, unsaved. Tell the user to review them there and press Save; nothing has been written to the project and nothing has been run.`,
+ source,
+ ...(saved.relativePath ? {
+ saved: true, relativePath: saved.relativePath, path: `Studio/${saved.relativePath}`,
+ platform: session.target.platform, bundleId: session.target.bundleId,
+ next: `${count} saved in Studio as ${saved.relativePath}, pinned to ${session.target.platform} ${session.target.bundleId}. Run it with mobile_testing_run_test or mobile_testing_run_matrix, passing that relativePath.`,
+ } : {
+ saved: false,
+ ...(saved.error ? { saveError: saved.error } : {}),
+ next: `${count} are waiting in Mobile Dev's Testing panel, unsaved. Tell the user to review them there and press Save; nothing has been written to the project and nothing has been run.${saved.error ? ` Saving to Studio failed: ${saved.error}` : ""}`,
+ }),
};
}
+ /** Writes a Studio session's test and its app pin. Never throws: a failed save falls back to the draft. */
+ private async saveToStudio(session: Session, source: string): Promise<{ relativePath?: string; error?: string }> {
+ if (session.steps.length === 0) return {};
+ // A project that cannot be read is not Studio; the draft path handles it as it always did.
+ const project = await inspectProject(session.target.projectPath).catch(() => undefined);
+ if (project?.runtimeMode !== "bundled") return {};
+ try {
+ const base = session.title.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "recorded-flow";
+ for (let attempt = 1; attempt <= 50; attempt++) {
+ const relativePath = `tests/${base}${attempt === 1 ? "" : `-${attempt}`}.e2e.ts`;
+ // Never replaces: a name that is taken is a test the user or an earlier run already made.
+ const written = await writeTestFile(session.target.projectPath, relativePath, source, false);
+ if (!written.written) continue;
+ await writeTestTarget(session.target.projectPath, relativePath, { platform: session.target.platform, bundleId: session.target.bundleId });
+ session.savedPath = relativePath;
+ return { relativePath };
+ }
+ return { error: "Every test name this recording could take is already used." };
+ } catch (error) {
+ captureServerError(error, "testing.agent.save");
+ return { error: errorMessage(error) };
+ }
+ }
+
/** Drops the session. Whatever was recorded stays in the panel, which is the user's to keep. */
async abort(input: { reason: string }) {
const session = this.session;
@@ -531,8 +615,8 @@ const write = { readOnlyHint: false, destructiveHint: false, openWorldHint: fals
const appVisibility = { ui: { visibility: ["app"] as ("app" | "model")[] } };
/**
* Visible to the model *and* to the panel, which is the whole point of this file: the agent drives
- * the recording and the panel shows it. The eight tools in `testing-tools.ts` stay app-only —
- * writing a file and running a test are the user's acts, not a step in an agent's loop.
+ * the recording and the panel shows it. The run, progress, cancel, target, read and list tools in
+ * `testing-tools.ts` are shared the same way; the rest stay app-only.
*/
const sharedVisibility = { ui: { visibility: ["app", "model"] as ("app" | "model")[] } };
@@ -556,7 +640,7 @@ export function registerTestingAgentTools(server: McpServer, devices: TestingDev
registerAppTool(server, "mobile_testing_agent_begin", {
title: "Begin recording an e2e test",
description:
- "Start recording an e2e test into Mobile Dev's Testing panel, against the project, device and app the panel already has selected. Refuses, saying what is missing, when the user has not chosen them. The steps appear in the panel as you record them and are never saved or run by you.",
+ "Start recording an e2e test into Mobile Dev's Testing panel, against the project, device and app the panel already has selected. Refuses, saying what is missing, when the user has not chosen them. The steps appear in the panel as you record them. In No project (Studio) mode mobile_testing_agent_finish saves the test pinned to the recorded app and returns its relativePath for mobile_testing_run_test / mobile_testing_run_matrix; in a project the steps stay unsaved for the user.",
inputSchema: {
title: z.string().min(1).max(200).describe("The test's title, e.g. \"the explore details screen\"."),
goal: z.string().min(1).max(500).describe("What this flow covers, in one sentence. Shown to the user in the panel's banner."),
@@ -593,7 +677,7 @@ export function registerTestingAgentTools(server: McpServer, devices: TestingDev
registerAppTool(server, "mobile_testing_agent_finish", {
title: "Finish the recording",
description:
- "End the recording. The steps are left unsaved in the Testing panel for the user to adjust, save and run; nothing is written to the project and nothing is run.",
+ "End the recording. In No project (Studio) mode the test is saved into Studio, pinned to the recorded platform and app, and its relativePath is returned so you can run it. In a project the steps are left unsaved in the Testing panel for the user to adjust and save, and nothing is written. Nothing is run either way.",
inputSchema: { note: z.string().max(500).optional().describe("One line on what was recorded, for the user.") },
annotations: write,
_meta: sharedVisibility,
@@ -628,6 +712,8 @@ export function registerTestingAgentTools(server: McpServer, devices: TestingDev
annotations: write,
_meta: appVisibility,
}, safe((input: Omit & { platform?: "ios" | "android" }) => {
+ // Called on every change and again on the panel's heartbeat; an empty project is the panel leaving.
+ recordings.setPanelProject(input.projectPath);
if (input.projectPath && input.deviceId && input.platform && input.bundleId) recordings.setContext({ ...input, platform: input.platform });
else recordings.clearContext();
return dataResult({ ok: true });
diff --git a/packages/core/src/testing-failure.ts b/packages/core/src/testing-failure.ts
new file mode 100644
index 00000000..54b83d9e
--- /dev/null
+++ b/packages/core/src/testing-failure.ts
@@ -0,0 +1,60 @@
+import { resolveComponentSelector, selectorSource } from "@mobile-dev/shared/test-recording.ts";
+import type { ScreenComponent, ScreenSize } from "@mobile-dev/shared/screen-annotations.ts";
+import type { TestRunResult, TestRunStep } from "./testing-run.ts";
+
+/**
+ * What an agent needs to repair a failed lane without another round trip: the line that failed,
+ * what the runner said, and the device's own screen as compact rows with the locator each one
+ * would be written with. Attached to the lane, so `run_test` and `run_progress` both carry it.
+ */
+export interface LaneFailure {
+ /** The 1-based line in the test file, or 0 when the failure has no line of its own (`app.open`, a crash). */
+ line: number;
+ /** That line's text, trimmed. */
+ source: string;
+ error: string;
+ /** One row per element on the device's screen, at most `MAX_FAILURE_ELEMENTS`, each ending in its locator. */
+ elements?: string[];
+ /** How many elements the read had beyond those listed. */
+ omitted?: number;
+ /** Why no element list is attached, e.g. the device could not be read. */
+ elementsError?: string;
+}
+
+export const MAX_FAILURE_ELEMENTS = 60;
+
+const PASSING = new Set(["passed", "skipped", "unknown", ""]);
+
+/** The first step that failed: one with an error, else one whose status is not a passing one. */
+export function failedStep(steps: readonly TestRunStep[]): TestRunStep | undefined {
+ return steps.find(step => step.error) ?? steps.find(step => !PASSING.has(step.status));
+}
+
+/** The failure of a finished run, or undefined when it passed. `source` is the text of the file that ran. */
+export function describeFailure(result: TestRunResult, source: string): LaneFailure | undefined {
+ if (result.status === "passed") return undefined;
+ const step = failedStep(result.steps);
+ const text = step ? source.split("\n")[step.line - 1]?.trim() ?? step.label : "";
+ const error = step?.error ?? result.error ?? result.output?.trim().slice(-600) ?? `The run ${result.status}.`;
+ return { line: step?.line ?? 0, source: text, error };
+}
+
+/** `role "name" · text "…" · placeholder · testId → screen.getBy…`, one element per row, offscreen ones flagged. */
+export function compactElements(tree: readonly ScreenComponent[], screen?: ScreenSize, limit = MAX_FAILURE_ELEMENTS): { elements: string[]; omitted: number } {
+ const all = [...tree];
+ const named = all.flatMap(component => {
+ const resolved = resolveComponentSelector(all, component, screen);
+ if (!resolved) return [];
+ const parts = [
+ component.role ?? "element",
+ component.label ? `"${component.label}"` : "",
+ component.text && component.text !== component.label ? `text "${component.text}"` : "",
+ component.placeholder ? `placeholder "${component.placeholder}"` : "",
+ component.value ? `value "${component.value}"` : "",
+ component.disabled ? "disabled" : "",
+ component.hidden ? "offscreen" : "",
+ ].filter(Boolean);
+ return [`${parts.join(" ")} → ${selectorSource(resolved.selector)}${resolved.ambiguous ? " (not unique)" : ""}`];
+ });
+ return { elements: named.slice(0, limit), omitted: Math.max(0, named.length - limit) };
+}
diff --git a/packages/core/src/testing-matrix.ts b/packages/core/src/testing-matrix.ts
index b473a699..feb515ac 100644
--- a/packages/core/src/testing-matrix.ts
+++ b/packages/core/src/testing-matrix.ts
@@ -1,6 +1,7 @@
import { randomUUID } from "node:crypto";
import { errorMessage } from "@mobile-dev/shared/protocol.ts";
import { expectedOutcome } from "@mobile-dev/shared/error-reporting.ts";
+import type { LaneFailure } from "./testing-failure.ts";
import type { TestRunProgress, TestRunResult } from "./testing-run.ts";
/**
@@ -39,6 +40,8 @@ export interface Lane {
resolvedDeviceId?: string;
progress: TestRunProgress[];
result?: TestRunResult;
+ /** The failing line and the device's screen, set before the lane settles as failed. */
+ failure?: LaneFailure;
error?: string;
startedAt?: number;
finishedAt?: number;
diff --git a/packages/core/src/testing-prepare.ts b/packages/core/src/testing-prepare.ts
index abf60c26..b85a47fe 100644
--- a/packages/core/src/testing-prepare.ts
+++ b/packages/core/src/testing-prepare.ts
@@ -21,6 +21,10 @@ export interface DeviceOps {
/** Installs the app on `to` from the copy already on `from`. */
copyApp(platform: MatrixPlatform, from: string, to: string, appId: string, signal: AbortSignal): Promise;
launch(platform: MatrixPlatform, deviceId: string, appId: string): Promise;
+ /** The booted devices of a platform, for finding the one the user opened an app on. */
+ bootedDevices?(platform: MatrixPlatform): Promise<{ deviceId: string; name: string }[]>;
+ /** The bundle id or package of the app in the foreground, or null when none is. */
+ foregroundApp?(platform: MatrixPlatform, deviceId: string): Promise;
}
export interface LaneExecutorDeps {
@@ -84,7 +88,7 @@ export function parsePmPaths(output: string): string[] {
}
/** The real thing: `simctl` for iOS simulators, the emulator through `ServeEmu` and `adb` for Android. */
-export function systemDeviceOps(deps: { simulators: Simctl; android: ServeEmu; drivers: DriverFactory; commands?: Commands }): DeviceOps {
+export function systemDeviceOps(deps: { simulators: Simctl; android: ServeEmu; drivers: DriverFactory; commands?: Commands; foreground?: (platform: MatrixPlatform, deviceId: string) => Promise }): DeviceOps {
const commands = deps.commands ?? systemCommands;
const simctl = (args: string[], timeout = 30_000) => commands.run("xcrun", ["simctl", ...args], { timeout });
const adb = async (serial: string, args: string[], timeout = 30_000) => commands.run(await commands.adb(), ["-s", serial, ...args], { timeout });
@@ -142,5 +146,10 @@ export function systemDeviceOps(deps: { simulators: Simctl; android: ServeEmu; d
});
},
async launch(platform, deviceId, appId) { await deps.drivers({ platform, deviceId }).launch(appId); },
+ async bootedDevices(platform) {
+ const status = await (platform === "ios" ? deps.simulators.list() : deps.android.list());
+ return status.devices.flatMap(device => "state" in device && device.state === "Booted" && (device.platform ?? platform) === platform ? [{ deviceId: device.udid, name: device.name }] : []);
+ },
+ foregroundApp: async (platform, deviceId) => deps.foreground ? deps.foreground(platform, deviceId) : null,
};
}
diff --git a/packages/core/src/testing-tools.ts b/packages/core/src/testing-tools.ts
index ce4dbc0e..3ab71651 100644
--- a/packages/core/src/testing-tools.ts
+++ b/packages/core/src/testing-tools.ts
@@ -6,7 +6,11 @@ import { errorMessage } from "@mobile-dev/shared/protocol.ts";
import { ExpectedOperationError } from "@mobile-dev/shared/error-reporting.ts";
import { captureServerError, recordTestingSetupOperation } from "./telemetry.ts";
import type { TestingProjectChoices } from "./testing-projects.ts";
-import { deleteTestFile, discardStagedTestFile, inspectProject, listTestFiles, previewTestFile, readTestFile, resolveTestRunPaths, saveStagedTestFile, stageTestFile, studioWorkspacePath, writeTestFile, writeTestTarget } from "./testing-projects.ts";
+import { deleteTestFile, discardStagedTestFile, inspectProject, listTestFiles, previewTestFile, readTestFile, readTestTarget, resolveTestRunPaths, saveStagedTestFile, stageTestFile, studioWorkspacePath, writeTestFile, writeTestTarget } from "./testing-projects.ts";
+import type { TestTarget } from "./testing-projects.ts";
+import { branchStoredStepLocator } from "@mobile-dev/shared/stored-test-steps.ts";
+import { compactElements, describeFailure } from "./testing-failure.ts";
+import type { TestingAgentContext } from "./testing-agent.ts";
import { TestDraftStore } from "./testing-drafts.ts";
import { MAX_DRAFT_STEPS, recordedStepSchema, testDraftIdSchema } from "@mobile-dev/shared/test-drafts.ts";
import type { TestDraft } from "@mobile-dev/shared/test-drafts.ts";
@@ -27,6 +31,36 @@ const write = { readOnlyHint: false, destructiveHint: false, openWorldHint: fals
const destructive = { readOnlyHint: false, destructiveHint: true, openWorldHint: false };
/** The Testing panel drives these itself; the model has its own e2e MCP server for test work. */
const appVisibility = { ui: { visibility: ["app"] as ("app" | "model")[] } };
+/**
+ * The tools an agent drives No project (Studio) mode with: run, progress, cancel, pin an app,
+ * read a test, list tests, branch a line, wait for an app. The panel calls them too.
+ */
+const sharedVisibility = { ui: { visibility: ["app", "model"] as ("app" | "model")[] } };
+
+/** What the Testing tab has told the server; see `TestingAgentRecordings.setPanelProject`. */
+export interface PanelContext {
+ panelProjectPath(): string | undefined;
+ panelContext?(): TestingAgentContext | undefined;
+}
+
+/** Quote-aware: one expression with balanced brackets and no `;` outside a string. */
+function singleExpression(text: string): boolean {
+ const closing: Record = { "(": ")", "[": "]", "{": "}" };
+ const stack: string[] = [];
+ let quote = "";
+ for (let index = 0; index < text.length; index++) {
+ const char = text[index]!;
+ if (char === "\\" && quote) { index++; continue; }
+ if (quote) { if (char === quote) quote = ""; continue; }
+ if (char === "\n" || char === ";") return false;
+ if (char === '"' || char === "'" || char === "`") { quote = char; continue; }
+ if (closing[char]) stack.push(closing[char]!);
+ else if ([")", "]", "}"].includes(char) && stack.pop() !== char) return false;
+ }
+ return !quote && stack.length === 0;
+}
+
+const LAUNCHER_APP = /^com\.apple\.springboard$|^com\.android\.systemui$|launcher/i;
const projectPath = z.string().min(1).max(4096);
@@ -47,7 +81,7 @@ function dataResult(data: Record, message?: string): CallToolRe
/** The Testing panel's project selection, and the device tree its recorder names selectors from. */
/** Returns the shutdown the plugin has to run: the recorder's device session, handed back. */
-export function registerTestingTools(server: McpServer, projects: TestingProjectChoices, devices = new TestingDevices(), drafts = new TestDraftStore(), matrix: { ops?: DeviceOps; registry?: MatrixRegistry; run?: typeof runRecordedTest } = {}): () => Promise {
+export function registerTestingTools(server: McpServer, projects: TestingProjectChoices, devices = new TestingDevices(), drafts = new TestDraftStore(), matrix: { ops?: DeviceOps; registry?: MatrixRegistry; run?: typeof runRecordedTest; panel?: PanelContext; pollMs?: number; failureReadMs?: number } = {}): () => Promise {
/**
* Every run, as a matrix of lanes; a single run is a matrix of one.
*
@@ -58,6 +92,21 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
*/
const registry = matrix.registry ?? new MatrixRegistry();
const runTest = matrix.run ?? runRecordedTest;
+ /**
+ * The project a model-visible tool works on. With a panel, the Testing tab must have reported a
+ * project — that is the only proof the user has it open — and a call that names none defaults to
+ * it, so the agent never needs to know where Studio lives.
+ */
+ const panel = matrix.panel;
+ function resolveProject(selected?: string): string {
+ if (!panel) {
+ if (!selected) throw new ExpectedOperationError("invalid_input", "Pass projectPath.");
+ return selected;
+ }
+ const current = panel.panelProjectPath();
+ if (!current) throw new ExpectedOperationError("invalid_input", "The Testing tab is not open, so there is no project to work on. Ask the user to open Mobile Dev's Testing tab, then try again.");
+ return selected ?? current;
+ }
const matrixWire = (run: MatrixRun) => ({ ...snapshotMatrix(run), running: run.lanes.some(lane => !["passed", "failed", "cancelled", "error"].includes(lane.state)) });
registerAppTool(server, "mobile_testing_projects", {
title: "List testing projects",
@@ -112,21 +161,21 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
*/
registerAppTool(server, "mobile_testing_tests", {
title: "List the project's tests",
- description: "List the .e2e.ts files already in the project's tests/ folder, newest first.",
- inputSchema: { projectPath },
+ description: "List the .e2e.ts files already in the project's tests/ folder, newest first. Each carries the app it is pinned to: target.platform and target.bundleId for the app it was recorded against, and target.apps for the app added on the other platform. projectPath defaults to the Testing tab's project.",
+ inputSchema: { projectPath: projectPath.optional() },
annotations: read,
- _meta: appVisibility,
- }, safe(async ({ projectPath: selected }: { projectPath: string }) =>
- dataResult({ tests: await listTestFiles(selected) })));
+ _meta: sharedVisibility,
+ }, safe(async ({ projectPath: selected }: { projectPath?: string }) =>
+ dataResult({ tests: await listTestFiles(resolveProject(selected)) })));
registerAppTool(server, "mobile_testing_read_file", {
title: "Preview a project test",
- description: "Read the source of one .e2e.ts file in the project's tests/ folder for the Testing panel preview.",
- inputSchema: { projectPath, relativePath: z.string().min(1).max(512) },
+ description: "Read the source of one .e2e.ts file in the project's tests/ folder. Lines are numbered from 1; the line numbers in a failed run's steps and failure refer to this source. projectPath defaults to the Testing tab's project.",
+ inputSchema: { projectPath: projectPath.optional(), relativePath: z.string().min(1).max(512) },
annotations: read,
- _meta: appVisibility,
- }, safe(async ({ projectPath: selected, relativePath }: { projectPath: string; relativePath: string }) =>
- dataResult(await previewTestFile(selected, relativePath))));
+ _meta: sharedVisibility,
+ }, safe(async ({ projectPath: selected, relativePath }: { projectPath?: string; relativePath: string }) =>
+ dataResult(await previewTestFile(resolveProject(selected), relativePath))));
registerAppTool(server, "mobile_testing_stage_file", {
title: "Keep project test edits temporarily",
@@ -307,12 +356,15 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
registerAppTool(server, "mobile_testing_set_target", {
title: "Pin a Studio test to an app",
- description: "Store the app (platform and bundle id) a saved Studio test runs against. Only Studio tests carry one; a project test keeps using its config's target. With mode add, the app is added for its platform and the app the test was recorded against stays.",
- inputSchema: { projectPath, relativePath: z.string().min(1).max(512), platform: z.enum(["ios", "android"]), bundleId: z.string().min(1).max(512), mode: z.enum(["replace", "add"]).optional() },
+ description: "Store the app (platform and bundle id) a saved Studio test runs against. Only Studio tests carry one; a project test keeps using its config's target. With mode add, the app is added for its platform and the app the test was recorded against stays: use it to give a test the app for its other platform, with the bundleId mobile_testing_wait_for_app returned. Returns the app id pinned. projectPath defaults to the Testing tab's project.",
+ inputSchema: { projectPath: projectPath.optional(), relativePath: z.string().min(1).max(512), platform: z.enum(["ios", "android"]), bundleId: z.string().min(1).max(512), mode: z.enum(["replace", "add"]).optional() },
annotations: write,
- _meta: appVisibility,
- }, safe(async ({ projectPath: selected, relativePath, platform, bundleId, mode }: { projectPath: string; relativePath: string; platform: "ios" | "android"; bundleId: string; mode?: "replace" | "add" }) =>
- dataResult({ pinned: await writeTestTarget(selected, relativePath, { platform, bundleId }, mode) })));
+ _meta: sharedVisibility,
+ }, safe(async ({ projectPath: selected, relativePath, platform, bundleId, mode }: { projectPath?: string; relativePath: string; platform: "ios" | "android"; bundleId: string; mode?: "replace" | "add" }) => {
+ const pinned = await writeTestTarget(resolveProject(selected), relativePath, { platform, bundleId }, mode);
+ return dataResult({ pinned, ...(pinned ? { added: { platform, bundleId, mode: mode ?? "replace" } } : {}) },
+ pinned ? `Pinned ${platform} ${bundleId} to ${relativePath} (${mode ?? "replace"}).` : "Only Studio tests carry a pinned app; nothing was changed.");
+ }));
const modelSchema = z.object({
provider: z.enum(["vercel", "openrouter", "openai-compatible", "chatgpt", "copilot", "opencode-console", "grok"]),
@@ -322,7 +374,13 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
/** Everything a run needs before a device is chosen: the same for a single run and for every lane. */
async function prepareRequest(input: RunInput) {
- const { projectPath: selected, relativePath, configPath, timeoutMs, target, platform, bundleId, pin, model, untilSource } = input;
+ const { projectPath: selected, relativePath, configPath, timeoutMs, target, pin, model, untilSource } = input;
+ // A Studio test remembers its app, so a caller that names none runs the one it was pinned to.
+ let { platform, bundleId } = input;
+ if (!(platform && bundleId)) {
+ const stored = await readTestTarget(selected, relativePath).catch(() => undefined);
+ if (stored) ({ platform, bundleId } = storedApp(stored, platform, bundleId));
+ }
const project = await inspectProject(selected, platform && bundleId ? { platform, bundleId } : undefined);
if (pin && platform && bundleId) await writeTestTarget(selected, relativePath, { platform, bundleId }).catch(() => false);
const paths = await resolveTestRunPaths(selected, relativePath, project.runtimeMode === "project" ? configPath : undefined, untilSource !== undefined);
@@ -335,7 +393,41 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
...(project.runtimeMode === "bundled" && platform && bundleId ? { bundledTarget: { platform, bundleId } }
: project.runtimeMode === "bundled" && selectedTarget?.platform && selectedTarget.bundleId ? { bundledTarget: { platform: selectedTarget.platform as "ios" | "android", bundleId: selectedTarget.bundleId } } : {}),
...(model ? { model } : {}) };
- return { request, project };
+ return { request, project, platform, bundleId };
+ }
+
+ /** The app a stored target gives a platform (the recorded platform's, or the one added). */
+ function storedApp(stored: TestTarget, platform?: "ios" | "android", bundleId?: string): { platform: "ios" | "android"; bundleId?: string } {
+ const chosen = platform ?? stored.platform;
+ return { platform: chosen, bundleId: bundleId ?? (chosen === stored.platform ? stored.bundleId : stored.apps?.[chosen]) };
+ }
+
+ /**
+ * The failing line and the device's screen, set on the lane before it settles, so whoever polls
+ * the run has what it takes to choose a locator without another call. Best effort: the run's own
+ * verdict is already in hand, and a device that cannot be read only costs the element list.
+ */
+ async function attachFailure(lane: { failure?: import("./testing-failure.ts").LaneFailure }, result: Awaited>, source: string,
+ read: { deviceId: string; platform: "ios" | "android"; projectPath: string; runtimeRoot: string; bundleId?: string }) {
+ const failure = describeFailure(result, source);
+ if (!failure) return;
+ lane.failure = failure;
+ if (!read.bundleId) { failure.elementsError = "No app id is known for this device, so its screen was not read."; return; }
+ if (!read.deviceId) { failure.elementsError = "The runner chose the device, so its screen was not read. Run with mobile_testing_run_matrix to name one."; return; }
+ try {
+ const timeout = matrix.failureReadMs ?? 20_000;
+ let timer: ReturnType | undefined;
+ const tree = await Promise.race([
+ devices.read({ deviceId: read.deviceId, platform: read.platform, projectPath: read.projectPath, runtimeRoot: read.runtimeRoot, bundleId: read.bundleId }),
+ new Promise((_, reject) => { timer = setTimeout(() => reject(new Error("Reading the device's screen timed out.")), timeout); }),
+ ]).finally(() => clearTimeout(timer));
+ Object.assign(failure, compactElements(tree.tree, tree.screen));
+ } catch (error) {
+ failure.elementsError = errorMessage(error);
+ } finally {
+ // The next run takes the device; a session this read left behind would refuse it.
+ await devices.releaseOn([read.deviceId]).catch(() => undefined);
+ }
}
/** Starts a matrix whose lanes run `request` and returns once it is registered. */
@@ -346,9 +438,9 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
registerAppTool(server, "mobile_testing_run_test", {
title: "Run a recorded test",
description:
- "Run one saved test with the project's own e2e CLI and report each step with the line it came from. The recorder's device session is released first: the runner allows one session per device, so a run started while the recorder holds it fails with \"Device is already in use\". Runs on the one device the runner picks; use mobile_testing_run_matrix to choose devices.",
+ "Run one saved test and report each step with the line it came from. Blocks until the run ends; for a long test, or to choose the device, start it with mobile_testing_run_matrix and read mobile_testing_run_progress. Without platform and bundleId a Studio test runs the app it is pinned to. The recorder's device session is released first. A failed run carries `failure`: the failing line, its error and, when the device can be read, its screen as locator rows to pick from. projectPath defaults to the Testing tab's project.",
inputSchema: {
- projectPath,
+ projectPath: projectPath.optional(),
relativePath: z.string().min(1).max(512).describe("The test to run, relative to the project, e.g. tests/a-recorded-flow.e2e.ts."),
configPath: z.string().min(1).max(4096).optional().describe("The project's e2e config, so the run can report live per-step progress."),
timeoutMs: z.number().int().min(10_000).max(30 * 60_000).optional(),
@@ -362,46 +454,62 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
},
// A test run drives the app on the device: it taps, types and changes the app's own state.
annotations: destructive,
- _meta: appVisibility,
- }, safe(async (input: RunInput) => {
+ _meta: sharedVisibility,
+ }, safe(async (raw: Omit & { projectPath?: string }) => {
+ const input: RunInput = { ...raw, projectPath: resolveProject(raw.projectPath) };
// The release is a dependency of the run, not a step the caller is trusted to have taken: see
// `TestRunDeps`. The panel releases too, but a caller who forgets must not break the run.
- const { request } = await prepareRequest(input);
+ const { request, project, platform, bundleId } = await prepareRequest(input);
+ const lanePlatform = platform ?? "ios";
const executor: LaneExecutor = {
// No device is chosen and nothing is booted or installed: the runner picks, as it always has.
prepare: async () => "",
- run: (_lane, _device, signal, onProgress) => runTest(request, { release: () => devices.release(), onProgress, signal }),
+ run: async (lane, _device, signal, onProgress) => {
+ const result = await runTest(request, { release: () => devices.release(), onProgress, signal });
+ const context = panel?.panelContext?.();
+ const source = request.untilSource ?? await readTestFile(input.projectPath, input.relativePath).catch(() => "");
+ await attachFailure(lane, result, source, { deviceId: context && context.platform === lanePlatform ? context.deviceId : "", platform: lanePlatform, projectPath: input.projectPath, runtimeRoot: project.runtime.root, ...(bundleId ? { bundleId } : {}) });
+ return result;
+ },
};
- const { run, done } = launchMatrix(input.relativePath, [{ deviceId: "auto", platform: input.platform ?? "ios", name: "Default device" }], 1, executor);
+ const { run, done } = launchMatrix(input.relativePath, [{ deviceId: "auto", platform: lanePlatform, name: "Default device" }], 1, executor);
await done;
const lane = run.lanes[0]!;
// A run that could not start at all is the caller's error, as it was before lanes existed.
if (lane.state === "error" || (lane.state === "cancelled" && !lane.result)) throw new Error(lane.error ?? "The test run was cancelled.");
- return dataResult({ ...lane.result!, matrixId: run.matrixId }, `${input.relativePath} ${lane.result!.status}.`);
+ return dataResult({ ...lane.result!, matrixId: run.matrixId, ...(lane.failure ? { failure: lane.failure } : {}) }, `${input.relativePath} ${lane.result!.status}.`);
}));
registerAppTool(server, "mobile_testing_run_matrix", {
title: "Run a recorded test on several devices",
description:
- "Run one saved test on several devices at once, one independent lane per device, and return a matrixId immediately; read progress with mobile_testing_run_progress. At most `limit` lanes run at once (default 3, max 8); the rest are queued. Devices that are off are booted, and a device missing the app gets it installed by copying it from another device in the run that has it; otherwise that lane fails with \"App not installed\". Bundled mode only. A failure on one device does not stop the others.",
+ "Run one saved test on several devices at once, one independent lane per device (iOS and Android can be mixed), and return a matrixId immediately; read progress with mobile_testing_run_progress. At most `limit` lanes run at once (default 3, max 8); the rest are queued. Devices that are off are booted, and a device missing the app gets it installed by copying it from another device in the run that has it; otherwise that lane fails with \"App not installed\". `apps` defaults to the apps the test is pinned to; a platform with no app is refused, naming the fix. Bundled mode only. A failure on one device does not stop the others, and its lane carries `failure` (line, error, screen). projectPath defaults to the Testing tab's project.",
inputSchema: {
- projectPath,
+ projectPath: projectPath.optional(),
relativePath: z.string().min(1).max(512).describe("The test to run, relative to the project."),
devices: z.array(z.object({
deviceId: deviceIdSchema.describe("An iOS simulator UDID, an Android serial, or an avd: id from the device lists."),
platform: z.enum(["ios", "android"]),
name: z.string().min(1).max(128).optional().describe("A label for the lane."),
})).min(1).max(16),
- apps: z.object({ ios: z.string().min(1).max(512).optional(), android: z.string().min(1).max(512).optional() })
- .describe("The app id per platform: the iOS bundle id and the Android package name."),
+ apps: z.object({ ios: z.string().min(1).max(512).optional(), android: z.string().min(1).max(512).optional() }).optional()
+ .describe("The app id per platform: the iOS bundle id and the Android package name. Defaults to the apps the test is pinned to."),
limit: z.number().int().min(1).max(MAX_MATRIX_LIMIT).optional().describe("How many devices run at once. Default 3."),
timeoutMs: z.number().int().min(10_000).max(30 * 60_000).optional(),
model: modelSchema.optional(),
untilSource: z.string().min(1).max(400_000).optional().describe("A truncated copy of the test to run instead of the file."),
},
annotations: destructive,
- _meta: appVisibility,
- }, safe(async (input: Omit & { devices: MatrixDevice[]; apps: { ios?: string; android?: string }; limit?: number }) => {
+ _meta: sharedVisibility,
+ }, safe(async (raw: Omit & { projectPath?: string; devices: MatrixDevice[]; apps?: { ios?: string; android?: string }; limit?: number }) => {
+ const projectPathValue = resolveProject(raw.projectPath);
+ const stored = await readTestTarget(projectPathValue, raw.relativePath).catch(() => undefined);
+ const apps: { ios?: string; android?: string } = { ...(stored ? { [stored.platform]: stored.bundleId, ...stored.apps } : {}), ...raw.apps };
+ const input = { ...raw, projectPath: projectPathValue, apps };
+ for (const platform of ["ios", "android"] as const) {
+ if (input.devices.some(device => device.platform === platform) && !apps[platform])
+ throw new ExpectedOperationError("app_unavailable", `This test has no ${platform} app yet. Ask the user to open the app on a ${platform} device, call mobile_testing_wait_for_app with platform "${platform}", pin the bundleId it returns with mobile_testing_set_target mode "add", then run again.`);
+ }
const unique = new Set(input.devices.map(device => device.deviceId));
if (unique.size !== input.devices.length) throw new ExpectedOperationError("invalid_input", "Each device can appear only once in a matrix.");
if (!matrix.ops) throw new ExpectedOperationError("unsupported_platform", "This server cannot prepare devices for a matrix run.");
@@ -412,9 +520,13 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
await devices.releaseOn(input.devices.map(device => device.deviceId)).catch(() => undefined);
const executor = createLaneExecutor({
ops: matrix.ops, apps: input.apps,
- runTest: (lane, deviceId, signal, onProgress) => runTest(
- { ...request, bundledTarget: { platform: lane.platform, bundleId: input.apps[lane.platform]!, device: deviceId } },
- { release: () => devices.releaseOn([lane.deviceId, deviceId]), onProgress, signal }),
+ runTest: async (lane, deviceId, signal, onProgress) => {
+ const result = await runTest(
+ { ...request, bundledTarget: { platform: lane.platform, bundleId: input.apps[lane.platform]!, device: deviceId } },
+ { release: () => devices.releaseOn([lane.deviceId, deviceId]), onProgress, signal });
+ await attachFailure(lane, result, request.untilSource ?? "", { deviceId, platform: lane.platform, projectPath: input.projectPath, runtimeRoot: project.runtime.root, bundleId: input.apps[lane.platform]! });
+ return result;
+ },
});
const { run } = launchMatrix(input.relativePath, input.devices, input.limit, executor);
return dataResult({ matrixId: run.matrixId, limit: run.limit, lanes: snapshotMatrix(run).lanes }, `Started ${run.lanes.length} lanes, up to ${run.limit} at once.`);
@@ -423,11 +535,12 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
registerAppTool(server, "mobile_testing_run_progress", {
title: "Read a run's progress",
description:
- "Read the lanes of a matrix run: each device's state (queued, booting, installing, running, passed, failed, cancelled, error), the steps it has started and finished so far, and its result. Without a matrixId it reads the latest run, whose first lane's steps are also returned as `progress`. Each step carries its index within its test, which is its position among the file's awaited calls.",
+ "Read the lanes of a matrix run: each device's state (queued, booting, installing, running, passed, failed, cancelled, error), the steps it has started and finished so far, and its result. Without a matrixId it reads the latest run, whose first lane's steps are also returned as `progress`. Each step carries its index within its test, which is its position among the file's awaited calls. A lane that failed carries `failure`: the failing line, its source and error, and the device's screen as locator rows (`role \"name\" → screen.getBy…`) to pick a replacement from. `running` is false once every lane has finished.",
inputSchema: { matrixId: z.string().min(1).max(128).optional() },
annotations: read,
- _meta: appVisibility,
+ _meta: sharedVisibility,
}, safe(async ({ matrixId }: { matrixId?: string }) => {
+ if (panel) resolveProject();
const run = matrixId ? registry.get(matrixId) : registry.latest();
if (matrixId && !run) throw new ExpectedOperationError("invalid_input", "That run is no longer available.");
if (!run) return dataResult({ running: false, progress: [], lanes: [], busyDevices: registry.busyDevices() });
@@ -440,13 +553,71 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
description: "Cancel one device's lane of a matrix run, or every lane that has not finished. A queued lane never starts; a running lane's process is stopped.",
inputSchema: { matrixId: z.string().min(1).max(128), deviceId: deviceIdSchema.optional().describe("Cancel only this device's lane.") },
annotations: write,
- _meta: appVisibility,
+ _meta: sharedVisibility,
}, safe(async ({ matrixId, deviceId }: { matrixId: string; deviceId?: string }) => {
+ if (panel) resolveProject();
if (!registry.get(matrixId)) throw new ExpectedOperationError("invalid_input", "That run is no longer available.");
const cancelled = registry.cancel(matrixId, deviceId);
return dataResult({ cancelled: cancelled.map(lane => lane.deviceId) }, `Cancelled ${cancelled.length} lane${cancelled.length === 1 ? "" : "s"}.`);
}));
+ registerAppTool(server, "mobile_testing_wait_for_app", {
+ title: "Wait for the user to open an app",
+ description:
+ "Wait until a booted device of one platform has an app in the foreground, and return that device and the app's bundleId; use it after asking the user to open the app on that platform, then pin the id with mobile_testing_set_target mode \"add\". Returns found: false with a message to relay to the user if nothing appears within timeoutMs (default 2 minutes). The home screen and launchers do not count.",
+ inputSchema: {
+ platform: z.enum(["ios", "android"]),
+ timeoutMs: z.number().int().min(100).max(10 * 60_000).optional().describe("How long to wait. Default 120000."),
+ },
+ annotations: read,
+ _meta: sharedVisibility,
+ }, safe(async ({ platform, timeoutMs }: { platform: "ios" | "android"; timeoutMs?: number }) => {
+ if (panel) resolveProject();
+ const ops = matrix.ops;
+ if (!ops?.bootedDevices || !ops.foregroundApp) throw new ExpectedOperationError("unsupported_platform", "This server cannot read what is on a device's screen.");
+ const deadline = Date.now() + (timeoutMs ?? 120_000);
+ let seen = 0;
+ for (;;) {
+ const booted = await ops.bootedDevices(platform).catch(() => []);
+ seen = booted.length;
+ for (const device of booted) {
+ const bundleId = await ops.foregroundApp(platform, device.deviceId).catch(() => null);
+ if (bundleId && !LAUNCHER_APP.test(bundleId)) return dataResult({ found: true, platform, deviceId: device.deviceId, deviceName: device.name, bundleId }, `${bundleId} is open on ${device.name}.`);
+ }
+ if (Date.now() >= deadline) break;
+ await new Promise(resolve => setTimeout(resolve, Math.min(matrix.pollMs ?? 1_500, Math.max(0, deadline - Date.now()))));
+ }
+ const label = platform === "ios" ? "iOS simulator" : "Android emulator";
+ const message = seen === 0
+ ? `No ${label} is booted. Ask the user to boot one and open the app on it.`
+ : `Nothing is open on the ${label}. Ask the user to open the app on it, then try again.`;
+ return dataResult({ found: false, timedOut: true, platform, message }, message);
+ }));
+
+ registerAppTool(server, "mobile_testing_branch_line", {
+ title: "Give one line its own locator for one platform",
+ description:
+ "Repair a Studio test for one platform: replace the locator on one line with `locator` on `platform` only, keeping the old locator for the other platform (`platform === \"android\" ? new : old`). The assertion or action on the line is never changed, and only the locator is. Take `locator` from a failed run's `failure.elements`, e.g. screen.getByText(\"Home\"). Writes the test and returns the new source; refuses, naming why, when the line cannot be rewritten with certainty (a multi-line call, no locator on the line). projectPath defaults to the Testing tab's project.",
+ inputSchema: {
+ projectPath: projectPath.optional(),
+ relativePath: z.string().min(1).max(512).describe("The Studio test, e.g. tests/checkout.e2e.ts."),
+ line: z.number().int().min(1).max(100_000).describe("The 1-based line of the failing step, from the run's failure.line."),
+ platform: z.enum(["ios", "android"]).describe("The platform whose run failed. The other platform keeps its locator."),
+ locator: z.string().min(1).max(1000).describe("A single screen.getBy… locator expression."),
+ },
+ annotations: destructive,
+ _meta: sharedVisibility,
+ }, safe(async ({ projectPath: selected, relativePath, line, platform, locator }: { projectPath?: string; relativePath: string; line: number; platform: "ios" | "android"; locator: string }) => {
+ const project = resolveProject(selected);
+ if ((await inspectProject(project)).runtimeMode !== "bundled") throw new ExpectedOperationError("invalid_input", "Branching a line is for Studio tests; edit a project test in its own file.");
+ if (!singleExpression(locator) || !locator.startsWith("screen.")) throw new ExpectedOperationError("invalid_input", "locator must be one screen.getBy… expression on a single line.");
+ const source = await readTestFile(project, relativePath);
+ const next = branchStoredStepLocator(source, line, platform, locator);
+ if (next === source) throw new ExpectedOperationError("invalid_input", `Line ${line} of ${relativePath} cannot be rewritten: it is not a single-line step with a locator. Read the test with mobile_testing_read_file and check the line.`);
+ await writeTestFile(project, relativePath, next, true);
+ return dataResult({ relativePath, line, platform, source: next }, `Line ${line} of ${relativePath} now uses ${locator} on ${platform}.`);
+ }));
+
registerAppTool(server, "mobile_testing_release_device", {
title: "Release the recorder's device",
description:
diff --git a/packages/core/test/mobile-dev-skill.test.ts b/packages/core/test/mobile-dev-skill.test.ts
index 0f221c39..9f8c72b4 100644
--- a/packages/core/test/mobile-dev-skill.test.ts
+++ b/packages/core/test/mobile-dev-skill.test.ts
@@ -28,8 +28,8 @@ test("the testing skill records, hands over, and never saves or runs", async ()
// screen read reported no selector for.
assert.match(skill, /## Never write a locator/);
assert.match(skill, /no `selector` at all/);
- assert.match(skill, /\*\*Never save\.\*\*/);
- assert.match(skill, /\*\*Never run the test\.\*\*/);
+ assert.match(skill, /\*\*Never save\*\* a project's test/);
+ assert.match(skill, /\*\*Never run the test\*\* while recording/);
// And the handover, which is the whole deliverable: the user adjusts and saves.
assert.match(skill, /in the Testing panel, unsaved/);
});
@@ -58,3 +58,22 @@ test("the testing skill ships from every plugin that has the panel", async () =>
const claude = JSON.parse(await readFile(new URL("../../../apps/claude/plugin-host.json", import.meta.url), "utf8"));
assert.ok(claude.skills.includes("../../packages/skills/mobile-dev-testing"), "Claude Code");
});
+
+test("the testing skill teaches Studio mode: record saves, run, add the missing app, repair by locator only", async () => {
+ const skill = await readFile(new URL("../../skills/mobile-dev-testing/SKILL.md", import.meta.url), "utf8");
+
+ assert.match(skill, /## Studio mode: record, run, repair/);
+ // The tab must be open, and the agent says so rather than guessing a project.
+ assert.match(skill, /tell the user to \*\*open Mobile Dev's Testing tab\*\*/);
+ // Record now saves, and says where.
+ assert.match(skill, /`mobile_testing_agent_finish` \*\*writes the test\*\*.*`relativePath`/s);
+ // Run: one device or several, and devices that are off are the matrix's to boot.
+ assert.match(skill, /`mobile_testing_run_matrix/);
+ assert.match(skill, /\*\*Devices that are off are booted by the matrix\*\*/);
+ // A platform with no app: ask, wait, add without asking, report the id, run again.
+ assert.match(skill, /mobile_testing_wait_for_app.*mobile_testing_set_target.*mode: "add".*\*\*without asking\*\*.*which id you added/s);
+ // Failure: branch that platform's line only, two tries, then report; never touch an assertion.
+ assert.match(skill, /mobile_testing_branch_line/);
+ assert.match(skill, /\*\*At most two tries per failure\.\*\*.*likely app\s+bug/s);
+ assert.match(skill, /\*\*Never weaken or remove an assertion\*\*/);
+});
diff --git a/packages/core/test/testing-agent-panel.test.ts b/packages/core/test/testing-agent-panel.test.ts
index 7c55c1a1..0c145a83 100644
--- a/packages/core/test/testing-agent-panel.test.ts
+++ b/packages/core/test/testing-agent-panel.test.ts
@@ -28,9 +28,11 @@ async function panelEnvironment(t: Parameters[0]) {
});
const calls: { name: string; arguments: Record }[] = [];
const agent: Record = { active: false, status: "idle", revision: 0, title: "", goal: "", steps: [], note: "", error: "" };
+ const responses: Record unknown> = {};
const host = {
callServerTool: async (request: { name: string; arguments: Record }) => {
calls.push(request);
+ if (responses[request.name]) return { content: [], structuredContent: responses[request.name]!() };
if (request.name === "mobile_testing_agent_state") return { content: [], structuredContent: { ...agent } };
if (request.name === "mobile_testing_projects") return { content: [], structuredContent: { projects: [] } };
return { content: [], structuredContent: {} };
@@ -48,7 +50,7 @@ async function panelEnvironment(t: Parameters[0]) {
const extra: (() => Promise | void)[] = [];
onTeardown(async () => { for (const fn of extra.reverse()) await fn(); panel.dispose(); });
const tick = async () => { await new Promise(resolve => setTimeout(resolve, 0)); await new Promise(resolve => setTimeout(resolve, 0)); };
- return { ...module, dom, onTeardown: (fn: () => Promise | void) => { extra.push(fn); }, panel, calls, agent, tick,
+ return { ...module, dom, onTeardown: (fn: () => Promise | void) => { extra.push(fn); }, panel, host, deviceApps, calls, agent, tick, responses,
setDevice: (next: unknown) => { snapshot = { device: next } as never; for (const listener of listeners) listener(); } };
}
@@ -167,3 +169,86 @@ test("the banner says who is driving, and its Stop is the one beside the goal",
assert.match(dom.window.document.querySelector("[data-testing-agent-handover]")?.textContent ?? "",
/The agent finished recording 1 step — 4 landmarks\. Nothing has been saved or run/);
});
+
+const lane = (state: string, extra: Record = {}) => ({ runId: `run-${state}`, deviceId: "d1", deviceName: "iPhone", platform: "ios", state, progress: [], ...extra });
+const wire = (running: boolean, state: string, matrixId = "m1") => ({ matrixId, testPath: "tests/flow.e2e.ts", lanes: [lane(state)], limit: 3, startedAt: 1, running });
+
+test("a run the agent starts shows as live lanes, locks editing, and frees it when the lanes finish", async t => {
+ const { panel, responses, tick } = await panelEnvironment(t);
+ panel.setAvailable(true);
+ await tick();
+ (panel as any).update({ projectPath: "/studio", runtimeMode: "bundled" });
+ assert.equal(panel.agentBusy, false);
+
+ responses.mobile_testing_run_progress = () => wire(true, "running");
+ await (panel as any).readAgentState();
+ assert.equal(panel.getSnapshot().agentRun, true);
+ assert.equal(panel.getSnapshot().matrix.lanes[0].state, "running", "the agent's lanes are the lanes on screen");
+ assert.equal(panel.agentBusy, true, "editing locks the way it does while the agent records");
+ assert.equal(panel.canRun, false);
+ assert.equal(panel.canRunStored, false);
+ panel.dismissMatrix();
+ assert.ok(panel.getSnapshot().matrix, "a live run cannot be dismissed");
+
+ responses.mobile_testing_run_progress = () => wire(false, "passed");
+ await (panel as any).readAgentState();
+ assert.equal(panel.getSnapshot().agentRun, false);
+ assert.equal(panel.getSnapshot().matrix.lanes[0].state, "passed", "the result stays on screen to read");
+ assert.equal(panel.agentBusy, false);
+
+ // The same finished run is not adopted again, and a run the panel did not see running never is.
+ await (panel as any).readAgentState();
+ assert.equal(panel.getSnapshot().agentRun, false);
+});
+
+test("the panel's own run is never taken over by the poll", async t => {
+ const { panel, responses, tick } = await panelEnvironment(t);
+ panel.setAvailable(true);
+ await tick();
+ (panel as any).update({ projectPath: "/studio", runtimeMode: "bundled", running: true });
+ responses.mobile_testing_run_progress = () => wire(true, "running", "theirs");
+ await (panel as any).readAgentState();
+ assert.equal(panel.getSnapshot().agentRun, false);
+ assert.equal(panel.getSnapshot().matrix, null);
+});
+
+test("a recording the agent saved in Studio refreshes the test list instead of adopting a draft", async t => {
+ const { panel, agent, tick, calls, testRecorder } = await panelEnvironment(t);
+ panel.setAvailable(true);
+ await tick();
+ Object.assign(agent, { active: true, status: "recording", revision: 1, title: "t", goal: "g", steps: [step("a", "Tap")] });
+ await (panel as any).readAgentState();
+ const before = calls.filter(entry => entry.name === "mobile_testing_tests").length;
+ (panel as any).update({ projectPath: "/studio", runtimeMode: "bundled" });
+ Object.assign(agent, { active: false, status: "finished", revision: 2, note: "n", savedPath: "tests/t.e2e.ts" });
+ await (panel as any).readAgentState();
+ await tick();
+ assert.equal(panel.getSnapshot().agent.savedPath, "tests/t.e2e.ts");
+ assert.equal(panel.getSnapshot().savedPath, "Studio/tests/t.e2e.ts");
+ assert.equal(panel.getSnapshot().draftId, "", "there is no draft: the test is saved");
+ assert.ok(calls.filter(entry => entry.name === "mobile_testing_tests").length > before, "the stored list is read again so the test appears");
+ assert.equal(testRecorder.getSnapshot().recordingDeviceId, "");
+});
+
+test("an open, visible tab re-sends its selection on a heartbeat, and tells the server when it goes", async t => {
+ const { TestingPanel, host, deviceApps, calls, tick } = await panelEnvironment(t);
+ const beating = new TestingPanel(host, deviceApps, { heartbeatMs: 10 });
+ const context = () => calls.filter(entry => entry.name === "mobile_testing_set_context");
+ beating.setAvailable(true);
+ await tick();
+ const initial = context().length;
+ // Closed (not shown): nothing is sent, so the server lets the report age out.
+ await new Promise(resolve => setTimeout(resolve, 60));
+ assert.equal(context().length, initial, "a tab that is not showing does not claim to be open");
+ beating.show();
+ await new Promise(resolve => setTimeout(resolve, 80));
+ assert.ok(context().length >= initial + 3, "the same selection is re-sent while the tab is open, which is what keeps it alive");
+ beating.hide();
+ await tick();
+ const hidden = context().length;
+ await new Promise(resolve => setTimeout(resolve, 60));
+ assert.equal(context().length, hidden, "hiding stops the heartbeat");
+ beating.dispose();
+ await tick();
+ assert.deepEqual(context().at(-1)?.arguments, { projectPath: "", deviceId: "", bundleId: "" }, "leaving clears the context on a best-effort basis");
+});
diff --git a/packages/core/test/testing-prepare.test.ts b/packages/core/test/testing-prepare.test.ts
index 26e21243..4ab46e1c 100644
--- a/packages/core/test/testing-prepare.test.ts
+++ b/packages/core/test/testing-prepare.test.ts
@@ -116,3 +116,18 @@ test("system ops copy a split APK with install-multiple and an iOS app with get_
await ops.copyApp("ios", "11111111-1111-4111-8111-111111111111", "22222222-2222-4222-8222-222222222222", "com.app", controller.signal);
assert.deepEqual(calls.at(-1), ["xcrun", "simctl", "install", "22222222-2222-4222-8222-222222222222", "/sim/App.app"]);
});
+
+test("the system ops list only the booted devices of a platform and read the foreground app through the given reader", async () => {
+ const status = (devices: unknown[]) => ({ list: async () => ({ connected: true, managed: false, baseUrl: "", devices }) }) as never;
+ const asked: [string, string][] = [];
+ const ops = systemDeviceOps({
+ simulators: status([{ udid: "A", name: "iPhone", state: "Booted", runtime: "iOS" }, { udid: "B", name: "Off", state: "Shutdown", runtime: "iOS" }]),
+ android: status([{ udid: "emulator-5554", name: "Pixel", state: "Booted", runtime: "", platform: "android", kind: "emulator" }, { udid: "avd:x", name: "Cold", state: "Shutdown", runtime: "", platform: "android", kind: "emulator" }]),
+ drivers: (() => ({})) as never,
+ foreground: async (platform, deviceId) => { asked.push([platform, deviceId]); return "com.example"; },
+ });
+ assert.deepEqual(await ops.bootedDevices!("ios"), [{ deviceId: "A", name: "iPhone" }]);
+ assert.deepEqual(await ops.bootedDevices!("android"), [{ deviceId: "emulator-5554", name: "Pixel" }]);
+ assert.equal(await ops.foregroundApp!("android", "emulator-5554"), "com.example");
+ assert.deepEqual(asked, [["android", "emulator-5554"]]);
+});
diff --git a/packages/core/test/testing-studio-agent.test.ts b/packages/core/test/testing-studio-agent.test.ts
new file mode 100644
index 00000000..9b75aad3
--- /dev/null
+++ b/packages/core/test/testing-studio-agent.test.ts
@@ -0,0 +1,387 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { mkdtemp, rm } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { TestingAgentRecordings, registerTestingAgentTools } from "../src/testing-agent.ts";
+import { registerTestingTools } from "../src/testing-tools.ts";
+import { MatrixRegistry } from "../src/testing-matrix.ts";
+import { TestDraftStore } from "../src/testing-drafts.ts";
+import { compactElements, describeFailure, failedStep } from "../src/testing-failure.ts";
+import { listTestFiles, readTestFile, readTestTarget, studioWorkspacePath, writeTestFile, writeTestTarget } from "../src/testing-projects.ts";
+import type { DeviceOps } from "../src/testing-prepare.ts";
+import type { TestRunResult } from "../src/testing-run.ts";
+import type { TestingDevices } from "../src/testing-device.ts";
+
+const SOURCE = `import { test } from "@e2e-dev/mobile";
+import { expect } from "e2e";
+
+test("flow", async ({ app, screen }) => {
+ await app.open();
+ await screen.getByTestId("Home").tap();
+ await expect(screen.getByTestId("Home")).toBeVisible();
+});
+`;
+
+type Tool = { config: Record; handler: (input: any) => Promise };
+
+/** A server that only remembers what was registered, so a test can call a tool as the model would. */
+function fakeServer() {
+ const tools = new Map();
+ const server = { registerTool: (name: string, config: Record, handler: Tool["handler"]) => { tools.set(name, { config, handler }); }, registerResource: () => undefined } as never;
+ const call = async (name: string, input: Record = {}) => tools.get(name)!.handler(input);
+ return { server, tools, call };
+}
+
+/** Runs `body` with Studio's storage in a temp folder, so nothing touches the user's own tests. */
+async function withStudio(body: (studio: string) => Promise) {
+ const root = await mkdtemp(join(tmpdir(), "studio-agent-"));
+ const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
+ process.env.MOBILE_DEV_TESTING_DIRECTORY = root;
+ try { await body(studioWorkspacePath()); }
+ finally {
+ if (previous === undefined) delete process.env.MOBILE_DEV_TESTING_DIRECTORY; else process.env.MOBILE_DEV_TESTING_DIRECTORY = previous;
+ await rm(root, { recursive: true, force: true });
+ }
+}
+
+const PROJECTS = { list: async () => [], choose: async () => undefined, record: async () => undefined } as never;
+const NO_DEVICES = { release: async () => undefined, releaseOn: async () => undefined, read: async () => { throw new Error("no device"); } } as unknown as TestingDevices;
+
+function setup(options: { ops?: DeviceOps; run?: (...args: any[]) => Promise; devices?: TestingDevices; pollMs?: number; panel?: boolean } = {}) {
+ const { server, tools, call } = fakeServer();
+ const devices = options.devices ?? NO_DEVICES;
+ const recordings = new TestingAgentRecordings(devices, new TestDraftStore(join(tmpdir(), `drafts-${process.pid}`)));
+ const registry = new MatrixRegistry();
+ registerTestingTools(server, PROJECTS, devices, undefined, {
+ registry, ...(options.ops ? { ops: options.ops } : {}), ...(options.run ? { run: options.run as never } : {}),
+ ...(options.pollMs ? { pollMs: options.pollMs } : {}), ...(options.panel === false ? {} : { panel: recordings }),
+ });
+ registerTestingAgentTools(server, devices, recordings);
+ return { tools, call, recordings, registry };
+}
+
+const MODEL_TOOLS = ["run_test", "run_matrix", "run_progress", "cancel", "set_target", "read_file", "tests", "wait_for_app", "branch_line"];
+const APP_ONLY = ["write_file", "stage_file", "save_staged_file", "discard_staged_file", "delete_file", "release_device", "projects", "choose_project", "project_config", "read_tree", "drafts", "setup_apply"];
+
+test("the tools an agent drives Studio with are model-visible; writing and deleting files stay the panel's", () => {
+ const { tools } = setup();
+ for (const name of MODEL_TOOLS) assert.deepEqual(tools.get(`mobile_testing_${name}`)?.config._meta?.ui?.visibility, ["app", "model"], name);
+ for (const name of APP_ONLY) assert.deepEqual(tools.get(`mobile_testing_${name}`)?.config._meta?.ui?.visibility, ["app"], name);
+});
+
+test("every model-visible tool refuses until the Testing tab has reported a project, then defaults to it", async () => {
+ await withStudio(async studio => {
+ const { call, recordings } = setup({ ops: {} as never });
+ const inputs: Record> = {
+ run_test: { relativePath: "tests/a.e2e.ts" }, run_matrix: { relativePath: "tests/a.e2e.ts", devices: [{ deviceId: "d", platform: "ios" }] },
+ run_progress: {}, cancel: { matrixId: "x" }, set_target: { relativePath: "tests/a.e2e.ts", platform: "ios", bundleId: "a" },
+ read_file: { relativePath: "tests/a.e2e.ts" }, tests: {}, wait_for_app: { platform: "ios", timeoutMs: 100 },
+ branch_line: { relativePath: "tests/a.e2e.ts", line: 6, platform: "android", locator: 'screen.getByText("x")' },
+ };
+ for (const name of MODEL_TOOLS) {
+ const result = await call(`mobile_testing_${name}`, inputs[name]);
+ assert.equal(result.isError, true, name);
+ assert.match(result.content[0].text, /Testing tab is not open/, name);
+ }
+ await writeTestFile(studio, "tests/a.e2e.ts", SOURCE);
+ recordings.setPanelProject(studio);
+ const listed = await call("mobile_testing_tests");
+ assert.equal(listed.isError, undefined);
+ assert.deepEqual(listed.structuredContent.tests.map((entry: any) => entry.relativePath), ["tests/a.e2e.ts"]);
+ const read = await call("mobile_testing_read_file", { relativePath: "tests/a.e2e.ts" });
+ assert.match(read.structuredContent.source, /app\.open/);
+ recordings.setPanelProject("");
+ assert.equal((await call("mobile_testing_tests")).isError, true, "a panel that reports no project is a closed tab");
+ });
+});
+
+test("set_target add pins the other platform's app and reports the id it added", async () => {
+ await withStudio(async studio => {
+ const { call, recordings } = setup();
+ recordings.setPanelProject(studio);
+ await writeTestFile(studio, "tests/a.e2e.ts", SOURCE);
+ await writeTestTarget(studio, "tests/a.e2e.ts", { platform: "ios", bundleId: "com.app" });
+ const result = await call("mobile_testing_set_target", { relativePath: "tests/a.e2e.ts", platform: "android", bundleId: "com.app.android", mode: "add" });
+ assert.deepEqual(result.structuredContent.added, { platform: "android", bundleId: "com.app.android", mode: "add" });
+ assert.match(result.content[0].text, /android com\.app\.android/);
+ assert.deepEqual(await readTestTarget(studio, "tests/a.e2e.ts"), { platform: "ios", bundleId: "com.app", apps: { android: "com.app.android" } });
+ });
+});
+
+// ---- finish saves ------------------------------------------------------------------------------------------------
+
+const TREE = {
+ screen: { width: 402, height: 874 },
+ tree: [{ nodeId: "home", name: "Home", role: "button", label: "Home", bounds: { x: 0, y: 100, width: 300, height: 40 }, depth: 0, source: "accessibility" as const }],
+ refs: { home: "e-home" },
+};
+const fakeTreeDevices = () => ({ read: async () => TREE, perform: async () => undefined, release: async () => undefined, releaseOn: async () => undefined }) as unknown as TestingDevices;
+
+async function recordHome(recordings: TestingAgentRecordings, studio: string, title = "the home screen") {
+ recordings.setContext({ projectPath: studio, deviceId: "11111111-2222-3333-4444-555555555555", platform: "android", bundleId: "com.app.android" });
+ recordings.begin({ title, goal: "g" });
+ const screen = await recordings.screen();
+ await recordings.step({ ref: screen.elements[0]!.ref, kind: "assertVisible" });
+ return recordings.finish({ note: "n" });
+}
+
+test("finishing in Studio saves the test, pinned to the recorded platform and app, and returns its path", async () => {
+ await withStudio(async studio => {
+ const recordings = new TestingAgentRecordings(fakeTreeDevices(), new TestDraftStore(join(studio, "drafts")));
+ const result = await recordHome(recordings, studio);
+ assert.equal(result.saved, true);
+ assert.equal(result.relativePath, "tests/the-home-screen.e2e.ts");
+ assert.equal(result.path, "Studio/tests/the-home-screen.e2e.ts");
+ assert.match(result.next, /mobile_testing_run_matrix/);
+ assert.equal(await readTestFile(studio, "tests/the-home-screen.e2e.ts"), result.source);
+ assert.deepEqual(await readTestTarget(studio, "tests/the-home-screen.e2e.ts"), { platform: "android", bundleId: "com.app.android" });
+ // The panel's list reads this folder, so the test is listed.
+ assert.deepEqual((await listTestFiles(studio)).map(entry => entry.relativePath), ["tests/the-home-screen.e2e.ts"]);
+ const state = recordings.state();
+ assert.equal(state.savedPath, "tests/the-home-screen.e2e.ts");
+ assert.equal(state.draftId, "", "a saved test is not also an unsaved draft");
+ assert.equal(await new TestDraftStore(join(studio, "drafts")).list(studio).then(list => list.length), 0);
+ });
+});
+
+test("a second recording with the same title is a new test, never a replacement", async () => {
+ await withStudio(async studio => {
+ const recordings = new TestingAgentRecordings(fakeTreeDevices(), new TestDraftStore(join(studio, "drafts")));
+ const first = await recordHome(recordings, studio);
+ const second = await recordHome(recordings, studio);
+ assert.equal(first.relativePath, "tests/the-home-screen.e2e.ts");
+ assert.equal(second.relativePath, "tests/the-home-screen-2.e2e.ts");
+ assert.equal((await listTestFiles(studio)).length, 2);
+ });
+});
+
+test("an empty recording saves nothing", async () => {
+ await withStudio(async studio => {
+ const recordings = new TestingAgentRecordings(fakeTreeDevices(), new TestDraftStore(join(studio, "drafts")));
+ recordings.setContext({ projectPath: studio, deviceId: "11111111-2222-3333-4444-555555555555", platform: "ios", bundleId: "com.app" });
+ recordings.begin({ title: "nothing", goal: "g" });
+ const result = await recordings.finish({});
+ assert.equal(result.saved, false);
+ assert.deepEqual(await listTestFiles(studio), []);
+ });
+});
+
+// ---- wait_for_app ------------------------------------------------------------------------------------------------
+
+function appOps(script: Record, booted: { deviceId: string; name: string }[] = [{ deviceId: "emulator-5554", name: "Pixel" }]): DeviceOps {
+ const seen = new Map();
+ return {
+ isBooted: async () => true, boot: async (_p, id) => id, hasApp: async () => true, copyApp: async () => undefined, launch: async () => undefined,
+ bootedDevices: async platform => platform === "android" ? booted : [],
+ foregroundApp: async (_platform, id) => { const index = seen.get(id) ?? 0; seen.set(id, index + 1); const steps = script[id] ?? [null]; return steps[Math.min(index, steps.length - 1)] ?? null; },
+ };
+}
+
+test("wait_for_app returns the app once one is in the foreground, skipping the home screen and launchers", async () => {
+ await withStudio(async studio => {
+ const { call, recordings } = setup({ ops: appOps({ "emulator-5554": [null, "com.google.android.apps.nexuslauncher", "com.example.shop"] }), pollMs: 5 });
+ recordings.setPanelProject(studio);
+ const result = await call("mobile_testing_wait_for_app", { platform: "android", timeoutMs: 5_000 });
+ assert.deepEqual(result.structuredContent, { found: true, platform: "android", deviceId: "emulator-5554", deviceName: "Pixel", bundleId: "com.example.shop" });
+ const ios = await call("mobile_testing_wait_for_app", { platform: "ios", timeoutMs: 100 });
+ assert.equal(ios.structuredContent.found, false, "iOS has no booted device in this script");
+ });
+});
+
+test("wait_for_app times out with a message the agent can relay, saying what is missing", async () => {
+ await withStudio(async studio => {
+ const none = setup({ ops: appOps({}, []), pollMs: 5 });
+ none.recordings.setPanelProject(studio);
+ const noDevice = await none.call("mobile_testing_wait_for_app", { platform: "android", timeoutMs: 100 });
+ assert.equal(noDevice.isError, undefined, "waiting out is not a failure");
+ assert.equal(noDevice.structuredContent.timedOut, true);
+ assert.match(noDevice.structuredContent.message, /No Android emulator is booted/);
+
+ const idle = setup({ ops: appOps({ "emulator-5554": ["com.android.systemui"] }), pollMs: 5 });
+ idle.recordings.setPanelProject(studio);
+ const noApp = await idle.call("mobile_testing_wait_for_app", { platform: "android", timeoutMs: 100 });
+ assert.match(noApp.structuredContent.message, /Nothing is open on the Android emulator\. Ask the user to open the app/);
+ });
+});
+
+// ---- branch_line -------------------------------------------------------------------------------------------------
+
+test("branch_line gives one platform its own locator on one line, writes it, and returns the source", async () => {
+ await withStudio(async studio => {
+ const { call, recordings } = setup();
+ recordings.setPanelProject(studio);
+ await writeTestFile(studio, "tests/a.e2e.ts", SOURCE);
+ const result = await call("mobile_testing_branch_line", { relativePath: "tests/a.e2e.ts", line: 7, platform: "android", locator: 'screen.getByText("Home")' });
+ assert.equal(result.isError, undefined);
+ const written = await readTestFile(studio, "tests/a.e2e.ts");
+ assert.equal(result.structuredContent.source, written);
+ assert.match(written, /await expect\(platform === "android" \? screen\.getByText\("Home"\) : screen\.getByTestId\("Home"\)\)\.toBeVisible\(\);/);
+ // The assertion is the same assertion, and the line above is untouched.
+ assert.match(written, /await screen\.getByTestId\("Home"\)\.tap\(\);/);
+ assert.match(written, /async \(\{ app, screen, platform \}\)/, "the platform fixture is added for the branch to read");
+ });
+});
+
+test("branch_line refuses a line it cannot rewrite, and a locator that is not one expression", async () => {
+ await withStudio(async studio => {
+ const { call, recordings } = setup();
+ recordings.setPanelProject(studio);
+ await writeTestFile(studio, "tests/a.e2e.ts", SOURCE);
+ const before = await readTestFile(studio, "tests/a.e2e.ts");
+ const input = { relativePath: "tests/a.e2e.ts", platform: "android", locator: 'screen.getByText("Home")' };
+ const notAStep = await call("mobile_testing_branch_line", { ...input, line: 1 });
+ assert.equal(notAStep.isError, true);
+ assert.match(notAStep.content[0].text, /Line 1 .* cannot be rewritten/);
+ const appOpen = await call("mobile_testing_branch_line", { ...input, line: 5 });
+ assert.equal(appOpen.isError, true, "app.open has no locator");
+ for (const locator of ['screen.getByText("a"); process.exit()', 'screen.getByText("a")\nawait x', "tapAt(1)", 'screen.getByText("a"']) {
+ const refused = await call("mobile_testing_branch_line", { ...input, line: 7, locator });
+ assert.equal(refused.isError, true, locator);
+ assert.match(refused.content[0].text, /one screen\.getBy/);
+ }
+ assert.equal(await readTestFile(studio, "tests/a.e2e.ts"), before, "a refused branch writes nothing");
+ // A `;` inside a string is text, not a second statement.
+ const fine = await call("mobile_testing_branch_line", { ...input, line: 7, locator: 'screen.getByText("Save; exit")' });
+ assert.equal(fine.isError, undefined);
+ });
+});
+
+// ---- failure context ---------------------------------------------------------------------------------------------
+
+const FAILED: TestRunResult = {
+ status: "failed", exitCode: 1, error: "Locator not found: getByTestId(\"Home\")",
+ steps: [
+ { line: 6, api: "locator.tap", label: "tap", status: "passed" },
+ { line: 7, api: "expect.toBeVisible", label: "toBeVisible", status: "failed", error: "Element not found" },
+ ],
+};
+
+test("the failure carries the failing line and the screen as locator rows", () => {
+ assert.equal(failedStep(FAILED.steps)?.line, 7);
+ assert.equal(describeFailure({ ...FAILED, status: "passed" }, SOURCE), undefined);
+ assert.deepEqual(describeFailure(FAILED, SOURCE), { line: 7, source: 'await expect(screen.getByTestId("Home")).toBeVisible();', error: "Element not found" });
+ // No step of its own, e.g. the app would not open: the run's error stands in, with no line.
+ assert.deepEqual(describeFailure({ status: "failed", exitCode: 1, steps: [], error: "app.open failed" }, SOURCE), { line: 0, source: "", error: "app.open failed" });
+
+ const { elements, omitted } = compactElements(TREE.tree, TREE.screen, 5);
+ assert.deepEqual(elements, ['button "Home" → screen.getByRole("button", "Home")']);
+ assert.equal(omitted, 0);
+});
+
+async function studioWithTest(studio: string) {
+ await writeTestFile(studio, "tests/a.e2e.ts", SOURCE);
+ await writeTestTarget(studio, "tests/a.e2e.ts", { platform: "ios", bundleId: "com.app" });
+ await writeTestTarget(studio, "tests/a.e2e.ts", { platform: "android", bundleId: "com.app.android" }, "add");
+}
+
+test("run_test on a failing test reports the failing line and the device's screen without another call", async () => {
+ await withStudio(async studio => {
+ const reads: unknown[] = [];
+ const devices = { read: async (target: unknown) => { reads.push(target); return TREE; }, release: async () => undefined, releaseOn: async () => undefined } as unknown as TestingDevices;
+ const { call, recordings } = setup({ devices, run: async () => FAILED });
+ recordings.setPanelProject(studio);
+ recordings.setContext({ projectPath: studio, deviceId: "11111111-2222-3333-4444-555555555555", platform: "ios", bundleId: "com.app" });
+ await studioWithTest(studio);
+ const result = await call("mobile_testing_run_test", { relativePath: "tests/a.e2e.ts" });
+ assert.equal(result.isError, undefined);
+ assert.equal(result.structuredContent.status, "failed");
+ assert.equal(result.structuredContent.failure.line, 7);
+ assert.match(result.structuredContent.failure.source, /toBeVisible/);
+ assert.deepEqual(result.structuredContent.failure.elements, ['button "Home" → screen.getByRole("button", "Home")']);
+ assert.equal((reads[0] as any).bundleId, "com.app", "it ran the app the test is pinned to, with no platform given");
+ });
+});
+
+test("a passing run has no failure, and a device that cannot be read still reports the line", async () => {
+ await withStudio(async studio => {
+ const passing = setup({ run: async () => ({ status: "passed", exitCode: 0, steps: [] }) });
+ passing.recordings.setPanelProject(studio);
+ await studioWithTest(studio);
+ assert.equal((await passing.call("mobile_testing_run_test", { relativePath: "tests/a.e2e.ts" })).structuredContent.failure, undefined);
+
+ const failing = setup({ run: async () => FAILED });
+ failing.recordings.setPanelProject(studio);
+ const result = await failing.call("mobile_testing_run_test", { relativePath: "tests/a.e2e.ts" });
+ assert.equal(result.structuredContent.failure.line, 7);
+ assert.match(result.structuredContent.failure.elementsError, /runner chose the device/);
+ });
+});
+
+test("run_matrix defaults the apps from the test's pins and each failed lane carries its own device's screen", async () => {
+ await withStudio(async studio => {
+ const readFor: string[] = [];
+ const devices = { read: async (target: { deviceId: string }) => { readFor.push(target.deviceId); return TREE; }, release: async () => undefined, releaseOn: async () => undefined } as unknown as TestingDevices;
+ const ran: any[] = [];
+ const run = async (request: any) => { ran.push(request.bundledTarget); return request.bundledTarget.platform === "ios" ? ({ status: "passed", exitCode: 0, steps: [] } as TestRunResult) : FAILED; };
+ const { call, recordings, registry } = setup({ devices, run, ops: appOps({}) });
+ recordings.setPanelProject(studio);
+ await studioWithTest(studio);
+ const started = await call("mobile_testing_run_matrix", { relativePath: "tests/a.e2e.ts", devices: [
+ { deviceId: "11111111-2222-3333-4444-555555555555", platform: "ios", name: "iPhone" },
+ { deviceId: "emulator-5554", platform: "android", name: "Pixel" },
+ ] });
+ assert.equal(started.isError, undefined, started.content?.[0]?.text);
+ const run_ = registry.get(started.structuredContent.matrixId)!;
+ for (let index = 0; index < 200 && run_.lanes.some(entry => !["passed", "failed", "error", "cancelled"].includes(entry.state)); index++) await new Promise(resolve => setTimeout(resolve, 5));
+ const progress = await call("mobile_testing_run_progress", { matrixId: started.structuredContent.matrixId });
+ const [ios, android] = progress.structuredContent.lanes;
+ assert.equal(progress.structuredContent.running, false);
+ assert.equal(ios.state, "passed");
+ assert.equal(ios.failure, undefined);
+ assert.equal(android.state, "failed");
+ assert.equal(android.failure.line, 7);
+ assert.equal(android.failure.elements.length, 1);
+ assert.deepEqual(readFor, ["emulator-5554"], "only the failed lane's device is read");
+ assert.deepEqual(ran.map(entry => [entry.platform, entry.bundleId]).sort(), [["android", "com.app.android"], ["ios", "com.app"]]);
+ });
+});
+
+test("run_matrix names the fix when a platform has no app yet, and refuses before booting anything", async () => {
+ await withStudio(async studio => {
+ let booted = 0;
+ const ops = { ...appOps({}), boot: async (_p: string, id: string) => { booted++; return id; } } as DeviceOps;
+ const { call, recordings } = setup({ ops, run: async () => FAILED });
+ recordings.setPanelProject(studio);
+ await writeTestFile(studio, "tests/a.e2e.ts", SOURCE);
+ await writeTestTarget(studio, "tests/a.e2e.ts", { platform: "ios", bundleId: "com.app" });
+ const result = await call("mobile_testing_run_matrix", { relativePath: "tests/a.e2e.ts", devices: [{ deviceId: "emulator-5554", platform: "android" }] });
+ assert.equal(result.isError, true);
+ assert.match(result.content[0].text, /no android app yet.*open the app.*mobile_testing_wait_for_app.*mobile_testing_set_target mode "add".*run again/s);
+ assert.equal(booted, 0);
+ });
+});
+
+test("a tab that stops reporting is closed: open, then stale, then refused, and a heartbeat revives it", async () => {
+ await withStudio(async studio => {
+ let clock = 1_000;
+ const { server, call } = fakeServer();
+ const recordings = new TestingAgentRecordings(fakeTreeDevices(), new TestDraftStore(join(studio, "drafts")), { now: () => clock, expiryMs: 15_000 });
+ registerTestingTools(server, PROJECTS, fakeTreeDevices(), undefined, { registry: new MatrixRegistry(), panel: recordings });
+ registerTestingAgentTools(server, fakeTreeDevices(), recordings);
+ const report = () => call("mobile_testing_set_context", { projectPath: studio, deviceId: "11111111-2222-3333-4444-555555555555", platform: "ios", bundleId: "com.app" });
+
+ await report();
+ assert.equal((await call("mobile_testing_tests")).isError, undefined, "open");
+ clock += 14_000;
+ assert.equal((await call("mobile_testing_tests")).isError, undefined, "still within the expiry");
+
+ clock += 2_000;
+ const stale = await call("mobile_testing_tests");
+ assert.equal(stale.isError, true, "stale");
+ assert.match(stale.content[0].text, /Testing tab is not open/);
+ assert.equal(recordings.panelContext(), undefined, "the device selection goes with it");
+ assert.throws(() => recordings.begin({ title: "t", goal: "g" }), /Testing tab/, "agent_begin refuses too");
+
+ await report();
+ assert.equal((await call("mobile_testing_tests")).isError, undefined, "a heartbeat revives it");
+ assert.doesNotThrow(() => recordings.begin({ title: "t", goal: "g" }));
+
+ // Beating again keeps it alive past what one report would have lasted.
+ for (let beat = 0; beat < 4; beat++) { clock += 10_000; await report(); }
+ assert.equal((await call("mobile_testing_tests")).isError, undefined);
+ // And leaving tells the server at once, without waiting out the expiry.
+ await call("mobile_testing_set_context", { projectPath: "", deviceId: "", bundleId: "" });
+ assert.equal((await call("mobile_testing_tests")).isError, true);
+ });
+});
diff --git a/packages/shared/src/panel-target.ts b/packages/shared/src/panel-target.ts
index 13a65a0c..d883403e 100644
--- a/packages/shared/src/panel-target.ts
+++ b/packages/shared/src/panel-target.ts
@@ -41,3 +41,6 @@ export function panelTargetPlatform(target: PanelTarget): "ios" | "android" | un
* `{ resourceUri }` that MCP Apps hosts ignore and the browser panel reads.
*/
export const PANEL_PAGE_META = "mobile-dev/panel";
+
+/** How often the open Testing tab re-sends its selection, so the server can tell a closed tab from an idle one. */
+export const PANEL_HEARTBEAT_MS = 5_000;
diff --git a/packages/ui/src/stored-test-steps.ts b/packages/shared/src/stored-test-steps.ts
similarity index 99%
rename from packages/ui/src/stored-test-steps.ts
rename to packages/shared/src/stored-test-steps.ts
index 169d1e90..ea9e62b6 100644
--- a/packages/ui/src/stored-test-steps.ts
+++ b/packages/shared/src/stored-test-steps.ts
@@ -69,7 +69,7 @@ export function changeStoredStepCommand(source: string, line: number, commandId:
});
if (!commandId.startsWith("assert") || /import\s*{[^}]*\bexpect\b[^}]*}\s*from\s*["']e2e["']/.test(changed)) return changed;
const lines = changed.split("\n");
- const lastImport = lines.findLastIndex(entry => /^import\s/.test(entry));
+ const lastImport = lines.map(entry => /^import\s/.test(entry)).lastIndexOf(true);
lines.splice(lastImport + 1, 0, 'import { expect } from "e2e";');
return lines.join("\n");
}
diff --git a/packages/ui/test/stored-test-steps.test.ts b/packages/shared/test/stored-test-steps.test.ts
similarity index 100%
rename from packages/ui/test/stored-test-steps.test.ts
rename to packages/shared/test/stored-test-steps.test.ts
diff --git a/packages/skills/mobile-dev-testing/SKILL.md b/packages/skills/mobile-dev-testing/SKILL.md
index 0ba95546..fda25953 100644
--- a/packages/skills/mobile-dev-testing/SKILL.md
+++ b/packages/skills/mobile-dev-testing/SKILL.md
@@ -1,6 +1,6 @@
---
name: mobile-dev-testing
-description: Use when the user asks to record, write or capture an end-to-end test for a screen or a flow of their iOS or Android app, with Mobile Dev's Testing panel. Drives the simulator or emulator through Mobile Dev's recorder one step at a time, pinning each step to a locator the e2e runner can resolve, and leaves the flow in the panel for the user to adjust, save and run. Skip when the user wants a test written straight into a file, or when there is no Mobile Dev panel.
+description: Use when the user asks to record, write or capture an end-to-end test for a screen or a flow of their iOS or Android app, with Mobile Dev's Testing panel. Drives the simulator or emulator through Mobile Dev's recorder one step at a time, pinning each step to a locator the e2e runner can resolve, and leaves the flow in the panel for the user to adjust, save and run. In No project (Studio) mode it also saves, runs on one or several devices, iOS and Android side by side, and repairs a failing line's locator for one platform. Skip when the user wants a test written straight into a file, or when there is no Mobile Dev panel.
---
# Record an e2e test with Mobile Dev
@@ -10,8 +10,9 @@ Details screen"* — and you write it by driving their simulator or emulator, on
appear in Mobile Dev's **Testing** tab as you record them, and when you stop, the flow is sitting
there unsaved for the user to adjust.
-You record. The user saves and runs. Those two are theirs, and the tools to do them are not yours
-to call.
+In a **project**, you record; the user saves and runs. Those two are theirs, and the tools to do
+them are not yours to call. In **No project (Studio) mode** the flow is yours end to end: see
+[Studio mode](#studio-mode-record-run-repair) below.
## Before you start
@@ -108,10 +109,11 @@ asserting text you have not seen.
## What you never do
-- **Never save.** There is no tool for it in your hands, and finishing is the handover: the steps
- are dirty in the panel and the user presses Save when they are happy with them.
-- **Never run the test.** There is no file to run, and a run resets the app and takes the device
- session the recording is being read through.
+- **Never save** a project's test. There is no tool for it in your hands, and finishing is the
+ handover: the steps are dirty in the panel and the user presses Save when they are happy with
+ them. (Studio mode's `finish` saves for you; that is the one exception.)
+- **Never run the test** while recording. There is no file to run, and a run resets the app and
+ takes the device session the recording is being read through.
- **Never drive the device another way while recording** — not `device_*`, not `mobile_open_url`,
not the mirror. The recorder's steps and another driver's taps interleave into a flow that does
not describe anything. Everything the flow does goes through `mobile_testing_agent_step`, which
@@ -122,3 +124,58 @@ asserting text you have not seen.
Tell the user what you recorded, in their terms, and that it is **in the Testing panel, unsaved**.
Say which parts fell back to a sentence, if any, and why. Do not paste the emitted file as the
deliverable — the panel is showing it, live, next to the steps.
+
+## Studio mode: record, run, repair
+
+No project open — the Testing tab says Studio — means tests live in Mobile Dev's own storage, each
+pinned to an app. The tab must be open: every tool below reads the tab's selection and refuses
+when it has none. Then tell the user to **open Mobile Dev's Testing tab** and stop. `projectPath`
+is optional on all of them; it defaults to the tab's project.
+
+### Record, which saves
+
+*"Use the opened iOS app and record a test."* Run the loop above. In Studio,
+`mobile_testing_agent_finish` **writes the test**, pinned to the platform and bundle id it was
+recorded on, and returns its `relativePath` (e.g. `tests/the-explore-screen.e2e.ts`). Tell the
+user the path. Nothing in the test file names a platform until you branch a line.
+
+### Run
+
+- One device, or a quick check: `mobile_testing_run_test({ relativePath })`. It waits for the end.
+- Several devices, iOS and Android side by side: `mobile_testing_run_matrix({ relativePath, devices })`
+ with a `{ deviceId, platform }` per device, from the device lists. It returns a `matrixId`
+ at once; read `mobile_testing_run_progress({ matrixId })` until `running` is false. `apps`
+ defaults to the apps the test is pinned to.
+- **Devices that are off are booted by the matrix**, and an app missing from a device is copied
+ from another device in the run that has it. Do not boot or install first.
+- The runs show in the Testing tab as live lanes, and the tab is locked while they go.
+
+### A platform has no app yet
+
+`run_matrix` refuses a platform the test has no app for. Then:
+
+1. Tell the user to **open the app on a device of that platform**.
+2. `mobile_testing_wait_for_app({ platform })`. It returns the foreground app's `bundleId`. If it
+ times out, relay its message and stop.
+3. `mobile_testing_set_target({ relativePath, platform, bundleId, mode: "add" })`. Do this
+ **without asking**, then tell the user which id you added.
+4. Run again.
+
+A device that needs the app opened or installed by hand is the only reason to ask the user to do
+anything on a device. Boot it and copy the app yourself when you can.
+
+### A lane fails
+
+A failed lane carries `failure`: the `line`, its `source` and `error`, and the device's screen as
+rows ending in the locator each would be written with (`button "Sign in" → screen.getByRole(…)`).
+Repair that platform's line and nothing else:
+
+1. Pick the row that names the element the line meant — the same control, never a different one.
+2. `mobile_testing_branch_line({ relativePath, line, platform, locator })`, with that lane's
+ `platform` and a locator copied from its rows. The other platform keeps its locator.
+3. Run again. **At most two tries per failure.** After the second, stop and report a likely app
+ bug: the line, the error, and what the screen showed.
+
+**Never weaken or remove an assertion** — not by changing its kind, loosening its text, deleting it
+or skipping the step. A fix swaps a locator and nothing more. If the element is not on that
+platform's screen at all, that is the bug to report, not a locator to find.
diff --git a/packages/ui/src/components/testing-view.tsx b/packages/ui/src/components/testing-view.tsx
index b7e39b62..8ff2e3b0 100644
--- a/packages/ui/src/components/testing-view.tsx
+++ b/packages/ui/src/components/testing-view.tsx
@@ -14,7 +14,7 @@ import { MenuRow, OFFER_LABEL, OfferIcon, StepCommandList } from "./step-command
import { Branch } from "./cascading-menu.tsx";
import { CODE_TOKEN_CLASS, changedLines, highlightCode } from "../code-highlight.ts";
import { testSourceSuggestions } from "../test-source-suggestions.ts";
-import { changeStoredStepCommand, duplicateStoredStep, moveStoredStep, removeStoredStep, storedStepCommands, storedTestSteps, storedTestUntilSource } from "../stored-test-steps.ts";
+import { changeStoredStepCommand, duplicateStoredStep, moveStoredStep, removeStoredStep, storedStepCommands, storedTestSteps, storedTestUntilSource } from "@mobile-dev/shared/stored-test-steps.ts";
import { Alert, AlertDescription, AlertTitle } from "./ui/alert.tsx";
import { Badge } from "./ui/badge.tsx";
import { Button } from "./ui/button.tsx";
@@ -167,7 +167,7 @@ function TestingDraftPicker({ panel }: { panel: TestingPanel }) {
const [open, setOpen] = useState(false);
const [unstoredOpen, setUnstoredOpen] = useState(true);
const [storedOpen, setStoredOpen] = useState(false);
- const agentRecording = state.agent?.active === true;
+ const agentRecording = state.agent?.active === true || state.agentRun;
// The one on screen may not be in the list yet: the autosave is debounced, and the first keep of
// a brand new flow lands a moment after the first step.
if (state.drafts.length === 0 && !state.draftId && state.tests.length === 0) return null;
@@ -338,6 +338,14 @@ export function TestingView({ panel, deviceApps }: { panel: TestingPanel; device
function AgentRecordingBanner({ panel }: { panel: TestingPanel }) {
const state = useSyncExternalStore(panel.subscribe, panel.getSnapshot);
const agent = state.agent;
+ // An agent's run: the lanes below are live and the user's controls wait for them.
+ if (state.agentRun) return
{agent.status === "aborted" ? "The agent stopped recording" : "The agent finished recording"}
{` ${agent.steps} step${agent.steps === 1 ? "" : "s"}`}{agent.note ? ` — ${agent.note}` : ""}.
- {" "}Nothing has been saved or run: adjust the steps below, then press Save.
+ {agent.savedPath ? ` Saved in Studio as ${agent.savedPath}.` : " Nothing has been saved or run: adjust the steps below, then press Save."}
;
}
@@ -373,7 +381,7 @@ function TestingControls({ panel, recordable, deviceId, platform }: { panel: Tes
const recording = state.recordingDeviceId === deviceId && deviceId !== "";
// While an agent is recording, the device is its own: a launch would reset the app under the
// flow, and Record would arm a second driver on one screen.
- const agentRecording = panelState.agent?.active === true;
+ const agentRecording = panelState.agent?.active === true || panelState.agentRun;
// `ml-auto` on the group, not on any button in it: the header is one flex row, so the free
// space between what names the project and what acts on it belongs to the gap between them.
// The group keeps its own gap and sizes, and on a header too narrow to hold both it wraps whole
@@ -837,7 +845,7 @@ function TestingRecorder({ panel, recordable, deviceId }: { panel: TestingPanel;
const recording = state.recordingDeviceId === deviceId && deviceId !== "";
// Not while the agent is still writing the flow: saving half of one is a file the user did not
// ask for, and the agent is told to hand over rather than to save.
- const saveable = Boolean(panelState.projectPath) && (state.steps.length > 0 || Boolean(state.sourceOverride)) && !panelState.saving && !panelState.agent?.active;
+ const saveable = Boolean(panelState.projectPath) && (state.steps.length > 0 || Boolean(state.sourceOverride)) && !panelState.saving && !panelState.agent?.active && !panelState.agentRun;
const [editing, setEditing] = useState(false);
const sourceSteps = state.sourceOverride === undefined ? undefined : storedTestSteps(state.sourceOverride);
const [hoveredStep, setHoveredStep] = useState();
@@ -923,7 +931,7 @@ function TestingRecorder({ panel, recordable, deviceId }: { panel: TestingPanel;
Preview
- {!panelState.agent?.active && setEditing(true)}>Edit}
{state.run?.state === "running" && Running
diff --git a/packages/ui/src/testing-matrix.ts b/packages/ui/src/testing-matrix.ts
index c4ab731b..4a4c6a47 100644
--- a/packages/ui/src/testing-matrix.ts
+++ b/packages/ui/src/testing-matrix.ts
@@ -16,7 +16,7 @@ export type MatrixLane = {
runId: string; deviceId: string; deviceName: string; platform: MatrixPlatform; state: LaneState;
progress: LaneProgress[]; result?: LaneResult; error?: string; startedAt?: number; finishedAt?: number;
};
-export type MatrixView = { matrixId: string; lanes: MatrixLane[]; limit: number; startedAt: number; finishedAt?: number };
+export type MatrixView = { matrixId: string; /** The test the lanes run, relative to the project. */ testPath?: string; lanes: MatrixLane[]; limit: number; startedAt: number; finishedAt?: number };
/** One device in the checklist. `installed` is unknown (undefined) for a device that is off. */
export type MatrixDeviceOption = {
@@ -93,7 +93,7 @@ export function parseMatrix(value: unknown): MatrixView | null {
});
}
return {
- matrixId: str(data.matrixId), lanes, limit: clampLimit(typeof data.limit === "number" ? data.limit : DEFAULT_MATRIX_LIMIT),
+ matrixId: str(data.matrixId), ...(str(data.testPath) ? { testPath: str(data.testPath) } : {}), lanes, limit: clampLimit(typeof data.limit === "number" ? data.limit : DEFAULT_MATRIX_LIMIT),
startedAt: typeof data.startedAt === "number" ? data.startedAt : Date.now(),
...(typeof data.finishedAt === "number" ? { finishedAt: data.finishedAt } : {}),
};
diff --git a/packages/ui/src/testing-panel.ts b/packages/ui/src/testing-panel.ts
index fd7efdca..0dc7c2cb 100644
--- a/packages/ui/src/testing-panel.ts
+++ b/packages/ui/src/testing-panel.ts
@@ -3,11 +3,11 @@ import type { DeviceAppsStore } from "./device-apps.ts";
import { captureUiError, countUiEvent, getUiTelemetryAttributes, recordUiTiming } from "./telemetry.ts";
import { testRecorder } from "./test-recorder.ts";
import type { RecorderTreeSource } from "./test-recorder.ts";
-import { isRecordableDevice, recordablePlatform } from "@mobile-dev/shared/panel-target.ts";
+import { PANEL_HEARTBEAT_MS, isRecordableDevice, recordablePlatform } from "@mobile-dev/shared/panel-target.ts";
import type { ScreenComponent } from "@mobile-dev/shared/screen-annotations.ts";
import { screenSize } from "@mobile-dev/shared/screen-annotations.ts";
import { testFileSlug } from "@mobile-dev/shared/test-recording.ts";
-import { branchStoredStepLocator, storedTestCallLines, storedTestUntilSource } from "./stored-test-steps.ts";
+import { branchStoredStepLocator, storedTestCallLines, storedTestUntilSource } from "@mobile-dev/shared/stored-test-steps.ts";
import type { RecordedStep } from "@mobile-dev/shared/test-recording.ts";
import type { TestDraftSummary } from "@mobile-dev/shared/test-drafts.ts";
import { DEFAULT_MATRIX_LIMIT, clampLimit, isTerminalLane, matrixFinished, parseMatrix, parseMatrixDevices, readMatrixPreferences, writeMatrixPreferences } from "./testing-matrix.ts";
@@ -38,6 +38,8 @@ export type TestingAgentView = {
note: string;
/** The unsaved recording a finished session was kept as; "" while it is still recording. */
draftId: string;
+ /** The Studio test a finished session was saved as, relative to Studio; "" when it was kept as a draft. */
+ savedPath: string;
};
/** 400 ms while an agent is recording, so a step lands in the panel as it is recorded. */
@@ -122,6 +124,11 @@ export type TestingSnapshot = {
matrixLimit: number;
/** The agent recording the server holds, or null when no agent has ever recorded here. */
agent: TestingAgentView | null;
+ /**
+ * An agent started the run on screen (`matrix`). Its lanes are live and the panel's editing is
+ * locked the way it is while the agent records, until every lane has finished.
+ */
+ agentRun: boolean;
/**
* The recordings that have not been written into a project yet, newest first.
*
@@ -200,7 +207,7 @@ export class TestingPanel {
loadingProject: false, pickingProject: false, launching: false, appLaunched: false,
fileName: "", saving: false, overwritePath: "", savedRevision: -1, savedPath: "", running: false, pendingRun: false,
matrix: null, selectedLane: "", matrixDevices: [], matrixLoading: false, matrixSelected: [], matrixLimit: DEFAULT_MATRIX_LIMIT,
- agent: null, drafts: [], draftId: "", loadingDraft: false, tests: [], selectedTestPath: "", selectedTestSource: "", selectedTestOriginalHash: "", selectedTestStaged: false, loadingTest: false, deletingTest: "", error: null,
+ agent: null, agentRun: false, drafts: [], draftId: "", loadingDraft: false, tests: [], selectedTestPath: "", selectedTestSource: "", selectedTestOriginalHash: "", selectedTestStaged: false, loadingTest: false, deletingTest: "", error: null,
};
/** The agent recording's revision the panel has already adopted; -1 before the first poll. */
@@ -230,9 +237,20 @@ export class TestingPanel {
/** Set when a session goes active, for the host chrome to show the Testing tab. */
private onAgentRecording?: () => void;
- constructor(app: HostBridge, deviceApps: DeviceAppsStore) {
+ private heartbeatTimer?: ReturnType;
+ private readonly onPageHide = () => { void this.clearReportedContext(); };
+
+ constructor(app: HostBridge, deviceApps: DeviceAppsStore, options: { heartbeatMs?: number } = {}) {
this.app = app;
this.deviceApps = deviceApps;
+ // The server only believes a panel that keeps reporting: a closed tab or window sends nothing.
+ this.heartbeatTimer = setInterval(() => {
+ const hidden = typeof document !== "undefined" && document.visibilityState === "hidden";
+ if (this.snapshot.open && !hidden) void this.reportContext(true);
+ }, options.heartbeatMs ?? PANEL_HEARTBEAT_MS);
+ // An interval must not keep a host process alive on its own.
+ (this.heartbeatTimer as { unref?: () => void }).unref?.();
+ if (typeof window !== "undefined") window.addEventListener("pagehide", this.onPageHide);
// The device is half of what an agent recording needs and it belongs to the simulator panel,
// so the selection is reported whenever either half moves.
this.stopWatchingDevices = deviceApps.subscribe(() => {
@@ -704,7 +722,7 @@ export class TestingPanel {
/** Shows the file exactly as stored. The recorder's current flow remains intact. */
async openTest(relativePath: string) {
const projectPath = this.snapshot.projectPath;
- if (!relativePath || !projectPath || this.snapshot.agent?.active) return;
+ if (!relativePath || !projectPath || this.agentBusy) return;
const revision = ++this.testReadRevision;
clearTimeout(this.draftTimer);
await this.keepDraft();
@@ -965,7 +983,7 @@ export class TestingPanel {
* left. Nothing starts recording: the user opened a flow to look at it.
*/
async openDraft(id: string) {
- if (!id || this.snapshot.loadingDraft || this.snapshot.agent?.active) return;
+ if (!id || this.snapshot.loadingDraft || this.agentBusy) return;
this.clearTestPreview();
if (id === this.snapshot.draftId) return;
clearTimeout(this.draftTimer);
@@ -1001,7 +1019,7 @@ export class TestingPanel {
async deleteDraft(id: string) {
if (!id || !this.snapshot.available) return;
const current = id === this.snapshot.draftId;
- if (current && this.snapshot.agent?.active) return;
+ if (current && this.agentBusy) return;
clearTimeout(this.draftTimer);
try {
await this.call("mobile_testing_draft_delete", { id }, 15_000);
@@ -1032,7 +1050,7 @@ export class TestingPanel {
/** Starts a new flow, keeping whatever is on screen as its own draft first. */
async newRecording() {
- if (this.snapshot.agent?.active) return;
+ if (this.agentBusy) return;
this.clearTestPreview();
clearTimeout(this.draftTimer);
await this.keepDraft();
@@ -1147,7 +1165,7 @@ export class TestingPanel {
* config. `mobile_testing_agent_begin` reads it and refuses when any of the three is missing,
* which is what keeps an OS folder dialog from opening inside an agent's turn.
*/
- private async reportContext() {
+ private async reportContext(force = false) {
if (this.disposed || !this.snapshot.available) return;
const projectPath = this.snapshot.projectPath;
const bundleId = this.target?.bundleId ?? "";
@@ -1158,7 +1176,7 @@ export class TestingPanel {
const deviceId = recordable ? device.udid : "";
const platform = recordable ? recordablePlatform(device) : undefined;
const key = `${projectPath}\u0000${platform ?? ""}\u0000${deviceId}\u0000${bundleId}`;
- if (key === this.reportedContext) return;
+ if (key === this.reportedContext && !force) return;
this.reportedContext = key;
try {
await this.call("mobile_testing_set_context", { projectPath, deviceId, ...(platform ? { platform } : {}), bundleId }, 10_000);
@@ -1169,6 +1187,12 @@ export class TestingPanel {
}
}
+ /** Best effort on the way out: an empty project tells the server the tab is gone, without waiting out its expiry. */
+ private async clearReportedContext() {
+ this.reportedContext = "";
+ try { await this.call("mobile_testing_set_context", { projectPath: "", deviceId: "", bundleId: "" }, 3_000); } catch { /* the server's expiry covers it */ }
+ }
+
/**
* One poll of the agent recording the server holds, which then schedules the next.
*
@@ -1184,11 +1208,57 @@ export class TestingPanel {
if (this.disposed || !this.snapshot.available) return;
clearTimeout(this.agentTimer);
this.agentTimer = setTimeout(() => this.pollAgent(),
- this.snapshot.agent?.active ? AGENT_POLL_ACTIVE_MS : AGENT_POLL_IDLE_MS);
+ this.agentBusy ? AGENT_POLL_ACTIVE_MS : AGENT_POLL_IDLE_MS);
});
}
+ /**
+ * A run the agent started: the server holds it in the same registry the panel's own runs use, so
+ * the latest one is on screen as live lanes while any of them is unfinished. The panel never
+ * adopts a finished one it did not see running, and never one while it is running its own.
+ */
+ private async readAgentRun() {
+ if (this.snapshot.running || this.disposed || !this.snapshot.projectPath) return;
+ let matrix: MatrixView | null;
+ let running: boolean;
+ try {
+ const response = await this.call("mobile_testing_run_progress", {}, 5_000);
+ matrix = parseMatrix(response.structuredContent);
+ running = object(response.structuredContent)?.running === true;
+ } catch { return; }
+ if (this.disposed || this.snapshot.running || !matrix) return;
+ const adopted = this.snapshot.agentRun;
+ if (!adopted) {
+ if (!running || matrix.matrixId === this.snapshot.matrix?.matrixId) return;
+ // The lanes show against the test they run, so that test is opened first.
+ if (matrix.testPath && matrix.testPath !== this.snapshot.selectedTestPath) {
+ if (!this.snapshot.tests.some(test => test.relativePath === matrix!.testPath)) await this.refreshTests();
+ if (this.snapshot.tests.some(test => test.relativePath === matrix!.testPath)) await this.openTest(matrix.testPath);
+ }
+ if (this.disposed || this.snapshot.running) return;
+ this.matrixCallLines = storedTestCallLines(this.snapshot.selectedTestSource);
+ this.matrixUntilLine = undefined;
+ this.laneSignature = "";
+ testRecorder.beginRun();
+ this.update({ agentRun: true, matrix, selectedLane: matrix.lanes[0]?.runId ?? "", error: null });
+ this.onAgentRecording?.();
+ this.showLane();
+ return;
+ }
+ // Only the run the panel adopted: a newer one replaces it from the top.
+ if (matrix.matrixId !== this.snapshot.matrix?.matrixId) { this.update({ agentRun: false }); testRecorder.invalidate(); return; }
+ this.update({ matrix, selectedLane: matrix.lanes.some(lane => lane.runId === this.snapshot.selectedLane) ? this.snapshot.selectedLane : (matrix.lanes[0]?.runId ?? "") });
+ this.showLane();
+ if (!running) {
+ this.update({ agentRun: false });
+ testRecorder.invalidate();
+ // The agent may have saved, branched or pinned a test while the run was going.
+ void this.refreshTests();
+ }
+ }
+
private async readAgentState() {
+ await this.readAgentRun();
let data: Record;
try {
const response = await this.call("mobile_testing_agent_state", {}, 5_000);
@@ -1203,8 +1273,9 @@ export class TestingPanel {
const agent: TestingAgentView = {
active: data.active === true, status,
title: text(data.title), goal: text(data.goal), steps: steps.length, note: text(data.note),
- draftId: text(data.draftId),
+ draftId: text(data.draftId), savedPath: text(data.savedPath),
};
+ const savedPath = agent.savedPath;
const first = this.agentRevision < 0;
const unchanged = !first && revision === this.agentRevision;
this.agentRevision = revision;
@@ -1233,15 +1304,25 @@ export class TestingPanel {
// The server kept the finished flow, so the panel adopts that draft rather than autosaving
// a second copy of the same steps a moment later.
this.draftRevision = testRecorder.getSnapshot().revision;
- this.draftFlowId = agent.draftId ? testRecorder.getSnapshot().flowId : "";
- this.update({ savedRevision: -1, savedPath: "", ...(agent.draftId ? { draftId: agent.draftId } : {}) });
- void this.refreshDrafts();
+ if (savedPath) {
+ // Studio: finishing wrote the test, so there is no draft to adopt. The steps are in the
+ // stored list now, and the recorder's copy is marked saved so autosave does not keep it again.
+ this.draftFlowId = "";
+ this.update({ savedRevision: testRecorder.getSnapshot().revision, savedPath: `Studio/${savedPath}` });
+ testRecorder.stop();
+ void this.refreshTests();
+ void this.refreshDrafts();
+ } else {
+ this.draftFlowId = agent.draftId ? testRecorder.getSnapshot().flowId : "";
+ this.update({ savedRevision: -1, savedPath: "", ...(agent.draftId ? { draftId: agent.draftId } : {}) });
+ void this.refreshDrafts();
+ }
}
}
/** The user's Stop button on the agent banner. The server drops the session; the steps stay. */
async stopAgent() {
- if (!this.snapshot.agent?.active) return;
+ if (this.snapshot.agent?.active !== true) return;
try {
await this.call("mobile_testing_agent_abort", { reason: "The user stopped the recording from the Testing panel." }, 10_000);
} catch (error) {
@@ -1254,17 +1335,20 @@ export class TestingPanel {
this.pollAgent();
}
+ /** An agent is recording or running tests: the mirror, the editor and the run controls are its own. */
+ get agentBusy(): boolean { return this.snapshot.agent?.active === true || this.snapshot.agentRun; }
+
/** Whether Run has something to run: a project, steps, and no run or save already in flight. */
get canRun(): boolean {
// Never while an agent is recording: a run resets the app and takes the one agent-device
// session the device allows, which is the session the recording is being read through.
- return Boolean(this.snapshot.available && this.snapshot.projectPath && !this.snapshot.selectedTestPath && !this.snapshot.agent?.active
+ return Boolean(this.snapshot.available && this.snapshot.projectPath && !this.snapshot.selectedTestPath && !this.agentBusy
&& (testRecorder.getSnapshot().steps.length > 0 || Boolean(testRecorder.getSnapshot().sourceOverride)) && !this.snapshot.running && !this.snapshot.saving);
}
get canRunStored(): boolean {
return Boolean(this.snapshot.available && this.snapshot.projectPath && this.snapshot.selectedTestPath
- && !this.snapshot.loadingTest && !this.snapshot.agent?.active && !this.snapshot.running && !this.snapshot.saving
+ && !this.snapshot.loadingTest && !this.agentBusy && !this.snapshot.running && !this.snapshot.saving
&& !this.storedRunHint);
}
@@ -1618,7 +1702,7 @@ export class TestingPanel {
}
dismissMatrix() {
- if (this.snapshot.running) return;
+ if (this.snapshot.running || this.snapshot.agentRun) return;
this.update({ matrix: null, selectedLane: "" });
testRecorder.clearRun();
}
@@ -1721,7 +1805,11 @@ export class TestingPanel {
// debounce may still be holding the newest step.
this.flushing = true;
void this.keepDraft().finally(() => { this.flushing = false; });
+ // Before `disposed` is set, so the call still goes out.
+ void this.clearReportedContext();
this.disposed = true;
+ clearInterval(this.heartbeatTimer);
+ if (typeof window !== "undefined") window.removeEventListener("pagehide", this.onPageHide);
clearTimeout(this.agentTimer);
clearTimeout(this.draftTimer);
this.stopWatchingDevices();
From b691e4d9a983d8411e7f779539e42a625411743a Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Wed, 18 Nov 2026 17:10:20 +0500
Subject: [PATCH 17/23] fix: input requiring with agent session
---
packages/core/src/panel-tools.ts | 2 +-
packages/core/src/plugin.ts | 13 +-
packages/core/src/testing-agent.ts | 103 ++++++++++---
packages/core/src/testing-prepare.ts | 3 +
packages/core/src/testing-tools.ts | 31 ++--
packages/core/test/mobile-dev-skill.test.ts | 11 +-
packages/core/test/plugin.test.ts | 5 +
packages/core/test/testing-agent.test.ts | 18 +--
.../core/test/testing-studio-agent.test.ts | 140 +++++++++++++++++-
packages/shared/src/panel-target.ts | 2 +-
packages/skills/mobile-dev-testing/SKILL.md | 30 ++--
11 files changed, 289 insertions(+), 69 deletions(-)
diff --git a/packages/core/src/panel-tools.ts b/packages/core/src/panel-tools.ts
index 17707a4e..e9f6a99c 100644
--- a/packages/core/src/panel-tools.ts
+++ b/packages/core/src/panel-tools.ts
@@ -260,7 +260,7 @@ function registerPanel(server: McpServer, { android, cpu, fps, drivers, page, sh
});
openingTool("mobile_open_simulator", {
- description: "Open Mobile Dev alongside the chat for local mobile app development, before the first device launch unless a view is open or the workflow is tool-only. Pass established platform, kind, or discovered deviceId to select the initial device; omit undecided fields. Starts the bundled backend without booting devices.",
+ description: "Open Mobile Dev alongside the chat for local mobile app development, before the first device launch unless a view is open or the workflow is tool-only. Pass established platform, kind, or discovered deviceId to select the initial device; omit undecided fields. Pass workspaceTool \"testing\" to open (or switch an open view to) the Testing tab, which e2e recording and test runs need. Starts the bundled backend without booting devices.",
resourceUri: APP_URI, entrypoint: "thread",
});
diff --git a/packages/core/src/plugin.ts b/packages/core/src/plugin.ts
index dc790f49..c7c22036 100644
--- a/packages/core/src/plugin.ts
+++ b/packages/core/src/plugin.ts
@@ -127,12 +127,13 @@ export async function createPlugin(html: string | (() => Promise), o
// finished, and those are the same list of unsaved recordings.
const testDrafts = new TestDraftStore();
// One recordings object too: it holds the panel's context, which the model-visible run tools check.
- const testingRecordings = new TestingAgentRecordings(testingDevices, testDrafts);
+ const testingOps = systemDeviceOps({
+ simulators, android, drivers,
+ foreground: async (platform, deviceId) => (await readDeviceApps(deviceId, undefined, platform, platform === "ios" ? "simulator" : undefined, { ...deviceAppSources, simulator: simulatorForeground })).foregroundApp?.bundleId ?? null,
+ });
+ const testingRecordings = new TestingAgentRecordings(testingDevices, testDrafts, { ops: testingOps });
const closeTestingDevices = registerTestingTools(server, new TestingProjectChoices(TESTING_DIRECTORY), testingDevices, testDrafts, {
- ops: systemDeviceOps({
- simulators, android, drivers,
- foreground: async (platform, deviceId) => (await readDeviceApps(deviceId, undefined, platform, platform === "ios" ? "simulator" : undefined, { ...deviceAppSources, simulator: simulatorForeground })).foregroundApp?.bundleId ?? null,
- }),
+ ops: testingOps,
panel: testingRecordings,
});
registerTestingAgentTools(server, testingDevices, testingRecordings);
@@ -170,6 +171,8 @@ export async function createPlugin(html: string | (() => Promise), o
const panelOpeners: PanelOpener[] = [];
// One place shows the panel beyond the host; the first feature that offers one wins.
const opened: PanelOpener = async open => {
+ // The Testing tab beats a moment after it loads; calls made in between wait for it rather than refuse.
+ testingRecordings.expectPanel();
const openings = await Promise.all(panelOpeners.map(opener => opener(open)));
return openings.find(opening => opening !== undefined);
};
diff --git a/packages/core/src/testing-agent.ts b/packages/core/src/testing-agent.ts
index 20485e2d..98e9f55a 100644
--- a/packages/core/src/testing-agent.ts
+++ b/packages/core/src/testing-agent.ts
@@ -18,6 +18,8 @@ import { TestingDevices } from "./testing-device.ts";
import { TestDraftStore } from "./testing-drafts.ts";
import type { TestingDeviceTarget } from "./testing-device.ts";
import { captureServerError, recordTestingAgentRead } from "./telemetry.ts";
+import { LAUNCHER_APP } from "./testing-prepare.ts";
+import type { DeviceOps } from "./testing-prepare.ts";
import { inspectProject, writeTestFile, writeTestTarget } from "./testing-projects.ts";
/**
@@ -53,6 +55,8 @@ const MAX_ELEMENTS = 200;
/** How often the open Testing tab re-sends its selection, and how long silence is believed (three beats). */
export { PANEL_HEARTBEAT_MS };
export const PANEL_EXPIRY_MS = PANEL_HEARTBEAT_MS * 3;
+/** How long after an open a call waits for the panel's first report before calling the tab closed. */
+export const PANEL_OPEN_GRACE_MS = 15_000;
/** What the panel's selection is, as the panel reports it. Nothing here is inferred. */
export type TestingAgentContext = { projectPath: string; deviceId: string; platform: "ios" | "android"; bundleId: string };
@@ -207,20 +211,23 @@ export class TestingAgentRecordings {
/** The project the Testing panel reports, whether or not a device is selected: proof the tab is open. */
private panelProject = "";
private session?: Session;
+ /** `Date.now()` until which a silent panel is believed to be loading rather than closed. */
+ private expectUntil = 0;
private revision = 0;
/** When the panel last reported, on `now`'s clock; 0 before the first report. */
private reportedAt = 0;
private readonly now: () => number;
private readonly expiryMs: number;
+ private readonly options: { ops?: DeviceOps };
/**
* `expiryMs` is how long the server believes a panel that has stopped reporting: about three of
* the panel's heartbeats (`PANEL_HEARTBEAT_MS`). Both it and the clock are injectable so tests
* need not sleep.
*/
- constructor(devices: TestingDevices, drafts = new TestDraftStore(), options: { now?: () => number; expiryMs?: number } = {}) {
- this.devices = devices; this.drafts = drafts;
+ constructor(devices: TestingDevices, drafts = new TestDraftStore(), options: { now?: () => number; expiryMs?: number; ops?: DeviceOps } = {}) {
+ this.devices = devices; this.drafts = drafts; this.options = options;
this.now = options.now ?? Date.now;
this.expiryMs = options.expiryMs ?? PANEL_EXPIRY_MS;
}
@@ -242,6 +249,19 @@ export class TestingAgentRecordings {
setPanelProject(projectPath: string) { this.panelProject = projectPath; this.reportedAt = projectPath ? this.now() : 0; }
/** The project the Testing panel has selected, or undefined when the tab has not reported one. */
panelProjectPath(): string | undefined { this.expire(); return this.panelProject || undefined; }
+ /**
+ * Notes that the panel was just opened, so a call that finds the tab silent waits for its first
+ * report instead of refusing: a tool call returns before the iframe has loaded and beat once.
+ */
+ expectPanel(graceMs = PANEL_OPEN_GRACE_MS) { this.expectUntil = Date.now() + graceMs; }
+ /** The panel's project, waiting up to the grace period when the panel was just opened and has not reported yet. */
+ async awaitPanelProject(): Promise {
+ for (;;) {
+ const project = this.panelProjectPath();
+ if (project || Date.now() >= this.expectUntil) return project;
+ await new Promise(resolve => setTimeout(resolve, 50));
+ }
+ }
/** The panel's full selection, when it has a device and an app selected. */
panelContext(): TestingAgentContext | undefined { this.expire(); return this.context; }
@@ -272,27 +292,23 @@ export class TestingAgentRecordings {
}
/**
- * Starts a recording against whatever the panel has selected.
+ * Starts a recording against what the panel has selected, filling in only what is unambiguous.
*
- * It never picks for the user. Choosing the project is an explicit act — the panel's picker is
- * an OS folder dialog, which must not open inside an agent's turn — and the device is whichever
- * one the mirror is showing. Missing either, the refusal says which, and the user fixes it in
- * the panel where the choice lives.
+ * The Testing tab has to be open (it is the proof the user is looking, and its heartbeat is the
+ * only thing that says so). Past that, nothing is asked that the machine can answer: the device is
+ * the mirrored one, or the only one booted; in Studio the app is whichever is in the foreground;
+ * in a project it is the config target the foreground app matches, or the only target for the
+ * platform. A real ambiguity or a missing piece comes back as one refusal that names only what is
+ * missing, with one action each. The project is never picked here — choosing it is an explicit act
+ * and the panel's picker is an OS folder dialog, which must not open inside an agent's turn.
*/
- begin(input: { title: string; goal: string }) {
+ async begin(input: { title: string; goal: string }) {
if (this.session?.status === "recording") {
refused(`An agent recording is already in flight: "${this.session.title}". Finish it with mobile_testing_agent_finish, or drop it with mobile_testing_agent_abort.`);
}
- this.expire();
- const context = this.context;
- const missing = [
- context?.projectPath ? "" : "an e2e project",
- context?.deviceId ? "" : "a booted simulator or emulator in the mirror",
- context?.bundleId ? "" : "a target with a bundle id in the project's e2e config",
- ].filter(Boolean);
- if (!context || missing.length > 0) {
- refused(`The Testing panel has no ${missing.join(", no ")} selected, so there is nothing to record against. Ask the user to open Mobile Dev's Testing tab and choose one, then begin again.`);
- }
+ const projectPath = await this.awaitPanelProject() ?? this.context?.projectPath ?? "";
+ if (!projectPath) refused("The Testing tab is not open. Call mobile_open_simulator with workspaceTool \"testing\" to open it, then begin again.");
+ const context = await this.resolveTarget(projectPath);
this.session = {
target: { deviceId: context.deviceId, platform: context.platform, projectPath: context.projectPath, bundleId: context.bundleId },
title: input.title.trim() || "a recorded flow",
@@ -308,10 +324,57 @@ export class TestingAgentRecordings {
deviceId: context.deviceId,
platform: context.platform,
bundleId: context.bundleId,
+ ...(context.picked.length ? { picked: context.picked, report: `Recording on ${context.picked.join(" with ")} (chosen automatically); tell the user.` } : {}),
next: "Call mobile_testing_agent_screen to read the screen, then mobile_testing_agent_step with one of its refs. Re-read after every step that acts.",
};
}
+ /** The device and app to record against, from the panel's selection and then the machine. Refuses with what is missing. */
+ private async resolveTarget(projectPath: string): Promise {
+ const reported = this.context;
+ const ops = this.options.ops;
+ const picked: string[] = [];
+ const bundled = (await inspectProject(projectPath).catch(() => undefined))?.runtimeMode === "bundled";
+ // A selection the panel reported whole is the user's own choice; nothing second-guesses it. In
+ // Studio the app in front is the target, so only a project's complete selection is final.
+ if (reported?.deviceId && reported.bundleId && !bundled) return { ...reported, projectPath, picked };
+ const problems: string[] = [];
+
+ let device: { deviceId: string; platform: "ios" | "android"; name?: string } | undefined;
+ if (reported?.deviceId) device = { deviceId: reported.deviceId, platform: reported.platform };
+ else if (ops?.bootedDevices) {
+ const found = (await Promise.all((["ios", "android"] as const).map(async platform =>
+ (await ops.bootedDevices!(platform).catch(() => [])).map(entry => ({ ...entry, platform }))))).flat();
+ if (found.length === 1) { device = found[0]; picked.push(`the booted ${found[0]!.name}`); }
+ else if (found.length > 1) problems.push(`Say which device to record on: ${found.map(entry => entry.name).join(", ")}.`);
+ else problems.push("Boot an iOS simulator or Android emulator and mirror it in Mobile Dev.");
+ } else problems.push("Boot an iOS simulator or Android emulator and mirror it in Mobile Dev.");
+
+ let bundleId = "";
+ if (device) {
+ const front = ops?.foregroundApp ? await ops.foregroundApp(device.platform, device.deviceId).catch(() => null) : null;
+ const foreground = front && !LAUNCHER_APP.test(front) ? front : "";
+ if (bundled) {
+ bundleId = foreground || reported?.bundleId || "";
+ if (!bundleId) problems.push("Open the app to record in the foreground on the device (or ask the user to open or install it).");
+ else if (foreground) picked.push(`${foreground}, the app in the foreground`);
+ } else {
+ const targets = ((await inspectProject(projectPath).catch(() => undefined))?.targets ?? [])
+ .filter(target => target.bundleId && (!target.platform || target.platform === device!.platform));
+ const match = targets.find(target => target.bundleId === foreground);
+ if (reported?.bundleId) bundleId = reported.bundleId;
+ else if (match) { bundleId = match.bundleId!; picked.push(`${bundleId}, the config target open in the foreground`); }
+ else if (targets.length === 1) { bundleId = targets[0]!.bundleId!; picked.push(`${bundleId}, the project's only ${device.platform} target`); }
+ else if (targets.length > 1) problems.push(`Say which target to record: ${targets.map(target => target.name).join(", ")}, or open one of them in the foreground.`);
+ else problems.push("Add a target with a bundle id for this platform to the project's e2e config.");
+ }
+ } else if (bundled) problems.push("Open the app to record in the foreground on the device (or ask the user to open or install it).");
+ if (problems.length > 0 || !device) {
+ refused(`Cannot start recording yet. ${problems.join(" ")} Then begin again.`);
+ }
+ return { projectPath, deviceId: device.deviceId, platform: device.platform, bundleId, picked };
+ }
+
/**
* The runner's element tree as the agent's eyes.
*
@@ -640,14 +703,14 @@ export function registerTestingAgentTools(server: McpServer, devices: TestingDev
registerAppTool(server, "mobile_testing_agent_begin", {
title: "Begin recording an e2e test",
description:
- "Start recording an e2e test into Mobile Dev's Testing panel, against the project, device and app the panel already has selected. Refuses, saying what is missing, when the user has not chosen them. The steps appear in the panel as you record them. In No project (Studio) mode mobile_testing_agent_finish saves the test pinned to the recorded app and returns its relativePath for mobile_testing_run_test / mobile_testing_run_matrix; in a project the steps stay unsaved for the user.",
+ "Start recording an e2e test into Mobile Dev's Testing panel, against the project the panel has selected. The Testing tab must be open. The device and app are picked automatically when unambiguous (the mirrored or only booted device; in Studio the app in the foreground, in a project the matching config target) and reported back in `picked`, so tell the user. Otherwise it refuses naming only what is missing and the one action for each; do that (boot a device, open the app) or ask the user only when they really must open or install the app, then begin again. The steps appear in the panel as you record them. In No project (Studio) mode mobile_testing_agent_finish saves the test pinned to the recorded app and returns its relativePath for mobile_testing_run_test / mobile_testing_run_matrix; in a project the steps stay unsaved for the user.",
inputSchema: {
title: z.string().min(1).max(200).describe("The test's title, e.g. \"the explore details screen\"."),
goal: z.string().min(1).max(500).describe("What this flow covers, in one sentence. Shown to the user in the panel's banner."),
},
annotations: write,
_meta: sharedVisibility,
- }, safe(async (input: { title: string; goal: string }) => dataResult(recordings.begin(input))));
+ }, safe(async (input: { title: string; goal: string }) => dataResult(await recordings.begin(input))));
registerAppTool(server, "mobile_testing_agent_screen", {
title: "Read the screen being recorded",
diff --git a/packages/core/src/testing-prepare.ts b/packages/core/src/testing-prepare.ts
index b85a47fe..a94d9c7b 100644
--- a/packages/core/src/testing-prepare.ts
+++ b/packages/core/src/testing-prepare.ts
@@ -9,6 +9,9 @@ import type { Simctl } from "./simctl.ts";
import type { Lane, LaneExecutor, MatrixPlatform } from "./testing-matrix.ts";
import type { TestRunProgress, TestRunResult } from "./testing-run.ts";
+/** Home screens and system UI, which are never the app to record. */
+export const LAUNCHER_APP = /^com\.apple\.springboard$|^com\.android\.systemui$|launcher/i;
+
/** The per-platform app ids of a matrix request: a project may use different ones on each platform. */
export interface MatrixAppIds { ios?: string; android?: string }
diff --git a/packages/core/src/testing-tools.ts b/packages/core/src/testing-tools.ts
index 3ab71651..5e8dc31f 100644
--- a/packages/core/src/testing-tools.ts
+++ b/packages/core/src/testing-tools.ts
@@ -19,7 +19,7 @@ import { runRecordedTest } from "./testing-run.ts";
import type { TestRunRequest } from "./testing-run.ts";
import { MatrixRegistry, MAX_MATRIX_LIMIT, snapshotMatrix, startMatrix } from "./testing-matrix.ts";
import type { LaneExecutor, MatrixDevice, MatrixRun } from "./testing-matrix.ts";
-import { createLaneExecutor } from "./testing-prepare.ts";
+import { LAUNCHER_APP, createLaneExecutor } from "./testing-prepare.ts";
import type { DeviceOps } from "./testing-prepare.ts";
import { deviceIdSchema } from "@mobile-dev/shared/panel-target.ts";
import type { BundledModelProvider } from "./testing-run.ts";
@@ -40,6 +40,8 @@ const sharedVisibility = { ui: { visibility: ["app", "model"] as ("app" | "model
/** What the Testing tab has told the server; see `TestingAgentRecordings.setPanelProject`. */
export interface PanelContext {
panelProjectPath(): string | undefined;
+ /** Like `panelProjectPath`, but waits out the panel's first report when the tab was only just opened. */
+ awaitPanelProject?(): Promise;
panelContext?(): TestingAgentContext | undefined;
}
@@ -60,8 +62,6 @@ function singleExpression(text: string): boolean {
return !quote && stack.length === 0;
}
-const LAUNCHER_APP = /^com\.apple\.springboard$|^com\.android\.systemui$|launcher/i;
-
const projectPath = z.string().min(1).max(4096);
function safe(handler: (input: T) => Promise) {
@@ -98,13 +98,14 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
* it, so the agent never needs to know where Studio lives.
*/
const panel = matrix.panel;
- function resolveProject(selected?: string): string {
+ async function resolveProject(selected?: string): Promise {
if (!panel) {
if (!selected) throw new ExpectedOperationError("invalid_input", "Pass projectPath.");
return selected;
}
- const current = panel.panelProjectPath();
- if (!current) throw new ExpectedOperationError("invalid_input", "The Testing tab is not open, so there is no project to work on. Ask the user to open Mobile Dev's Testing tab, then try again.");
+ // Right after an agent opened the tab its first heartbeat may not have arrived; wait for it.
+ const current = await panel.awaitPanelProject?.() ?? panel.panelProjectPath();
+ if (!current) throw new ExpectedOperationError("invalid_input", "The Testing tab is not open, so there is no project to work on. Open it with mobile_open_simulator (workspaceTool \"testing\"), then try again.");
return selected ?? current;
}
const matrixWire = (run: MatrixRun) => ({ ...snapshotMatrix(run), running: run.lanes.some(lane => !["passed", "failed", "cancelled", "error"].includes(lane.state)) });
@@ -166,7 +167,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
annotations: read,
_meta: sharedVisibility,
}, safe(async ({ projectPath: selected }: { projectPath?: string }) =>
- dataResult({ tests: await listTestFiles(resolveProject(selected)) })));
+ dataResult({ tests: await listTestFiles(await resolveProject(selected)) })));
registerAppTool(server, "mobile_testing_read_file", {
title: "Preview a project test",
@@ -175,7 +176,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
annotations: read,
_meta: sharedVisibility,
}, safe(async ({ projectPath: selected, relativePath }: { projectPath?: string; relativePath: string }) =>
- dataResult(await previewTestFile(resolveProject(selected), relativePath))));
+ dataResult(await previewTestFile(await resolveProject(selected), relativePath))));
registerAppTool(server, "mobile_testing_stage_file", {
title: "Keep project test edits temporarily",
@@ -361,7 +362,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
annotations: write,
_meta: sharedVisibility,
}, safe(async ({ projectPath: selected, relativePath, platform, bundleId, mode }: { projectPath?: string; relativePath: string; platform: "ios" | "android"; bundleId: string; mode?: "replace" | "add" }) => {
- const pinned = await writeTestTarget(resolveProject(selected), relativePath, { platform, bundleId }, mode);
+ const pinned = await writeTestTarget(await resolveProject(selected), relativePath, { platform, bundleId }, mode);
return dataResult({ pinned, ...(pinned ? { added: { platform, bundleId, mode: mode ?? "replace" } } : {}) },
pinned ? `Pinned ${platform} ${bundleId} to ${relativePath} (${mode ?? "replace"}).` : "Only Studio tests carry a pinned app; nothing was changed.");
}));
@@ -456,7 +457,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
annotations: destructive,
_meta: sharedVisibility,
}, safe(async (raw: Omit & { projectPath?: string }) => {
- const input: RunInput = { ...raw, projectPath: resolveProject(raw.projectPath) };
+ const input: RunInput = { ...raw, projectPath: await resolveProject(raw.projectPath) };
// The release is a dependency of the run, not a step the caller is trusted to have taken: see
// `TestRunDeps`. The panel releases too, but a caller who forgets must not break the run.
const { request, project, platform, bundleId } = await prepareRequest(input);
@@ -502,7 +503,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
annotations: destructive,
_meta: sharedVisibility,
}, safe(async (raw: Omit & { projectPath?: string; devices: MatrixDevice[]; apps?: { ios?: string; android?: string }; limit?: number }) => {
- const projectPathValue = resolveProject(raw.projectPath);
+ const projectPathValue = await resolveProject(raw.projectPath);
const stored = await readTestTarget(projectPathValue, raw.relativePath).catch(() => undefined);
const apps: { ios?: string; android?: string } = { ...(stored ? { [stored.platform]: stored.bundleId, ...stored.apps } : {}), ...raw.apps };
const input = { ...raw, projectPath: projectPathValue, apps };
@@ -540,7 +541,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
annotations: read,
_meta: sharedVisibility,
}, safe(async ({ matrixId }: { matrixId?: string }) => {
- if (panel) resolveProject();
+ if (panel) await resolveProject();
const run = matrixId ? registry.get(matrixId) : registry.latest();
if (matrixId && !run) throw new ExpectedOperationError("invalid_input", "That run is no longer available.");
if (!run) return dataResult({ running: false, progress: [], lanes: [], busyDevices: registry.busyDevices() });
@@ -555,7 +556,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
annotations: write,
_meta: sharedVisibility,
}, safe(async ({ matrixId, deviceId }: { matrixId: string; deviceId?: string }) => {
- if (panel) resolveProject();
+ if (panel) await resolveProject();
if (!registry.get(matrixId)) throw new ExpectedOperationError("invalid_input", "That run is no longer available.");
const cancelled = registry.cancel(matrixId, deviceId);
return dataResult({ cancelled: cancelled.map(lane => lane.deviceId) }, `Cancelled ${cancelled.length} lane${cancelled.length === 1 ? "" : "s"}.`);
@@ -572,7 +573,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
annotations: read,
_meta: sharedVisibility,
}, safe(async ({ platform, timeoutMs }: { platform: "ios" | "android"; timeoutMs?: number }) => {
- if (panel) resolveProject();
+ if (panel) await resolveProject();
const ops = matrix.ops;
if (!ops?.bootedDevices || !ops.foregroundApp) throw new ExpectedOperationError("unsupported_platform", "This server cannot read what is on a device's screen.");
const deadline = Date.now() + (timeoutMs ?? 120_000);
@@ -608,7 +609,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
annotations: destructive,
_meta: sharedVisibility,
}, safe(async ({ projectPath: selected, relativePath, line, platform, locator }: { projectPath?: string; relativePath: string; line: number; platform: "ios" | "android"; locator: string }) => {
- const project = resolveProject(selected);
+ const project = await resolveProject(selected);
if ((await inspectProject(project)).runtimeMode !== "bundled") throw new ExpectedOperationError("invalid_input", "Branching a line is for Studio tests; edit a project test in its own file.");
if (!singleExpression(locator) || !locator.startsWith("screen.")) throw new ExpectedOperationError("invalid_input", "locator must be one screen.getBy… expression on a single line.");
const source = await readTestFile(project, relativePath);
diff --git a/packages/core/test/mobile-dev-skill.test.ts b/packages/core/test/mobile-dev-skill.test.ts
index 9f8c72b4..bf3d4932 100644
--- a/packages/core/test/mobile-dev-skill.test.ts
+++ b/packages/core/test/mobile-dev-skill.test.ts
@@ -16,7 +16,12 @@ test("the testing skill records, hands over, and never saves or runs", async ()
const skill = await readFile(new URL("../../skills/mobile-dev-testing/SKILL.md", import.meta.url), "utf8");
assert.match(skill, /iOS or Android app/);
- assert.match(skill, /booted iOS simulator or Android emulator in the mirror/);
+ assert.match(skill, /Testing tab must be open/);
+ assert.match(skill, /Never ask the user for a project, device or target up front/);
+ // A closed tab is the agent's to open, not the user's.
+ assert.match(skill, /mobile_open_simulator\(\{ workspaceTool: "testing" \}\)/);
+ assert.match(skill, /Do not ask the user to open it/);
+ assert.doesNotMatch(skill, /tell the user to \*\*open Mobile Dev's Testing tab\*\*/);
// The loop, in the order the tools enforce it.
assert.match(skill, /mobile_testing_agent_begin.*mobile_testing_agent_screen.*mobile_testing_agent_step.*mobile_testing_agent_finish/s);
@@ -63,8 +68,8 @@ test("the testing skill teaches Studio mode: record saves, run, add the missing
const skill = await readFile(new URL("../../skills/mobile-dev-testing/SKILL.md", import.meta.url), "utf8");
assert.match(skill, /## Studio mode: record, run, repair/);
- // The tab must be open, and the agent says so rather than guessing a project.
- assert.match(skill, /tell the user to \*\*open Mobile Dev's Testing tab\*\*/);
+ // The tab must be open, and the agent opens it itself rather than guessing a project.
+ assert.match(skill, /open it yourself with `mobile_open_simulator\(\{ workspaceTool: "testing" \}\)`/);
// Record now saves, and says where.
assert.match(skill, /`mobile_testing_agent_finish` \*\*writes the test\*\*.*`relativePath`/s);
// Run: one device or several, and devices that are off are the matrix's to boot.
diff --git a/packages/core/test/plugin.test.ts b/packages/core/test/plugin.test.ts
index 0b0c999e..fa82e169 100644
--- a/packages/core/test/plugin.test.ts
+++ b/packages/core/test/plugin.test.ts
@@ -40,6 +40,11 @@ test("opening tools accept optional intent and preserve it in their results", as
const invalid = await client.callTool({ name, arguments: { platform: "android", kind: "simulator" } });
assert.equal(invalid.isError, true);
}
+ for (const name of ["mobile_open_simulator", "mobile_open_workspace"]) {
+ const testing = await client.callTool({ name, arguments: { workspaceTool: "testing" } });
+ assert.equal(testing.isError, undefined, "the Testing tab is a valid thing to open on");
+ assert.deepEqual(testing.structuredContent?.panelTarget, { workspaceTool: "testing" });
+ }
const appIntel = await client.callTool({ name: "mobile_open_app_intel", arguments: {} });
assert.equal(appIntel.isError, undefined);
assert.deepEqual(appIntel.structuredContent?.panelTarget, { workspaceTool: "app-intel" });
diff --git a/packages/core/test/testing-agent.test.ts b/packages/core/test/testing-agent.test.ts
index 8f6d4c50..b3b3b365 100644
--- a/packages/core/test/testing-agent.test.ts
+++ b/packages/core/test/testing-agent.test.ts
@@ -67,7 +67,7 @@ async function started(screens: TestingDeviceTree[] = [EXPLORE]) {
const drafts = new TestDraftStore(await mkdtemp(join(tmpdir(), "mobile-dev-agent-drafts-")));
const recordings = new TestingAgentRecordings(device.devices, drafts);
recordings.setContext(CONTEXT);
- recordings.begin({ title: "the explore details screen", goal: "cover the Explore Details landmarks" });
+ await recordings.begin({ title: "the explore details screen", goal: "cover the Explore Details landmarks" });
return { ...device, recordings, drafts };
}
@@ -76,15 +76,15 @@ test("a recording refuses to start when the panel has nothing selected", async (
const recordings = new TestingAgentRecordings(devices);
// No project and no device is not something to pick for the user: the project picker is an OS
// folder dialog, which must not open inside an agent's turn.
- assert.throws(() => recordings.begin({ title: "t", goal: "g" }), /an e2e project, no a booted simulator/);
- recordings.setContext({ ...CONTEXT, bundleId: "" });
- assert.throws(() => recordings.begin({ title: "t", goal: "g" }), /bundle id/);
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /The Testing tab is not open\. Call mobile_open_simulator with workspaceTool "testing"/);
+ recordings.setPanelProject("/project");
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /Boot an iOS simulator or Android emulator and mirror it/);
assert.equal(recordings.state().status, "idle");
});
test("a second recording is refused rather than stomping on the first", async () => {
const { recordings } = await started();
- assert.throws(() => recordings.begin({ title: "another", goal: "g" }), /already in flight/);
+ await assert.rejects(() => recordings.begin({ title: "another", goal: "g" }), /already in flight/);
assert.equal(recordings.state().title, "the explore details screen");
});
@@ -233,18 +233,18 @@ test("aborting keeps what was recorded and lets the next recording start", async
assert.equal(recordings.state().steps.length, 1, "whatever was recorded is the user's to keep");
// Aborting an idle recorder is not an error; the panel's Stop button can always be pressed.
assert.deepEqual(await recordings.abort({ reason: "again" }), { ok: true, steps: 1, wasRecording: false });
- recordings.begin({ title: "another", goal: "g" });
+ await recordings.begin({ title: "another", goal: "g" });
assert.deepEqual(recordings.state().steps, []);
});
-test("a selection the panel cannot act on clears the context rather than half-setting it", () => {
+test("a selection the panel cannot act on clears the context rather than half-setting it", async () => {
const { devices } = fakeDevices([EXPLORE]);
const recordings = new TestingAgentRecordings(devices);
const server = { registerTool: () => undefined, registerResource: () => undefined } as never;
registerTestingAgentTools(server, devices, recordings);
recordings.setContext(CONTEXT);
recordings.clearContext();
- assert.throws(() => recordings.begin({ title: "t", goal: "g" }), /Testing tab/);
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /Testing tab/);
});
test("the five model tools are visible to the model and the panel's two are not", () => {
@@ -326,7 +326,7 @@ test("the read a step already took is the read the next screen call answers with
const device = fakeDevices([EXPLORE, LIST]);
const recordings = new TestingAgentRecordings(device.devices);
recordings.setContext(CONTEXT);
- recordings.begin({ title: "t", goal: "g" });
+ await recordings.begin({ title: "t", goal: "g" });
const screen = await recordings.screen();
assert.equal(device.reads(), 1);
diff --git a/packages/core/test/testing-studio-agent.test.ts b/packages/core/test/testing-studio-agent.test.ts
index 9b75aad3..5c0af4cd 100644
--- a/packages/core/test/testing-studio-agent.test.ts
+++ b/packages/core/test/testing-studio-agent.test.ts
@@ -120,7 +120,7 @@ const fakeTreeDevices = () => ({ read: async () => TREE, perform: async () => un
async function recordHome(recordings: TestingAgentRecordings, studio: string, title = "the home screen") {
recordings.setContext({ projectPath: studio, deviceId: "11111111-2222-3333-4444-555555555555", platform: "android", bundleId: "com.app.android" });
- recordings.begin({ title, goal: "g" });
+ await recordings.begin({ title, goal: "g" });
const screen = await recordings.screen();
await recordings.step({ ref: screen.elements[0]!.ref, kind: "assertVisible" });
return recordings.finish({ note: "n" });
@@ -160,7 +160,7 @@ test("an empty recording saves nothing", async () => {
await withStudio(async studio => {
const recordings = new TestingAgentRecordings(fakeTreeDevices(), new TestDraftStore(join(studio, "drafts")));
recordings.setContext({ projectPath: studio, deviceId: "11111111-2222-3333-4444-555555555555", platform: "ios", bundleId: "com.app" });
- recordings.begin({ title: "nothing", goal: "g" });
+ await recordings.begin({ title: "nothing", goal: "g" });
const result = await recordings.finish({});
assert.equal(result.saved, false);
assert.deepEqual(await listTestFiles(studio), []);
@@ -369,13 +369,13 @@ test("a tab that stops reporting is closed: open, then stale, then refused, and
clock += 2_000;
const stale = await call("mobile_testing_tests");
assert.equal(stale.isError, true, "stale");
- assert.match(stale.content[0].text, /Testing tab is not open/);
+ assert.match(stale.content[0].text, /Testing tab is not open.*mobile_open_simulator/);
assert.equal(recordings.panelContext(), undefined, "the device selection goes with it");
- assert.throws(() => recordings.begin({ title: "t", goal: "g" }), /Testing tab/, "agent_begin refuses too");
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /Call mobile_open_simulator with workspaceTool "testing" to open it, then begin again/, "agent_begin refuses too");
await report();
assert.equal((await call("mobile_testing_tests")).isError, undefined, "a heartbeat revives it");
- assert.doesNotThrow(() => recordings.begin({ title: "t", goal: "g" }));
+ await recordings.begin({ title: "t", goal: "g" });
// Beating again keeps it alive past what one report would have lasted.
for (let beat = 0; beat < 4; beat++) { clock += 10_000; await report(); }
@@ -385,3 +385,133 @@ test("a tab that stops reporting is closed: open, then stale, then refused, and
assert.equal((await call("mobile_testing_tests")).isError, true);
});
});
+
+// ---- begin resolves what it can --------------------------------------------------------------------------------
+
+const IOS_ID = "11111111-2222-3333-4444-555555555555";
+const AUTO_OPS = (front: string | null, booted = [{ deviceId: IOS_ID, name: "iPhone 17 Pro" }]) => ({
+ bootedDevices: async (platform: string) => (platform === "ios" ? booted : []),
+ foregroundApp: async () => front,
+}) as unknown as DeviceOps;
+
+function autoRecordings(studio: string, ops: DeviceOps) {
+ return new TestingAgentRecordings(fakeTreeDevices(), new TestDraftStore(join(studio, "drafts")), { ops });
+}
+
+test("Studio begin needs only a booted device and a foreground app, and saves the test pinned to it", async () => {
+ await withStudio(async studio => {
+ const recordings = autoRecordings(studio, AUTO_OPS("com.example.notes"));
+ recordings.setPanelProject(studio);
+ const begun = await recordings.begin({ title: "open notes", goal: "g" });
+ assert.equal(begun.bundleId, "com.example.notes");
+ assert.equal(begun.deviceId, IOS_ID);
+ assert.match(begun.report ?? "", /com\.example\.notes.*foreground/);
+ const screen = await recordings.screen();
+ await recordings.step({ ref: screen.elements[0]!.ref, kind: "assertVisible" });
+ const done = await recordings.finish({});
+ assert.deepEqual(await readTestTarget(studio, done.relativePath!), { platform: "ios", bundleId: "com.example.notes" });
+ });
+});
+
+test("Studio begin ignores the home screen and says only the app is missing", async () => {
+ await withStudio(async studio => {
+ const recordings = autoRecordings(studio, AUTO_OPS("com.apple.springboard"));
+ recordings.setPanelProject(studio);
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), (error: Error) => {
+ assert.match(error.message, /^Cannot start recording yet\. Open the app to record in the foreground/);
+ assert.doesNotMatch(error.message, /Boot|Testing tab|project/);
+ return true;
+ });
+ });
+});
+
+test("with nothing booted begin asks to boot a device and, in Studio, to open the app", async () => {
+ await withStudio(async studio => {
+ const recordings = autoRecordings(studio, AUTO_OPS(null, []));
+ recordings.setPanelProject(studio);
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /Boot an iOS simulator or Android emulator.* Open the app to record.* Then begin again\.$/);
+ });
+});
+
+test("two booted devices and no mirrored one is a real ambiguity, so it asks which", async () => {
+ await withStudio(async studio => {
+ const recordings = autoRecordings(studio, AUTO_OPS("com.a", [{ deviceId: IOS_ID, name: "iPhone 17 Pro" }, { deviceId: "22222222-2222-3333-4444-555555555555", name: "iPhone 16" }]));
+ recordings.setPanelProject(studio);
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /Say which device to record on: iPhone 17 Pro, iPhone 16\./);
+ });
+});
+
+async function projectWith(targets: string[]) {
+ const dir = await mkdtemp(join(tmpdir(), "e2e-project-"));
+ const { writeFile, mkdir } = await import("node:fs/promises");
+ await writeFile(join(dir, "e2e.config.ts"), `export default { targets: [\n${targets.join(",\n")}\n] };\n`);
+ // What makes it a project rather than Studio: a project-local e2e CLI and its package version.
+ await mkdir(join(dir, "node_modules", ".bin"), { recursive: true });
+ await mkdir(join(dir, "node_modules", "e2e"), { recursive: true });
+ await writeFile(join(dir, "node_modules", ".bin", "e2e"), "");
+ await writeFile(join(dir, "node_modules", "e2e", "package.json"), JSON.stringify({ name: "e2e", version: "1.0.0" }));
+ return dir;
+}
+
+test("project mode picks the config target the foreground app matches, or the only one", async () => {
+ await withStudio(async studio => {
+ const dir = await projectWith([`{ name: "app", platform: "ios", bundleId: "com.example.app" }`]);
+ try {
+ const recordings = autoRecordings(studio, AUTO_OPS("com.example.app"));
+ recordings.setPanelProject(dir);
+ const { inspectProject } = await import("../src/testing-projects.ts");
+ assert.equal((await inspectProject(dir)).runtimeMode, "project");
+ assert.equal((await recordings.begin({ title: "t", goal: "g" })).bundleId, "com.example.app");
+ } finally { await rm(dir, { recursive: true, force: true }); }
+ });
+});
+
+test("ambiguous project mode asks which target, naming them", async () => {
+ await withStudio(async studio => {
+ const dir = await projectWith([`{ name: "alpha", platform: "ios", bundleId: "com.a" }`, `{ name: "beta", platform: "ios", bundleId: "com.b" }`]);
+ try {
+ const { inspectProject } = await import("../src/testing-projects.ts");
+ assert.equal((await inspectProject(dir)).runtimeMode, "project");
+ const recordings = autoRecordings(studio, AUTO_OPS("com.other"));
+ recordings.setPanelProject(dir);
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /Say which target to record: alpha, beta/);
+ const matching = autoRecordings(studio, AUTO_OPS("com.b"));
+ matching.setPanelProject(dir);
+ assert.equal((await matching.begin({ title: "t", goal: "g" })).bundleId, "com.b", "the foreground app picks between two targets");
+ } finally { await rm(dir, { recursive: true, force: true }); }
+ });
+});
+
+test("a closed Testing tab is the only thing begin reports", async () => {
+ await withStudio(async studio => {
+ const recordings = autoRecordings(studio, AUTO_OPS(null, []));
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), (error: Error) => error.message === "The Testing tab is not open. Call mobile_open_simulator with workspaceTool \"testing\" to open it, then begin again.");
+ });
+});
+
+test("a call made right after the tab was opened waits for its first report instead of refusing", async () => {
+ await withStudio(async studio => {
+ const { call, recordings } = setup({ ops: AUTO_OPS("com.example.notes") });
+ const auto = autoRecordings(studio, AUTO_OPS("com.example.notes"));
+ // Not opened and silent: refused at once.
+ await assert.rejects(() => auto.begin({ title: "t", goal: "g" }), /not open/);
+ assert.equal((await call("mobile_testing_tests")).isError, true);
+
+ // Opened, and the first heartbeat lands a moment later.
+ auto.expectPanel(2_000); recordings.expectPanel(2_000);
+ setTimeout(() => { auto.setPanelProject(studio); recordings.setPanelProject(studio); }, 120);
+ const begun = await auto.begin({ title: "t", goal: "g" });
+ assert.equal(begun.bundleId, "com.example.notes");
+ assert.equal((await call("mobile_testing_tests")).isError, undefined);
+ });
+});
+
+test("an opened tab that never reports is called closed once the grace period ends", async () => {
+ await withStudio(async studio => {
+ const recordings = autoRecordings(studio, AUTO_OPS("com.a"));
+ recordings.expectPanel(150);
+ const started = Date.now();
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /not open/);
+ assert.ok(Date.now() - started >= 140);
+ });
+});
diff --git a/packages/shared/src/panel-target.ts b/packages/shared/src/panel-target.ts
index d883403e..94df164d 100644
--- a/packages/shared/src/panel-target.ts
+++ b/packages/shared/src/panel-target.ts
@@ -4,7 +4,7 @@ import type { SimulatorDevice } from "./protocol.ts";
const platform = z.enum(["ios", "android"]).optional().describe("The task's established platform. Omit when undecided.");
const kind = z.enum(["simulator", "emulator", "physical"]).optional().describe("The requested device kind. Omit when undecided.");
export const deviceIdSchema = z.string().min(1).max(256).regex(/^[A-Za-z0-9_.:\[\]%-]+$/).describe("An exact device ID from device discovery. Omit to select a matching device automatically.");
-const workspaceTool = z.enum(["logs", "performance", "storage", "app-intel", "tracesift"]).optional().describe("A workspace tool to open. Omit for the device view.");
+const workspaceTool = z.enum(["logs", "performance", "storage", "app-intel", "tracesift", "testing"]).optional().describe("A workspace tool to open. Use testing to open the Testing tab, whether the panel is closed or already open. Omit for the device view.");
const appIntelScreen = z.string().min(1).max(512).optional().describe("An App Intelligence screen ID to focus when workspaceTool is app-intel, from mobile_app_intel's search or screen result. Omit to open on whatever screen the panel last showed.");
export const panelTargetSchema = z.object({ platform, kind, deviceId: deviceIdSchema.optional(), workspaceTool, appIntelScreen }).strict().superRefine((target, context) => {
diff --git a/packages/skills/mobile-dev-testing/SKILL.md b/packages/skills/mobile-dev-testing/SKILL.md
index fda25953..aa75564a 100644
--- a/packages/skills/mobile-dev-testing/SKILL.md
+++ b/packages/skills/mobile-dev-testing/SKILL.md
@@ -16,15 +16,24 @@ them are not yours to call. In **No project (Studio) mode** the flow is yours en
## Before you start
-The recording goes against whatever the Testing panel already has selected: an **e2e project**, a
-**booted iOS simulator or Android emulator in the mirror**, and a **target with a bundle id** in that project's
-`e2e.config.ts`. `mobile_testing_agent_begin` reads that selection and refuses, naming what is
-missing, when any of the three is unset.
-
-If it refuses, say which one is missing and ask the user to set it in Mobile Dev's Testing tab.
-**Never choose the project for them** — the picker is a system folder dialog, which must not open
-in the middle of your turn — and do not reach for another device because the chosen one is not
-booted. Open the panel with `mobile_open_simulator` if it is not open, and otherwise stop and ask.
+The **Testing tab must be open**; it is how Mobile Dev knows the user is looking. You open it
+yourself: whenever `begin` or a run tool says the Testing tab is not open, call
+`mobile_open_simulator({ workspaceTool: "testing" })` (it also switches an open view to that tab) and
+then call the tool again. Do not ask the user to open it; the call waits for the tab to report in.
+Past that,
+`mobile_testing_agent_begin` picks what is unambiguous and tells you in `picked`, so relay that to the
+user in a line:
+
+- **Device**: the one the mirror shows, else the only booted simulator or emulator.
+- **App**: in **No project (Studio) mode**, the app in the foreground (home screens and launchers
+ do not count); finishing saves the test pinned to it. In a **project**, the config target the
+ foreground app matches, else the project's only target for that platform.
+
+Never ask the user for a project, device or target up front, and never pass them to `begin`. If it
+refuses, the message names only what is missing, with one action each. Do those yourself when you
+can: boot a simulator (`mobile_boot_simulator`) or open the panel with `mobile_open_simulator`, then
+`begin` again. Ask the user only when the message says to: which of several devices or targets, an
+app that must be opened or installed by hand, or a decision only they can make. **Never choose the project for them** — the picker is a system folder dialog, which must not open in the middle of your turn — and do not reach for another device because the chosen one is not booted.
The app should already be on screen. The recorder attaches to the running app and never relaunches
it, so a flow recorded from a cold home screen is a flow the user will have to fix.
@@ -129,7 +138,8 @@ deliverable — the panel is showing it, live, next to the steps.
No project open — the Testing tab says Studio — means tests live in Mobile Dev's own storage, each
pinned to an app. The tab must be open: every tool below reads the tab's selection and refuses
-when it has none. Then tell the user to **open Mobile Dev's Testing tab** and stop. `projectPath`
+when it has none. Then open it yourself with `mobile_open_simulator({ workspaceTool: "testing" })` and
+call the tool again; do not ask the user. `projectPath`
is optional on all of them; it defaults to the tab's project.
### Record, which saves
From d709102d59623d4279db126056bd4bae96cb63e9 Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Thu, 19 Nov 2026 11:57:04 +0500
Subject: [PATCH 18/23] fix: agent driven usage
---
CONTRIBUTING.md | 2 +-
THIRD_PARTY_NOTICES.md | 2 +-
packages/core/src/panel-tools.ts | 2 +-
packages/core/src/plugin.ts | 33 +-
packages/core/src/testing-agent.ts | 33 +-
packages/core/src/testing-projects.ts | 26 +
.../core/test/agent-device-catalog.test.ts | 18 +-
.../test/agent-device-runtime-match.test.ts | 17 +
packages/core/test/agent-device-tools.test.ts | 7 +-
packages/core/test/mobile-dev-skill.test.ts | 5 +-
.../core/test/testing-agent-panel.test.ts | 56 ++
.../core/test/testing-chat-project.test.ts | 137 ++++
.../runtimes/agent-device/package-lock.json | 12 +-
packages/runtimes/agent-device/package.json | 4 +-
packages/runtimes/agent-device/tools.json | 692 ++++++++----------
packages/shared/src/panel-target.ts | 4 +-
.../agent-device/references/workflow.md | 4 +-
packages/skills/mobile-dev-testing/SKILL.md | 11 +-
packages/ui/src/testing-panel.ts | 35 +
tooling/update-dependencies.mjs | 6 +-
20 files changed, 672 insertions(+), 434 deletions(-)
create mode 100644 packages/core/test/agent-device-runtime-match.test.ts
create mode 100644 packages/core/test/testing-chat-project.test.ts
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ceb973ba..0917d582 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -141,7 +141,7 @@ relevant checks, and packaging steps again.
`vendor:agent-device` installs the exact npm packages in `packages/runtimes/agent-device/package-lock.json` with package scripts disabled. `build` copies this full runtime into `dist/agent-device`, records its integrity and lockfile hash in `release.json`, and copies the commands the plugin servers serve, `packages/runtimes/agent-device/tools.json`. After changing the pin, run `npm run catalog:agent-device` to rewrite that catalog and the agent-device skill's workflow guide (`packages/skills/agent-device/references/workflow.md`, the runtime's `help workflow`); unit tests check both against the pinned runtime, and the weekly dependency update rewrites them. The installed plugin needs no npm install or runtime download. Xcode compiles the shipped Apple runner source on its first use.
-agent-device is held at 0.21.33 in the weekly dependency updater. Versions 0.21.34 and 0.21.35 reject iOS input when an obsolete Xcode selection link points at a deleted installation, even when `xcode-select -p` and `xcrun` resolve the installed Xcode. See [upstream #3995](https://github.com/callstack/agent-device/pull/3995). Verify that case before raising the pin and removing the updater hold.
+agent-device is pinned by hand at the version `@e2e-dev/mobile` installs in `packages/runtimes/e2e` (0.21.37 now). The bundled e2e runner and Mobile Dev's own client share one agent-device state directory, so a newer runner daemon makes the older client refuse with "Daemon … is newer than this client". `agent-device-runtime-match.test.ts` fails when the two drift; the weekly dependency updater reports agent-device updates but does not apply them. Versions from 0.21.34 carry [upstream #3995](https://github.com/callstack/agent-device/pull/3995), which rejected iOS input when an obsolete Xcode selection link pointed at a deleted installation; check that case when raising the pin.
`build` also bundles JavaScript and CSS with esbuild and copies Baguette into `dist/baguette`. It does not run TypeScript, lint, Biome, visual checks, or React Doctor.
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
index cb199025..47369e08 100644
--- a/THIRD_PARTY_NOTICES.md
+++ b/THIRD_PARTY_NOTICES.md
@@ -8,7 +8,7 @@ This plugin includes [Baguette 0.2.1](https://github.com/tddworks/baguette/tree/
Native helpers statically link [Sentry Native 0.17.1](https://github.com/getsentry/sentry-native/tree/0.17.1), licensed under MIT. Its license and the Android libunwindstack and Linux syscall support licenses ship in each helper's `SENTRY-LICENSE.txt` or `third-party-licenses.txt`. Both Android collectors include the statically linked LLVM libc++ runtime's Apache-2.0 license with LLVM exceptions. Shared collector telemetry source ships in `dist/telemetry` beside the physical iOS log reader's source and build scripts.
-This plugin also includes [agent-device 0.21.33](https://github.com/callstack/agent-device/tree/v0.21.33) by Callstack under the MIT License. Its license sits at `dist/agent-device/node_modules/agent-device/LICENSE`. The package includes the official npm release, its Apple runner source, and its bundled JavaScript dependencies. `runtimes/agent-device/package-lock.json` pins the package and its integrity hash. `dist/agent-device/release.json` records the npm archive, integrity hash, and lockfile SHA-256. The agent-device skill's workflow guide, `skills/agent-device/references/workflow.md`, is that CLI version's `help workflow` output.
+This plugin also includes [agent-device 0.21.37](https://github.com/callstack/agent-device/tree/v0.21.37) by Callstack under the MIT License. Its license sits at `dist/agent-device/node_modules/agent-device/LICENSE`. The package includes the official npm release, its Apple runner source, and its bundled JavaScript dependencies. `runtimes/agent-device/package-lock.json` pins the package and its integrity hash. `dist/agent-device/release.json` records the npm archive, integrity hash, and lockfile SHA-256. The agent-device skill's workflow guide, `skills/agent-device/references/workflow.md`, is that CLI version's `help workflow` output.
The Baguette MCP server and panel bundle the Model Context Protocol SDK, MCP Apps SDK, OpenAI MCP Extensions, Zod, ws, React, Radix UI, Legend List, Sentry's React and Node SDKs, and their required JavaScript code. The panel uses shadcn/ui components under the MIT License and Tailwind CSS styles. It bundles Lucide icons under the ISC License, with Feather icons under the MIT License and Inter under the SIL Open Font License 1.1. `dist/third-party-licenses.txt` contains their licenses. The build preserves bundled license comments too.
diff --git a/packages/core/src/panel-tools.ts b/packages/core/src/panel-tools.ts
index e9f6a99c..2ea91a4e 100644
--- a/packages/core/src/panel-tools.ts
+++ b/packages/core/src/panel-tools.ts
@@ -260,7 +260,7 @@ function registerPanel(server: McpServer, { android, cpu, fps, drivers, page, sh
});
openingTool("mobile_open_simulator", {
- description: "Open Mobile Dev alongside the chat for local mobile app development, before the first device launch unless a view is open or the workflow is tool-only. Pass established platform, kind, or discovered deviceId to select the initial device; omit undecided fields. Pass workspaceTool \"testing\" to open (or switch an open view to) the Testing tab, which e2e recording and test runs need. Starts the bundled backend without booting devices.",
+ description: "Open Mobile Dev alongside the chat for local mobile app development, before the first device launch unless a view is open or the workflow is tool-only. Pass established platform, kind, or discovered deviceId to select the initial device; omit undecided fields. Pass workspaceTool \"testing\" to open (or switch an open view to) the Testing tab, which e2e recording and test runs need; with it, pass projectPath, your workspace root (\"\" when the chat has no project), so the tab selects that project, or No project for a folder that is not one. Starts the bundled backend without booting devices.",
resourceUri: APP_URI, entrypoint: "thread",
});
diff --git a/packages/core/src/plugin.ts b/packages/core/src/plugin.ts
index c7c22036..433896ab 100644
--- a/packages/core/src/plugin.ts
+++ b/packages/core/src/plugin.ts
@@ -1,3 +1,4 @@
+import { fileURLToPath } from "node:url";
import type { UIResource } from "./ui-resource.ts";
import type { PanelOpener, ServerFeature } from "./server-feature.ts";
import type { SharedTransport } from "./shared-transport.ts";
@@ -6,7 +7,7 @@ import { LIVE_UI_URI } from "@mobile-dev/shared/live-ui.ts";
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
import { PLUGIN_VERSION } from "@mobile-dev/shared/version.ts";
import { SENTRY_ORIGIN } from "@mobile-dev/shared/telemetry.ts";
-import { instrumentMcpServer, setServerTelemetryHost } from "./telemetry.ts";
+import { captureServerError, instrumentMcpServer, setServerTelemetryHost } from "./telemetry.ts";
import { instrumentProductAnalytics } from "./analytics.ts";
import { resolveTelemetryEnvironment } from "./telemetry-environment.ts";
import { getTelemetryIdentity } from "./telemetry-identity.ts";
@@ -22,7 +23,7 @@ import { registerTestingTools } from "./testing-tools.ts";
import { systemDeviceOps } from "./testing-prepare.ts";
import { registerTestingAgentTools } from "./testing-agent.ts";
import { TestingDevices } from "./testing-device.ts";
-import { TESTING_DIRECTORY, TestingProjectChoices } from "./testing-projects.ts";
+import { TESTING_DIRECTORY, TestingProjectChoices, isChatProject } from "./testing-projects.ts";
import { TestDraftStore } from "./testing-drafts.ts";
import { TestingAgentRecordings } from "./testing-agent.ts";
import { ServeEmu } from "./serve-emu.ts";
@@ -132,7 +133,8 @@ export async function createPlugin(html: string | (() => Promise), o
foreground: async (platform, deviceId) => (await readDeviceApps(deviceId, undefined, platform, platform === "ios" ? "simulator" : undefined, { ...deviceAppSources, simulator: simulatorForeground })).foregroundApp?.bundleId ?? null,
});
const testingRecordings = new TestingAgentRecordings(testingDevices, testDrafts, { ops: testingOps });
- const closeTestingDevices = registerTestingTools(server, new TestingProjectChoices(TESTING_DIRECTORY), testingDevices, testDrafts, {
+ const testingProjects = new TestingProjectChoices(TESTING_DIRECTORY);
+ const closeTestingDevices = registerTestingTools(server, testingProjects, testingDevices, testDrafts, {
ops: testingOps,
panel: testingRecordings,
});
@@ -169,11 +171,34 @@ export async function createPlugin(html: string | (() => Promise), o
// Devices cards that chats saved from earlier releases say they came from one.
registerEarlierReleases(server, "mobile-dev-devices-earlier", "devices", readCard("devices"));
const panelOpeners: PanelOpener[] = [];
+ /**
+ * Makes the Testing tab show the chat's project. The chat's workspace root comes from the agent
+ * (`projectPath`), else from the host's MCP roots when it offers them. A root that is no project
+ * (a scratch folder) selects No project; with neither signal the panel keeps its own selection.
+ */
+ async function followChatProject(given?: string) {
+ try {
+ const root = given ?? await clientRoot();
+ if (root === undefined) return;
+ const listed = await testingProjects.list().catch(() => []);
+ testingRecordings.requestPanelProject(root && await isChatProject(root, listed) ? root : undefined);
+ } catch (error) { captureServerError(error, "testing.chat_project"); }
+ }
+ async function clientRoot(): Promise {
+ if (!server.server.getClientCapabilities()?.roots) return undefined;
+ try {
+ const { roots } = await server.server.listRoots(undefined, { timeout: 2000 });
+ const uri = roots.find(root => root.uri.startsWith("file:"))?.uri;
+ return uri ? fileURLToPath(uri) : "";
+ } catch { return undefined; }
+ }
// One place shows the panel beyond the host; the first feature that offers one wins.
const opened: PanelOpener = async open => {
// The Testing tab beats a moment after it loads; calls made in between wait for it rather than refuse.
testingRecordings.expectPanel();
- const openings = await Promise.all(panelOpeners.map(opener => opener(open)));
+ const { projectPath, ...target } = open.target;
+ if (target.workspaceTool === "testing") await followChatProject(projectPath);
+ const openings = await Promise.all(panelOpeners.map(opener => opener({ ...open, target })));
return openings.find(opening => opening !== undefined);
};
const closePanel = panel?.register(server, { android, cpu, fps, drivers, page, showRecording, opened });
diff --git a/packages/core/src/testing-agent.ts b/packages/core/src/testing-agent.ts
index 98e9f55a..332f7eec 100644
--- a/packages/core/src/testing-agent.ts
+++ b/packages/core/src/testing-agent.ts
@@ -20,7 +20,7 @@ import type { TestingDeviceTarget } from "./testing-device.ts";
import { captureServerError, recordTestingAgentRead } from "./telemetry.ts";
import { LAUNCHER_APP } from "./testing-prepare.ts";
import type { DeviceOps } from "./testing-prepare.ts";
-import { inspectProject, writeTestFile, writeTestTarget } from "./testing-projects.ts";
+import { inspectProject, sameProjectPath, studioWorkspacePath, writeTestFile, writeTestTarget } from "./testing-projects.ts";
/**
* Recording an e2e test from the user's own coding agent, into the Testing panel the user is
@@ -57,6 +57,8 @@ export { PANEL_HEARTBEAT_MS };
export const PANEL_EXPIRY_MS = PANEL_HEARTBEAT_MS * 3;
/** How long after an open a call waits for the panel's first report before calling the tab closed. */
export const PANEL_OPEN_GRACE_MS = 15_000;
+/** How long an agent's project request stays pending for a panel document that loads late. */
+export const PROJECT_REQUEST_TTL_MS = 60_000;
/** What the panel's selection is, as the panel reports it. Nothing here is inferred. */
export type TestingAgentContext = { projectPath: string; deviceId: string; platform: "ios" | "android"; bundleId: string };
@@ -214,6 +216,9 @@ export class TestingAgentRecordings {
/** `Date.now()` until which a silent panel is believed to be loading rather than closed. */
private expectUntil = 0;
private revision = 0;
+ /** The project an agent asked the panel to show when it opened it: a folder, or Studio's workspace. */
+ private projectRequest?: { id: number; path: string; at: number };
+ private projectRequests = 0;
/** When the panel last reported, on `now`'s clock; 0 before the first report. */
private reportedAt = 0;
@@ -254,11 +259,31 @@ export class TestingAgentRecordings {
* report instead of refusing: a tool call returns before the iframe has loaded and beat once.
*/
expectPanel(graceMs = PANEL_OPEN_GRACE_MS) { this.expectUntil = Date.now() + graceMs; }
+ /**
+ * An agent opened the Testing tab for a chat: the panel selects this project once, however it was
+ * last used. `undefined` asks for No project. Only an agent's open sets it, so a project the user
+ * picks afterwards is theirs.
+ */
+ requestPanelProject(projectPath?: string) {
+ this.projectRequest = { id: ++this.projectRequests, path: projectPath ?? studioWorkspacePath(), at: this.now() };
+ this.expectPanel();
+ }
+ /** The pending request for the panel to apply, while it is fresh. */
+ panelProjectRequest(): { id: number; path: string } | null {
+ const request = this.projectRequest;
+ if (!request || this.now() - request.at > PROJECT_REQUEST_TTL_MS) return null;
+ return { id: request.id, path: request.path };
+ }
+ /** The requested project when the panel has not switched to it yet. */
+ unmetProjectRequest(): string | undefined {
+ const request = this.panelProjectRequest();
+ return request && !(this.panelProject && sameProjectPath(this.panelProject, request.path)) ? request.path : undefined;
+ }
/** The panel's project, waiting up to the grace period when the panel was just opened and has not reported yet. */
async awaitPanelProject(): Promise {
for (;;) {
const project = this.panelProjectPath();
- if (project || Date.now() >= this.expectUntil) return project;
+ if (project && !this.unmetProjectRequest() || Date.now() >= this.expectUntil) return project;
await new Promise(resolve => setTimeout(resolve, 50));
}
}
@@ -308,6 +333,8 @@ export class TestingAgentRecordings {
}
const projectPath = await this.awaitPanelProject() ?? this.context?.projectPath ?? "";
if (!projectPath) refused("The Testing tab is not open. Call mobile_open_simulator with workspaceTool \"testing\" to open it, then begin again.");
+ const unmet = this.unmetProjectRequest();
+ if (unmet) refused(`The Testing tab has not switched to ${sameProjectPath(unmet, studioWorkspacePath()) ? "No project" : unmet} yet. Try again in a moment, or call mobile_open_simulator with workspaceTool "testing" again.`);
const context = await this.resolveTarget(projectPath);
this.session = {
target: { deviceId: context.deviceId, platform: context.platform, projectPath: context.projectPath, bundleId: context.bundleId },
@@ -760,7 +787,7 @@ export function registerTestingAgentTools(server: McpServer, devices: TestingDev
inputSchema: {},
annotations: read,
_meta: appVisibility,
- }, safe(() => dataResult({ ...recordings.state() })));
+ }, safe(() => dataResult({ ...recordings.state(), projectRequest: recordings.panelProjectRequest() })));
registerAppTool(server, "mobile_testing_set_context", {
title: "Report the Testing panel's selection",
diff --git a/packages/core/src/testing-projects.ts b/packages/core/src/testing-projects.ts
index b2708750..7ae14de2 100644
--- a/packages/core/src/testing-projects.ts
+++ b/packages/core/src/testing-projects.ts
@@ -90,6 +90,32 @@ export function studioWorkspacePath(): string {
return normalize(join(stateRoot, "studio-workspace"));
}
+/**
+ * Whether a chat's working directory is a mobile project the Testing panel can work in: a project
+ * the panel already lists, or a folder carrying a project marker (a package manifest, an Expo
+ * config, an e2e config, a native iOS or Android project). A scratch folder holds none of these, so
+ * it is not a project and the panel records in No project (Studio) instead.
+ */
+export async function isChatProject(directory: string, known: readonly { path: string }[] = []): Promise {
+ const path = normalize(directory.trim());
+ if (!path || !isAbsolute(path) || !(await isDirectory(path))) return false;
+ if (same(path, studioWorkspacePath())) return false;
+ if (known.some(entry => same(entry.path, path))) return true;
+ const files = ["package.json", "app.json", "app.config.ts", "app.config.js", "app.config.json", "Package.swift", "Podfile", "pubspec.yaml", "build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts", ...CONFIG_FILES];
+ for (const file of files) if (await isFile(join(path, file))) return true;
+ const entries = await readdir(path).catch(() => [] as string[]);
+ if (entries.some(name => name.endsWith(".xcodeproj") || name.endsWith(".xcworkspace"))) return true;
+ for (const native of ["ios", "android"]) {
+ if (!(await isDirectory(join(path, native)))) continue;
+ const inner = await readdir(join(path, native)).catch(() => [] as string[]);
+ if (inner.some(name => name.endsWith(".xcodeproj") || name.endsWith(".xcworkspace") || name.startsWith("build.gradle") || name === "Podfile")) return true;
+ }
+ return false;
+}
+
+/** Whether two project paths name the same folder. */
+export function sameProjectPath(left: string, right: string): boolean { return same(left, right); }
+
/** The e2e config file of a project folder, or undefined when it holds none. */
export async function findConfig(projectPath: string): Promise {
for (const file of CONFIG_FILES) {
diff --git a/packages/core/test/agent-device-catalog.test.ts b/packages/core/test/agent-device-catalog.test.ts
index 31cb3039..0f04f00f 100644
--- a/packages/core/test/agent-device-catalog.test.ts
+++ b/packages/core/test/agent-device-catalog.test.ts
@@ -31,11 +31,11 @@ test("compact catalog keeps all official operations, output contracts and typed
const press = tool("press");
const upstreamPress = upstreamCatalog.tools.find(candidate => candidate.name === "press");
assert.ok(upstreamPress);
- const target = press.inputSchema.properties?.target;
- assert.ok(target && "oneOf" in target);
- const originalTarget = upstreamPress.inputSchema.properties?.target;
- assert.ok(originalTarget && "oneOf" in originalTarget);
- assert.deepEqual(target.oneOf, originalTarget.oneOf);
+ // 0.21.37 names the element with one of ref, selector or x+y instead of a typed target union.
+ for (const name of ["ref", "selector", "x", "y"]) {
+ assert.ok(press.inputSchema.properties?.[name], `press takes ${name}`);
+ assert.deepEqual(press.inputSchema.properties?.[name], upstreamPress.inputSchema.properties?.[name]);
+ }
assert.deepEqual(press.inputSchema.properties?.timeoutMs, upstreamPress.inputSchema.properties?.timeoutMs);
});
@@ -63,12 +63,12 @@ test("device selection belongs to setup and discovery while interactions require
test("packaged defaults do not bypass native session device binding", async () => {
const configUrl = new URL("../../runtimes/agent-device/config.json", import.meta.url);
const cliConfigUrl = new URL("../../runtimes/agent-device/node_modules/agent-device/dist/src/cli-config.js", import.meta.url);
- // These exports belong to the pinned 0.21.33 runtime; keep this check with its version update.
+ // These exports belong to the pinned 0.21.37 runtime; keep this check with its version update.
const configuration = await import(cliConfigUrl.href);
- assert.equal(typeof configuration.t, "function");
+ assert.equal(typeof configuration.r, "function");
for (const command of ["snapshot", "press", "close"]) {
- const defaults = configuration.t({ command, cwd: "/", cliFlags: { session: "android-task" }, env: { AGENT_DEVICE_CONFIG: configUrl.pathname } });
- assert.deepEqual(defaults, {}, `${command} defaults must reuse the existing native session`);
+ const defaults = configuration.r({ command, cwd: "/", cliFlags: { session: "android-task" }, env: { AGENT_DEVICE_CONFIG: configUrl.pathname } });
+ assert.deepEqual(defaults, { flags: {} }, `${command} defaults must reuse the existing native session`);
}
});
diff --git a/packages/core/test/agent-device-runtime-match.test.ts b/packages/core/test/agent-device-runtime-match.test.ts
new file mode 100644
index 00000000..73339dcc
--- /dev/null
+++ b/packages/core/test/agent-device-runtime-match.test.ts
@@ -0,0 +1,17 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { readFile } from "node:fs/promises";
+
+async function lockedAgentDevice(runtime: string): Promise {
+ const lock = JSON.parse(await readFile(new URL(`../../runtimes/${runtime}/package-lock.json`, import.meta.url), "utf8"));
+ const version = lock.packages?.["node_modules/agent-device"]?.version;
+ assert.equal(typeof version, "string", `${runtime} runtime locks agent-device`);
+ return version;
+}
+
+test("Mobile Dev's agent-device matches the one the bundled e2e runner uses", async () => {
+ // Both share one state directory (BUNDLED_STATE_DIR is the app's pinned directory), and a daemon
+ // started by a newer runner makes the older client refuse: "Daemon (…, v0.21.37) is newer than
+ // this client (v0.21.33)". Android locator capture after a failed run then fails.
+ assert.equal(await lockedAgentDevice("agent-device"), await lockedAgentDevice("e2e"));
+});
diff --git a/packages/core/test/agent-device-tools.test.ts b/packages/core/test/agent-device-tools.test.ts
index 1a75d027..423b448b 100644
--- a/packages/core/test/agent-device-tools.test.ts
+++ b/packages/core/test/agent-device-tools.test.ts
@@ -18,7 +18,7 @@ test("agent-device commands are device_ tools with their compact schemas, and li
for (const name of ["device_open", "device_snapshot", "device_press", "device_fill", "device_batch", "device_devices"]) assert.ok(names.includes(name), name);
for (const name of ["device_logs", "device_perf", "open", "logs"]) assert.equal(names.includes(name), false, name);
const press = tools.find(tool => tool.name === "device_press");
- assert.deepEqual(press?.inputSchema.required?.toSorted(), ["session", "target"]);
+ assert.deepEqual(press?.inputSchema.required?.toSorted(), ["session"]);
assert.equal(counts().connections, 0);
});
@@ -27,8 +27,7 @@ test("forwarding preserves named sessions, metadata and native results without r
const metadata = { "sentry-trace": "1234567890abcdef1234567890abcdef-1234567890abcdef-0" };
await client.callTool({ name: "device_open", arguments: { session: "ios-task", app: "Example", platform: "ios", udid: "selected-ios" } });
await client.callTool({ name: "device_open", arguments: { session: "android-task", app: "Example", platform: "android", serial: "selected-android" } });
- const target = { kind: "ref", ref: "@e1" };
- const input = { session: "android-task", target, settle: true };
+ const input = { session: "android-task", ref: "@e1", settle: true };
const returned = await client.callTool({ name: "device_press", arguments: input, _meta: metadata });
assert.deepEqual(returned, result);
assert.deepEqual(calls[2], { name: "press", arguments: input, _meta: metadata });
@@ -135,7 +134,7 @@ test("batch steps obey each command's schema and inherit the outer session", asy
const rejected = await client.callTool({ name: "device_batch", arguments: { session: "task", steps: [{ command: "snapshot", input }] } });
assert.equal(rejected.isError, true);
}
- const press = await client.callTool({ name: "device_batch", arguments: { session: "task", steps: [{ command: "press", input: {} }] } });
+ const press = await client.callTool({ name: "device_batch", arguments: { session: "task", steps: [{ command: "press", input: { ref: 1 } }] } });
assert.match(text(press), /Batch step 1: Invalid press arguments/);
const omitted = await client.callTool({ name: "device_batch", arguments: { session: "task", steps: [{ command: "logs", input: {} }] } });
assert.match(text(omitted), /Unknown Agent Device command: logs/);
diff --git a/packages/core/test/mobile-dev-skill.test.ts b/packages/core/test/mobile-dev-skill.test.ts
index bf3d4932..e405198b 100644
--- a/packages/core/test/mobile-dev-skill.test.ts
+++ b/packages/core/test/mobile-dev-skill.test.ts
@@ -19,7 +19,8 @@ test("the testing skill records, hands over, and never saves or runs", async ()
assert.match(skill, /Testing tab must be open/);
assert.match(skill, /Never ask the user for a project, device or target up front/);
// A closed tab is the agent's to open, not the user's.
- assert.match(skill, /mobile_open_simulator\(\{ workspaceTool: "testing" \}\)/);
+ assert.match(skill, /mobile_open_simulator\(\{ workspaceTool: "testing", projectPath \}\)/);
+ assert.match(skill, /Always pass `projectPath`: your workspace root/, "the tab follows the chat's project");
assert.match(skill, /Do not ask the user to open it/);
assert.doesNotMatch(skill, /tell the user to \*\*open Mobile Dev's Testing tab\*\*/);
@@ -69,7 +70,7 @@ test("the testing skill teaches Studio mode: record saves, run, add the missing
assert.match(skill, /## Studio mode: record, run, repair/);
// The tab must be open, and the agent opens it itself rather than guessing a project.
- assert.match(skill, /open it yourself with `mobile_open_simulator\(\{ workspaceTool: "testing" \}\)`/);
+ assert.match(skill, /open it yourself with `mobile_open_simulator\(\{ workspaceTool: "testing", projectPath \}\)`/);
// Record now saves, and says where.
assert.match(skill, /`mobile_testing_agent_finish` \*\*writes the test\*\*.*`relativePath`/s);
// Run: one device or several, and devices that are off are the matrix's to boot.
diff --git a/packages/core/test/testing-agent-panel.test.ts b/packages/core/test/testing-agent-panel.test.ts
index 0c145a83..6749726d 100644
--- a/packages/core/test/testing-agent-panel.test.ts
+++ b/packages/core/test/testing-agent-panel.test.ts
@@ -252,3 +252,59 @@ test("an open, visible tab re-sends its selection on a heartbeat, and tells the
await tick();
assert.deepEqual(context().at(-1)?.arguments, { projectPath: "", deviceId: "", bundleId: "" }, "leaving clears the context on a best-effort basis");
});
+
+/** Waits for the panel to settle on a project, since a selection loads its config over several calls. */
+async function settled(panel: any, projectPath: string) {
+ for (let attempt = 0; attempt < 100 && panel.getSnapshot().projectPath !== projectPath; attempt++) await new Promise(resolve => setTimeout(resolve, 5));
+ assert.equal(panel.getSnapshot().projectPath, projectPath);
+}
+
+function projectScript(env: Awaited>) {
+ env.responses.mobile_testing_projects = () => ({ projects: [{ path: "/work/expoapp57", name: "expoapp57" }], studioPath: "/studio" });
+ env.responses.mobile_testing_choose_project = () => {
+ const request = [...env.calls].reverse().find(entry => entry.name === "mobile_testing_choose_project")!;
+ const path = String(request.arguments.projectPath);
+ return { project: { path, name: path.split("/").pop() } };
+ };
+}
+
+test("an agent's No project request beats the last-used project when the panel opens", async t => {
+ const env = await panelEnvironment(t);
+ projectScript(env);
+ env.agent.projectRequest = { id: 1, path: "/studio" };
+ env.panel.setAvailable(true);
+ await new Promise(resolve => setTimeout(resolve, 200));
+ await settled(env.panel, "/studio");
+ assert.equal(env.calls.some(entry => entry.name === "mobile_testing_choose_project"), false, "Studio is not a folder to record");
+});
+
+test("an agent's No project request switches a panel already on another project, once", async t => {
+ const env = await panelEnvironment(t);
+ projectScript(env);
+ env.panel.setAvailable(true);
+ await settled(env.panel, "/work/expoapp57");
+ env.agent.projectRequest = { id: 1, path: "/studio" };
+ await (env.panel as any).readAgentState();
+ await settled(env.panel, "/studio");
+ // The user picks a project by hand; the same request is still pending on the server.
+ await env.panel.chooseProject("/work/expoapp57");
+ await settled(env.panel, "/work/expoapp57");
+ await new Promise(resolve => setTimeout(resolve, 30));
+ assert.equal(env.panel.getSnapshot().projectPath, "/work/expoapp57", "an applied request is not applied again");
+ env.agent.projectRequest = { id: 2, path: "/studio" };
+ await (env.panel as any).readAgentState();
+ await settled(env.panel, "/studio");
+});
+
+test("an agent's project is selected and added to the list when the panel does not list it", async t => {
+ const env = await panelEnvironment(t);
+ projectScript(env);
+ env.panel.setAvailable(true);
+ await settled(env.panel, "/work/expoapp57");
+ env.agent.projectRequest = { id: 1, path: "/work/new-app" };
+ await (env.panel as any).readAgentState();
+ await settled(env.panel, "/work/new-app");
+ const added = env.calls.filter(entry => entry.name === "mobile_testing_choose_project");
+ assert.deepEqual(added.map(entry => entry.arguments), [{ projectPath: "/work/new-app" }], "added by path, never through the folder dialog");
+ assert.ok(env.panel.getSnapshot().projects.some((entry: any) => entry.path === "/work/new-app"));
+});
diff --git a/packages/core/test/testing-chat-project.test.ts b/packages/core/test/testing-chat-project.test.ts
new file mode 100644
index 00000000..bf68a986
--- /dev/null
+++ b/packages/core/test/testing-chat-project.test.ts
@@ -0,0 +1,137 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { pathToFileURL } from "node:url";
+import { Client } from "@modelcontextprotocol/sdk/client/index.js";
+import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
+import { ListRootsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
+import { TestingAgentRecordings } from "../src/testing-agent.ts";
+import { TestingDevices } from "../src/testing-device.ts";
+import { isChatProject, studioWorkspacePath } from "../src/testing-projects.ts";
+import { createPanel } from "../src/panel-tools.ts";
+import { Baguette } from "../src/baguette.ts";
+import { createTestPlugin, fakeBaguette, fakeSimulatorInput } from "../../test-support/fixtures.ts";
+
+async function scratch(body: (root: string) => Promise) {
+ const root = await mkdtemp(join(tmpdir(), "chat-project-"));
+ const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
+ process.env.MOBILE_DEV_TESTING_DIRECTORY = join(root, "state");
+ try { await body(root); }
+ finally {
+ if (previous === undefined) delete process.env.MOBILE_DEV_TESTING_DIRECTORY; else process.env.MOBILE_DEV_TESTING_DIRECTORY = previous;
+ await rm(root, { recursive: true, force: true });
+ }
+}
+
+test("a folder is a project only when it carries a project marker", async () => {
+ await scratch(async root => {
+ const empty = join(root, "Codex/2026-11-18/use");
+ await mkdir(empty, { recursive: true });
+ await writeFile(join(empty, "notes.md"), "scratch");
+ assert.equal(await isChatProject(empty), false, "a scratch folder is not a project");
+ assert.equal(await isChatProject(join(root, "missing")), false);
+ assert.equal(await isChatProject("relative/path"), false);
+ assert.equal(await isChatProject(studioWorkspacePath()), false, "Studio's own workspace is No project");
+
+ const expo = join(root, "expo"); await mkdir(expo);
+ await writeFile(join(expo, "package.json"), "{}");
+ assert.equal(await isChatProject(expo), true);
+ const native = join(root, "native"); await mkdir(join(native, "ios/App.xcodeproj"), { recursive: true });
+ assert.equal(await isChatProject(native), true, "a native iOS project counts");
+ const listed = join(root, "listed"); await mkdir(listed);
+ assert.equal(await isChatProject(listed), false);
+ assert.equal(await isChatProject(listed, [{ path: listed }]), true, "a project the panel already lists counts");
+ });
+});
+
+function recordings(now: { at: number }) {
+ return new TestingAgentRecordings({} as unknown as TestingDevices, undefined, { now: () => now.at });
+}
+
+test("an agent's project request is held for the panel until it reports that project", async () => {
+ await scratch(async () => {
+ const clock = { at: 1_000 };
+ const rec = recordings(clock);
+ assert.equal(rec.panelProjectRequest(), null, "nothing asked: the panel keeps its own selection");
+ rec.requestPanelProject();
+ assert.deepEqual(rec.panelProjectRequest(), { id: 1, path: studioWorkspacePath() }, "no project asks for Studio");
+ rec.setPanelProject("/work/expoapp57");
+ assert.equal(rec.unmetProjectRequest(), studioWorkspacePath(), "the old project is not the requested one");
+ setTimeout(() => rec.setPanelProject(studioWorkspacePath()), 100);
+ assert.equal(await rec.awaitPanelProject(), studioWorkspacePath(), "calls wait for the panel to switch");
+ assert.equal(rec.unmetProjectRequest(), undefined);
+ rec.requestPanelProject("/work/app");
+ assert.equal(rec.panelProjectRequest()?.id, 2);
+ clock.at += 61_000;
+ assert.equal(rec.panelProjectRequest(), null, "a stale request is not applied by a panel that loads much later");
+ });
+});
+
+test("begin refuses to record on the old project while a request is unmet", async () => {
+ await scratch(async () => {
+ const rec = recordings({ at: Date.now() });
+ rec.setPanelProject("/work/expoapp57");
+ rec.requestPanelProject();
+ await assert.rejects(() => rec.begin({ title: "t", goal: "g" }), /has not switched to No project yet/);
+ });
+});
+
+async function openPlugin(t: test.TestContext, roots?: string[]) {
+ const fake = await fakeBaguette();
+ const plugin = await createTestPlugin("", { panel: createPanel({ baguette: new Baguette(fake.url), simulatorInput: fakeSimulatorInput() }) });
+ const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
+ const client = new Client({ name: "chat-project-test", version: "1" }, roots ? { capabilities: { roots: {} } } : {});
+ if (roots) client.setRequestHandler(ListRootsRequestSchema, async () => ({ roots: roots.map(path => ({ uri: pathToFileURL(path).href })) }));
+ t.after(async () => { await client.close(); await plugin.close(); await fake.close(); });
+ await plugin.server.connect(serverTransport);
+ await client.connect(clientTransport);
+ const open = (args: Record) => client.callTool({ name: "mobile_open_simulator", arguments: { workspaceTool: "testing", ...args } });
+ const request = async () => (await client.callTool({ name: "mobile_testing_agent_state", arguments: {} })).structuredContent?.projectRequest;
+ return { open, request, client };
+}
+
+test("opening the Testing tab for a chat with no project asks for No project", async t => {
+ await scratch(async root => {
+ const folder = join(root, "Codex/2026-11-18/use"); await mkdir(folder, { recursive: true });
+ const { open, request } = await openPlugin(t);
+ const result = await open({ projectPath: folder });
+ assert.equal(result.isError, undefined);
+ assert.deepEqual((result.structuredContent?.panelTarget as Record).workspaceTool, "testing");
+ assert.equal((await request() as { path: string }).path, studioWorkspacePath());
+ await open({ projectPath: "" });
+ assert.equal((await request() as { id: number; path: string }).id, 2, "an empty path says there is no project");
+ });
+});
+
+test("opening the Testing tab for a chat with a project asks for that project", async t => {
+ await scratch(async root => {
+ const project = join(root, "my-app"); await mkdir(project);
+ await writeFile(join(project, "package.json"), "{}");
+ const { open, request } = await openPlugin(t);
+ await open({ projectPath: project });
+ assert.equal((await request() as { path: string }).path, project);
+ });
+});
+
+test("without a project path or roots, opening leaves the panel's own selection alone", async t => {
+ await scratch(async () => {
+ const { open, request } = await openPlugin(t);
+ await open({});
+ assert.equal(await request(), null);
+ });
+});
+
+test("a host's MCP root stands in for the project path", async t => {
+ await scratch(async root => {
+ const project = join(root, "rooted"); await mkdir(project);
+ await writeFile(join(project, "app.json"), "{}");
+ const { open, request } = await openPlugin(t, [project]);
+ await open({});
+ assert.equal((await request() as { path: string }).path, project);
+ const other = await openPlugin(t, [join(root, "scratch-root")]);
+ await other.open({});
+ assert.equal((await other.request() as { path: string }).path, studioWorkspacePath(), "a root that is not a project is No project");
+ });
+});
diff --git a/packages/runtimes/agent-device/package-lock.json b/packages/runtimes/agent-device/package-lock.json
index c99cf45c..27397b2d 100644
--- a/packages/runtimes/agent-device/package-lock.json
+++ b/packages/runtimes/agent-device/package-lock.json
@@ -1,20 +1,20 @@
{
"name": "mobile-dev-agent-device-runtime",
- "version": "0.21.33",
+ "version": "0.21.37",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mobile-dev-agent-device-runtime",
- "version": "0.21.33",
+ "version": "0.21.37",
"dependencies": {
- "agent-device": "0.21.33"
+ "agent-device": "0.21.37"
}
},
"node_modules/agent-device": {
- "version": "0.21.33",
- "resolved": "https://registry.npmjs.org/agent-device/-/agent-device-0.21.33.tgz",
- "integrity": "sha512-MNCJLSOQLnqAmWU3IsLBBij55aZDgFAPPsos6817C1OSx3k/FHN6XaKUNz8OYyMKXme3PRYFqephrbW2KlRAoQ==",
+ "version": "0.21.37",
+ "resolved": "https://registry.npmjs.org/agent-device/-/agent-device-0.21.37.tgz",
+ "integrity": "sha512-IepPH4OtF3rrf51bxAACGCCaHX4Uj7xt5vlbG3sQyNAVzYnSJpOXpn3INQ1gZhZV/tiCIxI3Z+KAIGeiULKc1A==",
"license": "MIT",
"bin": {
"agent-device": "bin/agent-device.mjs"
diff --git a/packages/runtimes/agent-device/package.json b/packages/runtimes/agent-device/package.json
index f977b1ab..a466a4da 100644
--- a/packages/runtimes/agent-device/package.json
+++ b/packages/runtimes/agent-device/package.json
@@ -1,8 +1,8 @@
{
"name": "mobile-dev-agent-device-runtime",
"private": true,
- "version": "0.21.33",
+ "version": "0.21.37",
"dependencies": {
- "agent-device": "0.21.33"
+ "agent-device": "0.21.37"
}
}
diff --git a/packages/runtimes/agent-device/tools.json b/packages/runtimes/agent-device/tools.json
index 30ce0a3b..c55552fb 100644
--- a/packages/runtimes/agent-device/tools.json
+++ b/packages/runtimes/agent-device/tools.json
@@ -29,7 +29,7 @@
},
{
"name": "alert",
- "description": "Inspect, wait for, accept, or dismiss a platform alert. Use get before acting when the alert content matters; accept and dismiss change the active alert state. Each iOS XCTest execution activates once, then only observes. Local Apple XCTest and Limrun iOS choose recognized English labels by preference (Allow While Using App before Allow Once); equal-ranked choices and unknown labels refuse, including a lone unknown button. Open, Done, and Confirm… accept; Keep Browsing, Deny, and Skip dismiss. On the Apple XCUITest runner, dismiss taps only a recognized decline label (Cancel, Don't Allow, Ask App Not to Track, and similar) or the close element of a popover whose accessibility marker reads exactly \"dismiss popup\"; when no button fits the action, accept and dismiss answer ALERT_BUTTON_NOT_FOUND having tapped nothing — read labels with alert get, then press the button by label. Inspect again after an unconfirmed action; never assume a timeout means nothing happened. Times out after 90s.",
+ "description": "Inspect, wait for, accept, or dismiss a platform alert. Use get before acting when the alert content matters; accept and dismiss change the active alert state. Each iOS XCTest execution activates once, then only observes. Apple XCTest and Limrun iOS choose recognized English labels by preference (Allow While Using App before Allow Once); on iOS simulators, including Limrun, the runner also recognizes the device's preferred languages' wording of those labels from the OS permission-prompt strings, on any alert; equal-ranked choices and unknown labels refuse, including a lone unknown button. Open, Done, and Confirm… accept; Keep Browsing, Deny, and Skip dismiss. On the Apple XCUITest runner, dismiss taps only a recognized decline label (Cancel, Don't Allow, Ask App Not to Track, and similar) or the close element of a popover whose accessibility marker reads exactly \"dismiss popup\"; when no button fits the action, accept and dismiss answer ALERT_BUTTON_NOT_FOUND having tapped nothing — read labels with alert get, then press the button by label. Inspect again after an unconfirmed action; never assume a timeout means nothing happened. Times out after 90s.",
"inputSchema": {
"type": "object",
"properties": {
@@ -119,19 +119,19 @@
"ios",
"macos"
],
- "description": "Platform selector used to resolve a device."
+ "description": "Device platform."
},
"device": {
"type": "string",
- "description": "Device name selector (a UDID belongs in udid, a serial in serial)."
+ "description": "Device name; ids go in udid or serial."
},
"udid": {
"type": "string",
- "description": "Apple device or simulator UDID; the selector that pins one device when several share a name."
+ "description": "Apple device or simulator UDID."
},
"serial": {
"type": "string",
- "description": "Android, HarmonyOS, or Vega VVD serial selector."
+ "description": "Android, HarmonyOS, or Vega VVD serial."
},
"appsFilter": {
"type": "string",
@@ -175,19 +175,19 @@
"ios",
"macos"
],
- "description": "Platform selector used to resolve a device."
+ "description": "Device platform."
},
"device": {
"type": "string",
- "description": "Device name selector (a UDID belongs in udid, a serial in serial)."
+ "description": "Device name; ids go in udid or serial."
},
"udid": {
"type": "string",
- "description": "Apple device or simulator UDID; the selector that pins one device when several share a name."
+ "description": "Apple device or simulator UDID."
},
"serial": {
"type": "string",
- "description": "Android, HarmonyOS, or Vega VVD serial selector."
+ "description": "Android, HarmonyOS, or Vega VVD serial."
}
},
"additionalProperties": false,
@@ -201,7 +201,7 @@
},
{
"name": "back",
- "description": "Navigate back in the app or through system navigation. Use in-app for the app navigation stack and system when the platform back behavior is required. On iOS, a single-screen iPhone or an iPad whose app provably fills its screen can use a top-leading tap when the app tree is unreadable, with before/after visual verification. A capture failure reports an unknown outcome. Times out after 90s; a caller-supplied budget extends it.",
+ "description": "Navigate back in the app or through system navigation. Use in-app for the app navigation stack and system when the platform back behavior is required. On iOS both modes swipe from the left edge and succeed only when the app screen changes. Reason back_swipe_no_change: the swipe was sent and the screen did not change; press the visible back or close control. Reason back_swipe_unverified: the swipe may or may not have navigated, because the screen kept changing before it or could not be sampled after it; check with snapshot. Reason back_swipe_not_dispatched, or a screen that cannot be sampled before the swipe, means nothing was sent. An app with a left-edge drawer may open the drawer instead. Press a visible back or close control by its ref directly. Times out after 90s; a caller-supplied budget extends it.",
"inputSchema": {
"type": "object",
"properties": {
@@ -224,7 +224,7 @@
},
"settleQuietMs": {
"type": "integer",
- "description": "Settle: quiet window in milliseconds (default 500; 300 when the settled tree comes from the iOS simulator snapshot bridge). On iOS, a broad screen replacement such as a modal dismissal is confirmed for at least 1500ms whatever window is asked for, within the timeoutMs settle deadline; a replacement from a screen the pre-action capture read as presenting nothing, such as a tab switch, gets no 1500ms confirmation and keeps the asked window.",
+ "description": "Settle: quiet window in milliseconds (default 500; 300 on the iOS simulator snapshot bridge). On iOS, a broad replacement of a non-empty screen holds at least 1500ms within timeoutMs.",
"minimum": 0
},
"timeoutMs": {
@@ -376,7 +376,7 @@
},
{
"name": "boot",
- "description": "Boot or prepare the selected device or simulator so later commands can target it. The device is chosen through the device-selection inputs, not by naming it here. Times out after 90s; a caller-supplied budget extends it.",
+ "description": "Boot or prepare the selected device or simulator so later commands can target it. The device is chosen through the device-selection inputs, not by naming it here. On Limrun, allocate or reuse an instance. Existing-instance credentials attach without creating one. Times out after 90s; a caller-supplied budget extends it.",
"inputSchema": {
"type": "object",
"properties": {
@@ -398,24 +398,31 @@
"ios",
"macos"
],
- "description": "Platform selector used to resolve a device."
+ "description": "Device platform."
},
"device": {
"type": "string",
- "description": "Device name selector (a UDID belongs in udid, a serial in serial)."
+ "description": "Device name; ids go in udid or serial."
},
"udid": {
"type": "string",
- "description": "Apple device or simulator UDID; the selector that pins one device when several share a name."
+ "description": "Apple device or simulator UDID."
},
"serial": {
"type": "string",
- "description": "Android, HarmonyOS, or Vega VVD serial selector."
+ "description": "Android, HarmonyOS, or Vega VVD serial."
},
"headless": {
"type": "boolean",
"description": "Boot without showing simulator UI when supported."
},
+ "pick": {
+ "type": "string",
+ "enum": [
+ "newest"
+ ],
+ "description": "When no device is named and several equally preferred devices match, all shut down, boot one instead of failing: newest picks mobile over TV, then the newest OS version, then the first name in name order (numbers compared by value; not device age), which alone decides for stopped Android AVDs because they report no OS version. Several booted matches still fail."
+ },
"timeoutMs": {
"type": "integer",
"description": "Startup budget in milliseconds. Bounds the boot wait, so a never-booted Simulator can finish its first-boot migration or a cold emulator its boot; omit for the default startup behavior.",
@@ -455,19 +462,19 @@
"ios",
"macos"
],
- "description": "Platform selector used to resolve a device."
+ "description": "Device platform."
},
"device": {
"type": "string",
- "description": "Device name selector (a UDID belongs in udid, a serial in serial)."
+ "description": "Device name; ids go in udid or serial."
},
"udid": {
"type": "string",
- "description": "Apple device or simulator UDID; the selector that pins one device when several share a name."
+ "description": "Apple device or simulator UDID."
},
"serial": {
"type": "string",
- "description": "Android, HarmonyOS, or Vega VVD serial selector."
+ "description": "Android, HarmonyOS, or Vega VVD serial."
}
},
"additionalProperties": false,
@@ -491,71 +498,25 @@
"pattern": "\\S",
"description": "Named session opened with open."
},
- "target": {
- "oneOf": [
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "ref"
- },
- "ref": {
- "type": "string",
- "description": "Snapshot element ref such as @e12."
- },
- "label": {
- "type": "string",
- "description": "Optional human label for the ref."
- }
- },
- "required": [
- "kind",
- "ref"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "selector"
- },
- "selector": {
- "type": "string",
- "description": "Agent-device selector expression."
- }
- },
- "required": [
- "kind",
- "selector"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "point"
- },
- "x": {
- "type": "number"
- },
- "y": {
- "type": "number"
- }
- },
- "required": [
- "kind",
- "x",
- "y"
- ],
- "additionalProperties": false
- }
- ],
- "description": "UI element ref, selector, or screen point."
+ "ref": {
+ "type": "string",
+ "description": "Snapshot element ref such as @e12. Pass exactly one of ref, selector, or x+y."
+ },
+ "label": {
+ "type": "string",
+ "description": "Optional human label for ref."
+ },
+ "selector": {
+ "type": "string",
+ "description": "Selector expression such as id=\"submit\" or label=\"Sign in\". Pass exactly one of ref, selector, or x+y."
+ },
+ "x": {
+ "type": "number",
+ "description": "Screen x coordinate, with y. Pass exactly one of ref, selector, or x+y; use x+y only when no ref or selector is available."
+ },
+ "y": {
+ "type": "number",
+ "description": "Screen y coordinate, with x. Pass exactly one of ref, selector, or x+y."
},
"button": {
"type": "string",
@@ -613,7 +574,7 @@
},
"settleQuietMs": {
"type": "integer",
- "description": "Settle: quiet window in milliseconds (default 500; 300 when the settled tree comes from the iOS simulator snapshot bridge). On iOS, a broad screen replacement such as a modal dismissal is confirmed for at least 1500ms whatever window is asked for, within the timeoutMs settle deadline; a replacement from a screen the pre-action capture read as presenting nothing, such as a tab switch, gets no 1500ms confirmation and keeps the asked window.",
+ "description": "Settle: quiet window in milliseconds (default 500; 300 on the iOS simulator snapshot bridge). On iOS, a broad replacement of a non-empty screen holds at least 1500ms within timeoutMs.",
"minimum": 0
},
"timeoutMs": {
@@ -626,11 +587,10 @@
"description": "Do not record this action."
}
},
+ "additionalProperties": false,
"required": [
- "target",
"session"
- ],
- "additionalProperties": false
+ ]
},
"annotations": {
"readOnlyHint": false,
@@ -658,7 +618,8 @@
]
},
"text": {
- "type": "string"
+ "type": "string",
+ "description": "Text for write; required for write (\"\" clears the clipboard), refused for read."
},
"noRecord": {
"type": "boolean",
@@ -669,7 +630,33 @@
"action",
"session"
],
- "additionalProperties": false
+ "additionalProperties": false,
+ "oneOf": [
+ {
+ "properties": {
+ "action": {
+ "type": "string",
+ "const": "write"
+ }
+ },
+ "required": [
+ "text"
+ ]
+ },
+ {
+ "properties": {
+ "action": {
+ "type": "string",
+ "const": "read"
+ }
+ },
+ "not": {
+ "required": [
+ "text"
+ ]
+ }
+ }
+ ]
},
"annotations": {
"readOnlyHint": false,
@@ -679,7 +666,7 @@
},
{
"name": "close",
- "description": "Close the named app, or close the active session app when app is omitted. Use shutdown only when the selected simulator or emulator should also stop. Android ADB close fails with android-app-close-timeout if the app stays foreground, or its process stays running, past its 2s check window. Times out after 90s.",
+ "description": "Close the named app, or close the active session app when app is omitted. If the session booted a local simulator or emulator, add shutdown when you finish, unless the user asks to keep it running; close alone never stops the device. Android ADB close fails with android-app-close-timeout if the app stays foreground past 2s, a killed process does not exit within 10s, or a new process runs past 2s. It fails with android-process-probe-unavailable when adb pidof cannot list the app processes; if that happens before the force-stop, the app keeps running. If close cannot confirm its cleanup on a session that holds a device claim, the session and its claim stay; run close again with the same options to retry the cleanup, leaving out save-script once the script is published. Times out after 90s.",
"inputSchema": {
"type": "object",
"properties": {
@@ -784,19 +771,19 @@
"ios",
"macos"
],
- "description": "Platform selector used to resolve a device."
+ "description": "Device platform."
},
"device": {
"type": "string",
- "description": "Device name selector (a UDID belongs in udid, a serial in serial)."
+ "description": "Device name; ids go in udid or serial."
},
"udid": {
"type": "string",
- "description": "Apple device or simulator UDID; the selector that pins one device when several share a name."
+ "description": "Apple device or simulator UDID."
},
"serial": {
"type": "string",
- "description": "Android, HarmonyOS, or Vega VVD serial selector."
+ "description": "Android, HarmonyOS, or Vega VVD serial."
}
},
"additionalProperties": false,
@@ -880,19 +867,19 @@
"ios",
"macos"
],
- "description": "Platform selector used to resolve a device."
+ "description": "Device platform."
},
"device": {
"type": "string",
- "description": "Device name selector (a UDID belongs in udid, a serial in serial)."
+ "description": "Device name; ids go in udid or serial."
},
"udid": {
"type": "string",
- "description": "Apple device or simulator UDID; the selector that pins one device when several share a name."
+ "description": "Apple device or simulator UDID."
},
"serial": {
"type": "string",
- "description": "Android, HarmonyOS, or Vega VVD serial selector."
+ "description": "Android, HarmonyOS, or Vega VVD serial."
},
"targetApp": {
"type": "string",
@@ -952,71 +939,25 @@
"pattern": "\\S",
"description": "Named session opened with open."
},
- "target": {
- "oneOf": [
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "ref"
- },
- "ref": {
- "type": "string",
- "description": "Snapshot element ref such as @e12."
- },
- "label": {
- "type": "string",
- "description": "Optional human label for the ref."
- }
- },
- "required": [
- "kind",
- "ref"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "selector"
- },
- "selector": {
- "type": "string",
- "description": "Agent-device selector expression."
- }
- },
- "required": [
- "kind",
- "selector"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "point"
- },
- "x": {
- "type": "number"
- },
- "y": {
- "type": "number"
- }
- },
- "required": [
- "kind",
- "x",
- "y"
- ],
- "additionalProperties": false
- }
- ],
- "description": "UI element ref, selector, or screen point."
+ "ref": {
+ "type": "string",
+ "description": "Snapshot element ref such as @e12. Pass exactly one of ref, selector, or x+y."
+ },
+ "label": {
+ "type": "string",
+ "description": "Optional human label for ref."
+ },
+ "selector": {
+ "type": "string",
+ "description": "Selector expression such as id=\"submit\" or label=\"Sign in\". Pass exactly one of ref, selector, or x+y."
+ },
+ "x": {
+ "type": "number",
+ "description": "Screen x coordinate, with y. Pass exactly one of ref, selector, or x+y; use x+y only when no ref or selector is available."
+ },
+ "y": {
+ "type": "number",
+ "description": "Screen y coordinate, with x. Pass exactly one of ref, selector, or x+y."
},
"text": {
"type": "string",
@@ -1054,7 +995,7 @@
},
"settleQuietMs": {
"type": "integer",
- "description": "Settle: quiet window in milliseconds (default 500; 300 when the settled tree comes from the iOS simulator snapshot bridge). On iOS, a broad screen replacement such as a modal dismissal is confirmed for at least 1500ms whatever window is asked for, within the timeoutMs settle deadline; a replacement from a screen the pre-action capture read as presenting nothing, such as a tab switch, gets no 1500ms confirmation and keeps the asked window.",
+ "description": "Settle: quiet window in milliseconds (default 500; 300 on the iOS simulator snapshot bridge). On iOS, a broad replacement of a non-empty screen holds at least 1500ms within timeoutMs.",
"minimum": 0
},
"timeoutMs": {
@@ -1068,7 +1009,6 @@
}
},
"required": [
- "target",
"text",
"session"
],
@@ -1082,7 +1022,7 @@
},
{
"name": "find",
- "description": "Find by text/label/value/role/id and run action. The role locator matches snapshot kind vocabulary (button, text, text-field, switch, ...); pre-reconciliation leaf spellings (statictext, edittext, textview) stay accepted on the nodes that carried them during a deprecation window. Times out after 90s.",
+ "description": "Find by text/label/value/role/id and run action; the action defaults to click. The role locator matches snapshot kind vocabulary (button, text, text-field, switch, ...); pre-reconciliation leaf spellings (statictext, edittext, textview) stay accepted on the nodes that carried them during a deprecation window. The focus and type actions aim at a text field: the match or the field holding it, even beside other fields, or else the one enabled on-screen field inside the match. Several enabled on-screen fields inside the match refuse with AMBIGUOUS_MATCH and the field candidates, and a disabled target refuses with reason target_disabled. Web text boxes are not recognized as text fields. Times out after 90s.",
"inputSchema": {
"type": "object",
"properties": {
@@ -1199,7 +1139,7 @@
},
{
"name": "fold",
- "description": "Fold or unfold a foldable iPhone simulator (iPhone Duo) or a foldable Android emulator into the closed, half-open, or open pose. iOS sends a simulator HID hinge event, then reads the hinge angle back inside the simulator to confirm it, and can follow timestamped angle keyframes; Android sets the emulator console posture, then confirms the device state the guest commits and reports the hinge angle the AVD profile defines for that posture, and dismisses the lock screen a fold to the cover display can raise. On iOS a pose change moves the app to a different panel with a different point size; on Android a fold to or from closed moves the app between the cover and inner displays, and any pose change can reshape the app window, whose size the next snapshot reports. Either way every ref and coordinate from before it is stale: re-snapshot after this command. Taps, long presses, and scrolling target the app window on its current panel in closed, half-open, and open poses. Simulator and emulator only; iOS requires the iOS simulator SDK; Device Hub and host Accessibility permission are not required. An iOS simulator in a scoped simulator set folds the same way as one in the default set. Times out after 255s.",
+ "description": "Fold or unfold a foldable iPhone simulator (iPhone Duo) or a foldable Android emulator into the closed, half-open, or open pose. iOS sends a simulator HID hinge event, then reads the hinge angle back inside the simulator to confirm it, and can follow timestamped angle keyframes; Android sets the emulator console posture, then confirms the device state the guest commits and reports the angle read from the hinge sensor, which can differ from the AVD profile's per-posture angles, and dismisses the lock screen a fold to the cover display can raise. On iOS a pose change moves the app to a different panel with a different point size; on Android a fold to or from closed moves the app between the cover and inner displays, and any pose change can reshape the app window, whose size the next snapshot reports. Either way every ref and coordinate from before it is stale: re-snapshot after this command. Taps, long presses, and scrolling target the app window on its current panel in closed, half-open, and open poses. Simulator and emulator only; iOS requires the iOS simulator SDK; Device Hub and host Accessibility permission are not required. An iOS simulator in a scoped simulator set folds the same way as one in the default set. Times out after 255s.",
"inputSchema": {
"type": "object",
"properties": {
@@ -1483,51 +1423,6 @@
"pattern": "\\S",
"description": "Named session opened with open."
},
- "target": {
- "oneOf": [
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "ref"
- },
- "ref": {
- "type": "string",
- "description": "Snapshot element ref such as @e12."
- },
- "label": {
- "type": "string",
- "description": "Optional human label for the ref."
- }
- },
- "required": [
- "kind",
- "ref"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "selector"
- },
- "selector": {
- "type": "string",
- "description": "Agent-device selector expression."
- }
- },
- "required": [
- "kind",
- "selector"
- ],
- "additionalProperties": false
- }
- ],
- "description": "UI element ref, selector, or screen point."
- },
"format": {
"type": "string",
"enum": [
@@ -1535,6 +1430,18 @@
"attrs"
]
},
+ "ref": {
+ "type": "string",
+ "description": "Snapshot element ref such as @e12. Pass exactly one of ref or selector."
+ },
+ "label": {
+ "type": "string",
+ "description": "Optional human label for ref."
+ },
+ "selector": {
+ "type": "string",
+ "description": "Selector expression such as id=\"submit\" or label=\"Sign in\". Pass exactly one of ref or selector."
+ },
"depth": {
"type": "integer",
"description": "Snapshot traversal depth.",
@@ -1559,7 +1466,6 @@
},
"required": [
"format",
- "target",
"session"
],
"additionalProperties": false
@@ -1646,7 +1552,7 @@
},
{
"name": "install",
- "description": "Install an app binary from a local path. Provide an app identifier with the path when the target needs explicit app selection; use reinstall to replace an already installed app. Times out after 180s.",
+ "description": "Install an app binary from a local path. Provide an app identifier with the path when the target needs explicit app selection; use reinstall to replace an already installed app. Local Android and iOS install steps time out after 120s; the command allows 480s including device startup. Times out after 480s.",
"inputSchema": {
"type": "object",
"properties": {
@@ -1668,19 +1574,19 @@
"ios",
"macos"
],
- "description": "Platform selector used to resolve a device."
+ "description": "Device platform."
},
"device": {
"type": "string",
- "description": "Device name selector (a UDID belongs in udid, a serial in serial)."
+ "description": "Device name; ids go in udid or serial."
},
"udid": {
"type": "string",
- "description": "Apple device or simulator UDID; the selector that pins one device when several share a name."
+ "description": "Apple device or simulator UDID."
},
"serial": {
"type": "string",
- "description": "Android, HarmonyOS, or Vega VVD serial selector."
+ "description": "Android, HarmonyOS, or Vega VVD serial."
},
"app": {
"type": "string",
@@ -1690,6 +1596,26 @@
"type": "string",
"description": "Path to app binary."
},
+ "osVersion": {
+ "type": "string",
+ "description": "Proxy lease: OS version or range, for example 18.6.2 or \">=26\" (Android: API level). Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "imageTag": {
+ "type": "string",
+ "description": "Proxy lease: Android system image tag, for example google_apis_playstore. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "deviceMode": {
+ "type": "string",
+ "description": "Proxy lease: iOS simulator mode, slim or full. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "deviceBaseline": {
+ "type": "string",
+ "description": "Proxy lease: saved device state (baseline) to restore on the leased device. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "physical": {
+ "type": "boolean",
+ "description": "Proxy lease: true requests a physical device; false selects nothing. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
"noRecord": {
"type": "boolean",
"description": "Do not record this action."
@@ -1821,71 +1747,25 @@
"pattern": "\\S",
"description": "Named session opened with open."
},
- "target": {
- "oneOf": [
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "ref"
- },
- "ref": {
- "type": "string",
- "description": "Snapshot element ref such as @e12."
- },
- "label": {
- "type": "string",
- "description": "Optional human label for the ref."
- }
- },
- "required": [
- "kind",
- "ref"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "selector"
- },
- "selector": {
- "type": "string",
- "description": "Agent-device selector expression."
- }
- },
- "required": [
- "kind",
- "selector"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "point"
- },
- "x": {
- "type": "number"
- },
- "y": {
- "type": "number"
- }
- },
- "required": [
- "kind",
- "x",
- "y"
- ],
- "additionalProperties": false
- }
- ],
- "description": "UI element ref, selector, or screen point."
+ "ref": {
+ "type": "string",
+ "description": "Snapshot element ref such as @e12. Pass exactly one of ref, selector, or x+y."
+ },
+ "label": {
+ "type": "string",
+ "description": "Optional human label for ref."
+ },
+ "selector": {
+ "type": "string",
+ "description": "Selector expression such as id=\"submit\" or label=\"Sign in\". Pass exactly one of ref, selector, or x+y."
+ },
+ "x": {
+ "type": "number",
+ "description": "Screen x coordinate, with y. Pass exactly one of ref, selector, or x+y; use x+y only when no ref or selector is available."
+ },
+ "y": {
+ "type": "number",
+ "description": "Screen y coordinate, with x. Pass exactly one of ref, selector, or x+y."
},
"durationMs": {
"type": "integer",
@@ -1911,7 +1791,7 @@
},
"settleQuietMs": {
"type": "integer",
- "description": "Settle: quiet window in milliseconds (default 500; 300 when the settled tree comes from the iOS simulator snapshot bridge). On iOS, a broad screen replacement such as a modal dismissal is confirmed for at least 1500ms whatever window is asked for, within the timeoutMs settle deadline; a replacement from a screen the pre-action capture read as presenting nothing, such as a tab switch, gets no 1500ms confirmation and keeps the asked window.",
+ "description": "Settle: quiet window in milliseconds (default 500; 300 on the iOS simulator snapshot bridge). On iOS, a broad replacement of a non-empty screen holds at least 1500ms within timeoutMs.",
"minimum": 0
},
"timeoutMs": {
@@ -1924,11 +1804,10 @@
"description": "Do not record this action."
}
},
+ "additionalProperties": false,
"required": [
- "target",
"session"
- ],
- "additionalProperties": false
+ ]
},
"annotations": {
"readOnlyHint": false,
@@ -2067,7 +1946,7 @@
},
{
"name": "open",
- "description": "Boot the selected device when needed, then open an app, deep link, or URL in a session. Use the app or URL inputs to choose what becomes the foreground automation target. metroHost, metroPort, and bundleUrl choose the app's Metro server and save its address for later reloads. launchUrl selects the app's launch URL and does not select the reload server. A fresh open without Metro hints clears an older same-name binding; close also clears it. Times out after 90s; a caller-supplied budget extends it.",
+ "description": "Boot the selected device when needed, then open an app, deep link, or URL in a session. Use the app or URL inputs to choose what becomes the foreground automation target. Remote daemons refuse file: URLs in open targets and launch URLs with reason REMOTE_HOST_INPUT_DENIED. Serve local web content over HTTP(S) instead. metroHost, metroPort, and bundleUrl choose the app's Metro server and save its address for later reloads. launchUrl selects the app's launch URL and does not select the reload server. A fresh open without Metro hints clears an older same-name binding; close also clears it. Times out after 90s; a caller-supplied budget extends it.",
"inputSchema": {
"type": "object",
"properties": {
@@ -2089,19 +1968,19 @@
"ios",
"macos"
],
- "description": "Platform selector used to resolve a device."
+ "description": "Device platform."
},
"device": {
"type": "string",
- "description": "Device name selector (a UDID belongs in udid, a serial in serial)."
+ "description": "Device name; ids go in udid or serial."
},
"udid": {
"type": "string",
- "description": "Apple device or simulator UDID; the selector that pins one device when several share a name."
+ "description": "Apple device or simulator UDID."
},
"serial": {
"type": "string",
- "description": "Android, HarmonyOS, or Vega VVD serial selector."
+ "description": "Android, HarmonyOS, or Vega VVD serial."
},
"app": {
"type": "string",
@@ -2127,7 +2006,7 @@
},
"launchConsole": {
"type": "string",
- "description": "File path on the daemon host for the stdout and stderr of the initial app launch. iOS simulator direct app launches only; not for URL opens."
+ "description": "File path on the daemon host for the stdout and stderr of the initial app launch. Local or Limrun iOS simulator direct app launches only; not for URL opens."
},
"launchArgs": {
"type": "array",
@@ -2147,7 +2026,7 @@
},
"waitMs": {
"type": "integer",
- "description": "Block this open for up to n milliseconds (100-120000) while another session holds the device, then fail with DEVICE_IN_USE naming that session. Only session contention is waited for: a device claim held by another workspace is refused at once with its recovery command. A device that never frees, or is taken again while this open waits, costs the full budget, which extends this command's timeout envelope rather than eating into it.",
+ "description": "Wait up to n milliseconds (100-120000) while another session holds the device, then fail with DEVICE_IN_USE. A claim held by another workspace fails at once. The wait extends this command's timeout.",
"minimum": 100,
"maximum": 120000
},
@@ -2169,7 +2048,7 @@
},
"metroPort": {
"type": "integer",
- "description": "Session-scoped Metro/debug port hint applied to the opened app. On an emulator/simulator the host defaults to the loopback alias (Android 10.0.2.2, iOS 127.0.0.1) when --metro-host is omitted; physical devices still require an explicit --metro-host.",
+ "description": "Session-scoped Metro/debug port hint applied to the opened app. Without metroHost, emulators and simulators use the loopback alias; physical devices need metroHost.",
"minimum": 1,
"maximum": 65535
},
@@ -2180,6 +2059,26 @@
"launchUrl": {
"type": "string",
"description": "Launch URL for the opened app; does not select the server used by metro reload."
+ },
+ "osVersion": {
+ "type": "string",
+ "description": "Proxy lease: OS version or range, for example 18.6.2 or \">=26\" (Android: API level). Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "imageTag": {
+ "type": "string",
+ "description": "Proxy lease: Android system image tag, for example google_apis_playstore. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "deviceMode": {
+ "type": "string",
+ "description": "Proxy lease: iOS simulator mode, slim or full. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "deviceBaseline": {
+ "type": "string",
+ "description": "Proxy lease: saved device state (baseline) to restore on the leased device. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "physical": {
+ "type": "boolean",
+ "description": "Proxy lease: true requests a physical device; false selects nothing. Honored only by a proxy backend that leases by spec; other daemons refuse it."
}
},
"additionalProperties": false,
@@ -2245,71 +2144,25 @@
"pattern": "\\S",
"description": "Named session opened with open."
},
- "target": {
- "oneOf": [
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "ref"
- },
- "ref": {
- "type": "string",
- "description": "Snapshot element ref such as @e12."
- },
- "label": {
- "type": "string",
- "description": "Optional human label for the ref."
- }
- },
- "required": [
- "kind",
- "ref"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "selector"
- },
- "selector": {
- "type": "string",
- "description": "Agent-device selector expression."
- }
- },
- "required": [
- "kind",
- "selector"
- ],
- "additionalProperties": false
- },
- {
- "type": "object",
- "properties": {
- "kind": {
- "type": "string",
- "const": "point"
- },
- "x": {
- "type": "number"
- },
- "y": {
- "type": "number"
- }
- },
- "required": [
- "kind",
- "x",
- "y"
- ],
- "additionalProperties": false
- }
- ],
- "description": "UI element ref, selector, or screen point."
+ "ref": {
+ "type": "string",
+ "description": "Snapshot element ref such as @e12. Pass exactly one of ref, selector, or x+y."
+ },
+ "label": {
+ "type": "string",
+ "description": "Optional human label for ref."
+ },
+ "selector": {
+ "type": "string",
+ "description": "Selector expression such as id=\"submit\" or label=\"Sign in\". Pass exactly one of ref, selector, or x+y."
+ },
+ "x": {
+ "type": "number",
+ "description": "Screen x coordinate, with y. Pass exactly one of ref, selector, or x+y; use x+y only when no ref or selector is available."
+ },
+ "y": {
+ "type": "number",
+ "description": "Screen y coordinate, with x. Pass exactly one of ref, selector, or x+y."
},
"depth": {
"type": "integer",
@@ -2358,7 +2211,7 @@
},
"settleQuietMs": {
"type": "integer",
- "description": "Settle: quiet window in milliseconds (default 500; 300 when the settled tree comes from the iOS simulator snapshot bridge). On iOS, a broad screen replacement such as a modal dismissal is confirmed for at least 1500ms whatever window is asked for, within the timeoutMs settle deadline; a replacement from a screen the pre-action capture read as presenting nothing, such as a tab switch, gets no 1500ms confirmation and keeps the asked window.",
+ "description": "Settle: quiet window in milliseconds (default 500; 300 on the iOS simulator snapshot bridge). On iOS, a broad replacement of a non-empty screen holds at least 1500ms within timeoutMs.",
"minimum": 0
},
"timeoutMs": {
@@ -2371,11 +2224,10 @@
"description": "Do not record this action."
}
},
+ "additionalProperties": false,
"required": [
- "target",
"session"
- ],
- "additionalProperties": false
+ ]
},
"annotations": {
"readOnlyHint": false,
@@ -2524,7 +2376,7 @@
},
{
"name": "reinstall",
- "description": "Replace an installed app with a binary from a local path. Use this when preserving the same app identity while installing a new build on the selected device. Times out after 180s.",
+ "description": "Replace an installed app with a binary from a local path. Use this when preserving the same app identity while installing a new build on the selected device. Local Android and iOS install steps time out after 120s; the command allows 480s including device startup and uninstall. Times out after 480s.",
"inputSchema": {
"type": "object",
"properties": {
@@ -2546,19 +2398,19 @@
"ios",
"macos"
],
- "description": "Platform selector used to resolve a device."
+ "description": "Device platform."
},
"device": {
"type": "string",
- "description": "Device name selector (a UDID belongs in udid, a serial in serial)."
+ "description": "Device name; ids go in udid or serial."
},
"udid": {
"type": "string",
- "description": "Apple device or simulator UDID; the selector that pins one device when several share a name."
+ "description": "Apple device or simulator UDID."
},
"serial": {
"type": "string",
- "description": "Android, HarmonyOS, or Vega VVD serial selector."
+ "description": "Android, HarmonyOS, or Vega VVD serial."
},
"app": {
"type": "string"
@@ -2567,6 +2419,26 @@
"type": "string",
"description": "Path to app binary."
},
+ "osVersion": {
+ "type": "string",
+ "description": "Proxy lease: OS version or range, for example 18.6.2 or \">=26\" (Android: API level). Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "imageTag": {
+ "type": "string",
+ "description": "Proxy lease: Android system image tag, for example google_apis_playstore. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "deviceMode": {
+ "type": "string",
+ "description": "Proxy lease: iOS simulator mode, slim or full. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "deviceBaseline": {
+ "type": "string",
+ "description": "Proxy lease: saved device state (baseline) to restore on the leased device. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "physical": {
+ "type": "boolean",
+ "description": "Proxy lease: true requests a physical device; false selects nothing. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
"noRecord": {
"type": "boolean",
"description": "Do not record this action."
@@ -2608,19 +2480,19 @@
"ios",
"macos"
],
- "description": "Platform selector used to resolve a device."
+ "description": "Device platform."
},
"device": {
"type": "string",
- "description": "Device name selector (a UDID belongs in udid, a serial in serial)."
+ "description": "Device name; ids go in udid or serial."
},
"udid": {
"type": "string",
- "description": "Apple device or simulator UDID; the selector that pins one device when several share a name."
+ "description": "Apple device or simulator UDID."
},
"serial": {
"type": "string",
- "description": "Android, HarmonyOS, or Vega VVD serial selector."
+ "description": "Android, HarmonyOS, or Vega VVD serial."
},
"path": {
"type": "string"
@@ -2719,6 +2591,13 @@
"description": "Output screenshot pixel density in pixels per logical point.",
"minimum": 1
},
+ "screenMask": {
+ "type": "string",
+ "enum": [
+ "black"
+ ],
+ "description": "Fill the iOS simulator screen outline with black for this capture. Requires simctl; omit for the default image."
+ },
"fullscreen": {
"type": "boolean"
},
@@ -2734,6 +2613,13 @@
"normalizeStatusBar": {
"type": "boolean"
},
+ "captureBackend": {
+ "type": "string",
+ "enum": [
+ "runner"
+ ],
+ "description": "Capture through the XCTest runner instead of the platform default, which leaves out the simulator-drawn Dynamic Island. Local Apple targets only; refused on provider sessions and on a macOS surface the helper captures, and with pixelDensity, screenMask or normalizeStatusBar."
+ },
"surface": {
"type": "string",
"enum": [
@@ -2761,7 +2647,7 @@
},
{
"name": "scroll",
- "description": "Scroll in a direction, or toward the top/bottom edge of scrollable content. Set until to a selector to reach an off-screen target in one command rather than a scroll-and-check loop. The optional amount is the finger-path fraction of the viewport axis, honored up to 0.8 of it; directional scrolls reduce release momentum, while app scroll physics determine the final content offset. A visible keyboard shortens the swiped band instead of being dismissed; when too little is left, the command refuses with scroll_keyboard_occludes_surface. A directional scroll also reports the movement it observed as movement: moved, at-edge, unchanged, or unobserved when the two reads could not back a claim either way; an unchanged surface inside a container that still hides content in that direction refuses with scroll_no_progress rather than repeating the requested distance. The movement field is absent where a tier verifies per pass (top/bottom, until), where the runtime cannot read a screen, or where a settle observation or a replay already owns that observation. Times out after 90s; a caller-supplied budget extends it.",
+ "description": "Scroll in a direction, or toward the top/bottom edge of scrollable content. Set until to a selector to reach an off-screen target in one command rather than a scroll-and-check loop. The optional amount is the finger-path fraction of the viewport axis, honored up to 0.8 of it; directional scrolls reduce release momentum, while app scroll physics determine the final content offset. A visible keyboard shortens the swiped band instead of being dismissed; when too little is left, the command refuses with scroll_keyboard_occludes_surface. A directional scroll also reports the movement it observed as movement: moved, at-edge, unchanged, or unobserved when the two reads could not back a claim either way; an unchanged surface inside a container that still hides content in that direction refuses with scroll_no_progress rather than repeating the requested distance. The movement field is absent where a tier verifies per pass (top/bottom, until), where the runtime cannot read a screen, where a settle observation or a replay already owns that observation, or where the operator opted out of it. Times out after 90s; a caller-supplied budget extends it.",
"inputSchema": {
"type": "object",
"properties": {
@@ -2813,7 +2699,7 @@
},
"settleQuietMs": {
"type": "integer",
- "description": "Settle: quiet window in milliseconds (default 500; 300 when the settled tree comes from the iOS simulator snapshot bridge). On iOS, a broad screen replacement such as a modal dismissal is confirmed for at least 1500ms whatever window is asked for, within the timeoutMs settle deadline; a replacement from a screen the pre-action capture read as presenting nothing, such as a tab switch, gets no 1500ms confirmation and keeps the asked window.",
+ "description": "Settle: quiet window in milliseconds (default 500; 300 on the iOS simulator snapshot bridge). On iOS, a broad replacement of a non-empty screen holds at least 1500ms within timeoutMs.",
"minimum": 0
},
"timeoutMs": {
@@ -2913,7 +2799,7 @@
},
"app": {
"type": "string",
- "description": "App the change targets, by bundle id, package name, or app name: the app `clear-app-state` clears, or the app a `permission` change (or an iOS-simulator `location on|off` privacy change) lands on. A name resolves to the installed app as `open` resolves it: an iOS simulator matches display names and accepts only an installed bundle id, Android accepts only an installed package and refuses a name that resolves to an intent with `setting_app_not_package`, and a Limrun iOS session resolves only the `settings` alias. One that resolves to nothing is refused with `app_not_installed` before anything changes. The app need not be running. Without it the session app is used; a device-wide change (`location set` on any target, the Android `location on|off` toggle, `mobile-data`, macOS permissions) refuses one with `setting_app_not_consumed`. The CLI reads it only from this invocation, never from `AGENT_DEVICE_TARGET_APP` or config `targetApp`."
+ "description": "App the change targets, by bundle id, package name, or app name: the app `clear-app-state` clears, or the app a `permission` change (or an iOS-simulator `location on|off` privacy change) lands on. A name resolves to the installed app as `open` resolves it: an iOS simulator, local or Limrun, matches display names and accepts only an installed bundle id, and Android accepts only an installed package and refuses a name that resolves to an intent with `setting_app_not_package`. One that resolves to nothing is refused with `app_not_installed` before anything changes. The app need not be running. Without it the session app is used; a device-wide change (`location set` on any target, the Android `location on|off` toggle, `mobile-data`, macOS permissions) refuses one with `setting_app_not_consumed`. The CLI reads it only from this invocation, never from `AGENT_DEVICE_TARGET_APP` or config `targetApp`."
},
"latitude": {
"type": "number"
@@ -2950,7 +2836,7 @@
},
{
"name": "shutdown",
- "description": "Shutdown a selected simulator or emulator. Times out after 90s.",
+ "description": "Shutdown a selected simulator or emulator. On Limrun, delete a created instance or release an attachment. Apps and data on a deleted instance are lost. A Limrun connection without an instance fails with DEVICE_NOT_FOUND and details.reason provider_instance_unallocated and creates nothing. Times out after 90s.",
"inputSchema": {
"type": "object",
"properties": {
@@ -2972,19 +2858,19 @@
"ios",
"macos"
],
- "description": "Platform selector used to resolve a device."
+ "description": "Device platform."
},
"device": {
"type": "string",
- "description": "Device name selector (a UDID belongs in udid, a serial in serial)."
+ "description": "Device name; ids go in udid or serial."
},
"udid": {
"type": "string",
- "description": "Apple device or simulator UDID; the selector that pins one device when several share a name."
+ "description": "Apple device or simulator UDID."
},
"serial": {
"type": "string",
- "description": "Android, HarmonyOS, or Vega VVD serial selector."
+ "description": "Android, HarmonyOS, or Vega VVD serial."
}
},
"additionalProperties": false,
@@ -3240,19 +3126,19 @@
"ios",
"macos"
],
- "description": "Platform selector used to resolve a device."
+ "description": "Device platform."
},
"device": {
"type": "string",
- "description": "Device name selector (a UDID belongs in udid, a serial in serial)."
+ "description": "Device name; ids go in udid or serial."
},
"udid": {
"type": "string",
- "description": "Apple device or simulator UDID; the selector that pins one device when several share a name."
+ "description": "Apple device or simulator UDID."
},
"serial": {
"type": "string",
- "description": "Android, HarmonyOS, or Vega VVD serial selector."
+ "description": "Android, HarmonyOS, or Vega VVD serial."
},
"paths": {
"type": "array",
@@ -3441,7 +3327,7 @@
},
{
"name": "uninstall",
- "description": "Remove an installed app from the selected device. A package name or bundle id that is not installed succeeds with wasInstalled: false. Times out after 180s.",
+ "description": "Remove an installed app from the selected device. A package name or bundle id that is not installed succeeds with wasInstalled: false. The command allows 480s including device startup. Times out after 480s.",
"inputSchema": {
"type": "object",
"properties": {
@@ -3463,24 +3349,44 @@
"ios",
"macos"
],
- "description": "Platform selector used to resolve a device."
+ "description": "Device platform."
},
"device": {
"type": "string",
- "description": "Device name selector (a UDID belongs in udid, a serial in serial)."
+ "description": "Device name; ids go in udid or serial."
},
"udid": {
"type": "string",
- "description": "Apple device or simulator UDID; the selector that pins one device when several share a name."
+ "description": "Apple device or simulator UDID."
},
"serial": {
"type": "string",
- "description": "Android, HarmonyOS, or Vega VVD serial selector."
+ "description": "Android, HarmonyOS, or Vega VVD serial."
},
"app": {
"type": "string",
"description": "Package name, bundle id, or installed app name."
},
+ "osVersion": {
+ "type": "string",
+ "description": "Proxy lease: OS version or range, for example 18.6.2 or \">=26\" (Android: API level). Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "imageTag": {
+ "type": "string",
+ "description": "Proxy lease: Android system image tag, for example google_apis_playstore. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "deviceMode": {
+ "type": "string",
+ "description": "Proxy lease: iOS simulator mode, slim or full. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "deviceBaseline": {
+ "type": "string",
+ "description": "Proxy lease: saved device state (baseline) to restore on the leased device. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
+ "physical": {
+ "type": "boolean",
+ "description": "Proxy lease: true requests a physical device; false selects nothing. Honored only by a proxy backend that leases by spec; other daemons refuse it."
+ },
"noRecord": {
"type": "boolean",
"description": "Do not record this action."
@@ -3499,7 +3405,7 @@
},
{
"name": "wait",
- "description": "Wait for a duration, text, snapshot ref, selector to appear, selector to be strictly absent, or stable UI. Use the strict absence target when zero selector matches are required; stable waits until the UI stays quiet for the requested window. Times out after 90s; a caller-supplied budget extends it.",
+ "description": "Wait for a duration, text, snapshot ref, selector to appear, selector to be strictly absent, or stable UI. Text matches a label, identifier, or value; an editable field never matches by its current value or by a label that only repeats it, so text you typed does not satisfy it. Use the strict absence target when zero selector matches are required; stable waits until the UI stays quiet for the requested window. Times out after 90s; a caller-supplied budget extends it.",
"inputSchema": {
"type": "object",
"properties": {
diff --git a/packages/shared/src/panel-target.ts b/packages/shared/src/panel-target.ts
index 94df164d..51a298e2 100644
--- a/packages/shared/src/panel-target.ts
+++ b/packages/shared/src/panel-target.ts
@@ -7,7 +7,9 @@ export const deviceIdSchema = z.string().min(1).max(256).regex(/^[A-Za-z0-9_.:\[
const workspaceTool = z.enum(["logs", "performance", "storage", "app-intel", "tracesift", "testing"]).optional().describe("A workspace tool to open. Use testing to open the Testing tab, whether the panel is closed or already open. Omit for the device view.");
const appIntelScreen = z.string().min(1).max(512).optional().describe("An App Intelligence screen ID to focus when workspaceTool is app-intel, from mobile_app_intel's search or screen result. Omit to open on whatever screen the panel last showed.");
-export const panelTargetSchema = z.object({ platform, kind, deviceId: deviceIdSchema.optional(), workspaceTool, appIntelScreen }).strict().superRefine((target, context) => {
+const projectPath = z.string().max(4096).optional().describe("With workspaceTool testing: the absolute path of the chat's workspace root (its working directory), so the Testing tab follows the chat. A folder that is not a project selects No project. Pass an empty string when the chat has no project. Omit only when you cannot tell.");
+
+export const panelTargetSchema = z.object({ platform, kind, deviceId: deviceIdSchema.optional(), workspaceTool, appIntelScreen, projectPath }).strict().superRefine((target, context) => {
if (target.platform === "ios" && target.kind === "emulator" || target.platform === "android" && target.kind === "simulator") {
context.addIssue({ code: "custom", path: ["kind"], message: "Use simulator for iOS or emulator for Android." });
}
diff --git a/packages/skills/agent-device/references/workflow.md b/packages/skills/agent-device/references/workflow.md
index b558d2d8..f1e0caac 100644
--- a/packages/skills/agent-device/references/workflow.md
+++ b/packages/skills/agent-device/references/workflow.md
@@ -1,4 +1,4 @@
-agent-device 0.21.33 — workflow
+agent-device 0.21.37 — workflow
Command shapes, refs, selectors, waits, recovery, and platform limits for open -> snapshot -i -> settle -> verify -> close loop.
@@ -30,7 +30,7 @@ Selectors:
Text entry:
fill replaces; type appends to an already-focused field: fill 'id="field-email"' "qa@example.com"; type "Handle with care" --delay-ms 80
fill "" clears the field (replace with nothing); the empty argument must be present -- fill alone is a missing argument.
- Plain fill/type first; if an iOS debounced/search-as-you-type field drops characters, retry with --delay-ms before clipboard paste.
+ For dropped iOS text, retry with --delay-ms before clipboard paste. This also applies to Limrun iOS, which uses the same Apple runner.
Element presses behind the keyboard are refused with tap_keyboard_occludes_target. keyboard dismiss taps its own dismiss key when one exists, else UNSUPPORTED_OPERATION. Android: try dismiss before back. iOS: when both fail, do not tap a static text/heading hoping it is safe; prefer type "\n" to submit.
iOS paste-prompt limits and Android IME/handwriting capture quirks: help debugging.
diff --git a/packages/skills/mobile-dev-testing/SKILL.md b/packages/skills/mobile-dev-testing/SKILL.md
index aa75564a..e059b1fd 100644
--- a/packages/skills/mobile-dev-testing/SKILL.md
+++ b/packages/skills/mobile-dev-testing/SKILL.md
@@ -18,8 +18,13 @@ them are not yours to call. In **No project (Studio) mode** the flow is yours en
The **Testing tab must be open**; it is how Mobile Dev knows the user is looking. You open it
yourself: whenever `begin` or a run tool says the Testing tab is not open, call
-`mobile_open_simulator({ workspaceTool: "testing" })` (it also switches an open view to that tab) and
-then call the tool again. Do not ask the user to open it; the call waits for the tab to report in.
+`mobile_open_simulator({ workspaceTool: "testing", projectPath })` (it also switches an open view to
+that tab) and then call the tool again. Do not ask the user to open it; the call waits for the tab to
+report in. **Always pass `projectPath`: your workspace root (working directory), or `""` when the
+chat has no project.** The tab then follows the chat: a folder that is not a mobile project (a
+scratch folder, such as a Codex `Documents/Codex//...` one) selects No project, so recording
+uses the app in the foreground; a project is selected and added to the list when missing. Never
+pick a project from the tab's picker yourself, and never mention a project the chat does not have.
Past that,
`mobile_testing_agent_begin` picks what is unambiguous and tells you in `picked`, so relay that to the
user in a line:
@@ -138,7 +143,7 @@ deliverable — the panel is showing it, live, next to the steps.
No project open — the Testing tab says Studio — means tests live in Mobile Dev's own storage, each
pinned to an app. The tab must be open: every tool below reads the tab's selection and refuses
-when it has none. Then open it yourself with `mobile_open_simulator({ workspaceTool: "testing" })` and
+when it has none. Then open it yourself with `mobile_open_simulator({ workspaceTool: "testing", projectPath })` and
call the tool again; do not ask the user. `projectPath`
is optional on all of them; it defaults to the tab's project.
diff --git a/packages/ui/src/testing-panel.ts b/packages/ui/src/testing-panel.ts
index 0dc7c2cb..32ad3c5e 100644
--- a/packages/ui/src/testing-panel.ts
+++ b/packages/ui/src/testing-panel.ts
@@ -429,6 +429,8 @@ export class TestingPanel {
if (!this.snapshot.available || this.snapshot.projectPath || this.restoreRequest) return this.restoreRequest;
const request = (async () => {
await this.refreshProjects();
+ // An agent that opened the panel for its chat has already said which project it wants.
+ if (await this.applyServerProjectRequest()) return;
// No project is a state of its own: with nothing recorded against yet, Studio opens on its
// private workspace so recording never waits for a folder to be chosen.
const latest = this.snapshot.projects[0]?.path || this.snapshot.studioPath;
@@ -438,6 +440,37 @@ export class TestingPanel {
try { await request; } finally { if (this.restoreRequest === request) this.restoreRequest = undefined; }
}
+ private appliedProjectRequest = 0;
+ private projectRequestApply?: Promise;
+
+ /**
+ * The project an agent chose when it opened the panel for its chat: No project, or a folder
+ * (added to the list if missing, without the folder dialog). Applied once per request, so a
+ * project the user picks afterwards is never taken back. Returns whether a request was found.
+ */
+ private async applyProjectRequest(data: Record): Promise {
+ const request = object(data.projectRequest);
+ const id = request?.id, path = text(request?.path);
+ if (typeof id !== "number" || !path) return false;
+ if (id !== this.appliedProjectRequest) {
+ this.appliedProjectRequest = id;
+ this.projectRequestApply = (async () => {
+ await this.refreshProjects();
+ if (this.disposed || path === this.snapshot.projectPath) return;
+ await this.chooseProject(path);
+ })();
+ }
+ await this.projectRequestApply;
+ return true;
+ }
+
+ private async applyServerProjectRequest(): Promise {
+ try {
+ const response = await this.call("mobile_testing_agent_state", {}, 5_000);
+ return await this.applyProjectRequest(object(response.structuredContent) ?? {});
+ } catch { return false; }
+ }
+
private remembered(project: TestingProjectOption) {
this.update({ projects: [project, ...this.snapshot.projects.filter(entry => entry.path !== project.path)] });
}
@@ -1267,6 +1300,8 @@ export class TestingPanel {
return;
}
if (this.disposed) return;
+ await this.applyProjectRequest(data);
+ if (this.disposed) return;
const revision = typeof data.revision === "number" ? data.revision : 0;
const status = data.status === "recording" || data.status === "finished" || data.status === "aborted" ? data.status : "idle";
const steps = (Array.isArray(data.steps) ? data.steps : []) as RecordedStep[];
diff --git a/tooling/update-dependencies.mjs b/tooling/update-dependencies.mjs
index ba30cbe0..a2f97bf8 100644
--- a/tooling/update-dependencies.mjs
+++ b/tooling/update-dependencies.mjs
@@ -51,8 +51,10 @@ async function sha256(url) {
/** Reports a dependency's updates and returns the version to apply, if any. */
function choose(group, name, current, versions, link, lane) {
const { latest, safe } = targets(current, versions);
- if (group === "agent-device" && name === "agent-device" && current === "0.21.33") {
- if (latest) record(group, name, current, latest, { applied: false, reason: "manual pin: upstream #3995 breaks iOS input with a stale Xcode selection link", link });
+ // The bundled e2e runner and Mobile Dev's own client share one agent-device state directory, so
+ // the pin must match the version @e2e-dev/mobile brings in (agent-device-runtime-match.test.ts).
+ if (group === "agent-device" && name === "agent-device") {
+ if (latest) record(group, name, current, latest, { applied: false, reason: "manual pin: keep equal to the agent-device version @e2e-dev/mobile uses", link });
return;
}
if (safe) record(group, name, current, safe, { link, lane });
From 341264a1babf2ddbc00769875cee2f248cc17951 Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Thu, 19 Nov 2026 15:34:55 +0500
Subject: [PATCH 19/23] fix: all bugs in agent driven device runs
---
packages/core/src/panel-tools.ts | 8 +-
packages/core/src/plugin.ts | 3 +-
packages/core/src/testing-agent.ts | 34 +++--
packages/core/src/testing-projects.ts | 11 ++
packages/core/src/testing-tools.ts | 2 +-
packages/core/test/browser-panel.test.ts | 3 +-
.../core/test/testing-agent-panel.test.ts | 54 ++++++++
packages/core/test/testing-agent.test.ts | 2 +-
.../core/test/testing-chat-project.test.ts | 23 ++++
packages/core/test/testing-projects.test.ts | 29 ++++-
.../core/test/testing-studio-agent.test.ts | 21 +++-
packages/mcp-app/src/components/workspace.tsx | 12 ++
packages/mcp-app/src/workspace-app.tsx | 1 +
packages/skills/mobile-dev-testing/SKILL.md | 11 +-
packages/ui/src/components/testing-matrix.tsx | 19 +--
packages/ui/src/components/testing-view.tsx | 2 +-
packages/ui/src/device-workspace.ts | 13 ++
packages/ui/src/simulator-panel.ts | 10 ++
packages/ui/src/testing-panel.ts | 116 ++++++++++++++++--
.../ui/test/testing-agent-run-render.test.ts | 101 +++++++++++++++
.../test/testing-panel-project-state.test.ts | 94 ++++++++++++++
21 files changed, 531 insertions(+), 38 deletions(-)
create mode 100644 packages/ui/test/testing-agent-run-render.test.ts
create mode 100644 packages/ui/test/testing-panel-project-state.test.ts
diff --git a/packages/core/src/panel-tools.ts b/packages/core/src/panel-tools.ts
index 2ea91a4e..f9d672d2 100644
--- a/packages/core/src/panel-tools.ts
+++ b/packages/core/src/panel-tools.ts
@@ -92,6 +92,8 @@ export type PanelShared = {
showRecording: ShowRecording;
/** Lets host features add to an opening tool's result, such as a browser panel's link. */
opened: PanelOpener;
+ /** A warning for the agent when the call comes while a panel is already open, or was opened before. */
+ reopenNotice?: () => string | undefined;
};
/** Services the panel runs on; tests replace them with fakes. */
@@ -126,7 +128,7 @@ export function createPanel({ baguette = new Baguette(), simulatorInput, copyScr
};
}
-function registerPanel(server: McpServer, { android, cpu, fps, drivers, page, showRecording, opened }: PanelShared,
+function registerPanel(server: McpServer, { android, cpu, fps, drivers, page, showRecording, opened, reopenNotice }: PanelShared,
{ baguette, simulatorInput, copyScreenshot, resourceSaving, inline }: Required) {
const streams = new StreamSessions(baguette);
const closeIosMirror = registerIosMirrorTools(server, APP_URI);
@@ -228,9 +230,11 @@ function registerPanel(server: McpServer, { android, cpu, fps, drivers, page, sh
}
// Hosts can pass the model either form of a result, and Claude Code passes only the
// structured one, so another place to show the panel goes into both.
+ const reopened = reopenNotice?.();
const opening = await opened({ tool, target: panelTarget });
const response = result({ ...status, panelTarget, ...opening ? { browserPanel: opening } : {} }, startBackend ? (status.connected ? `Found ${status.devices.length} simulators.` : status.error ?? "The bundled simulator backend could not start.") : "Opened App Intelligence.");
if (opening) response.content.push({ type: "text", text: opening.instructions });
+ if (reopened) response.content.push({ type: "text", text: reopened });
return response;
});
@@ -260,7 +264,7 @@ function registerPanel(server: McpServer, { android, cpu, fps, drivers, page, sh
});
openingTool("mobile_open_simulator", {
- description: "Open Mobile Dev alongside the chat for local mobile app development, before the first device launch unless a view is open or the workflow is tool-only. Pass established platform, kind, or discovered deviceId to select the initial device; omit undecided fields. Pass workspaceTool \"testing\" to open (or switch an open view to) the Testing tab, which e2e recording and test runs need; with it, pass projectPath, your workspace root (\"\" when the chat has no project), so the tab selects that project, or No project for a folder that is not one. Starts the bundled backend without booting devices.",
+ description: "Open Mobile Dev alongside the chat for local mobile app development, before the first device launch unless a view is open or the workflow is tool-only. Pass established platform, kind, or discovered deviceId to select the initial device; omit undecided fields. Pass workspaceTool \"testing\" to open (or switch an open view to) the Testing tab, which e2e recording and test runs need; with it, pass projectPath, your workspace root (\"\" when the chat has no project), so the tab selects that project, or No project for a folder that is not one. Starts the bundled backend without booting devices. Every call makes the host draw another panel in the chat, so call it once per chat and never to \"make sure\" a panel is open; booting, recording and running tests do not need it again.",
resourceUri: APP_URI, entrypoint: "thread",
});
diff --git a/packages/core/src/plugin.ts b/packages/core/src/plugin.ts
index 433896ab..f1824f7a 100644
--- a/packages/core/src/plugin.ts
+++ b/packages/core/src/plugin.ts
@@ -196,12 +196,13 @@ export async function createPlugin(html: string | (() => Promise), o
const opened: PanelOpener = async open => {
// The Testing tab beats a moment after it loads; calls made in between wait for it rather than refuse.
testingRecordings.expectPanel();
+ testingRecordings.noteOpenCall();
const { projectPath, ...target } = open.target;
if (target.workspaceTool === "testing") await followChatProject(projectPath);
const openings = await Promise.all(panelOpeners.map(opener => opener({ ...open, target })));
return openings.find(opening => opening !== undefined);
};
- const closePanel = panel?.register(server, { android, cpu, fps, drivers, page, showRecording, opened });
+ const closePanel = panel?.register(server, { android, cpu, fps, drivers, page, showRecording, opened, reopenNotice: () => testingRecordings.panelReopenNotice() });
const featureContext = { connections: options.connections, onPanelOpen: (opener: PanelOpener) => { panelOpeners.push(opener); } };
const featureCleanups = features.flatMap(feature => feature(server, featureContext) ?? []);
diff --git a/packages/core/src/testing-agent.ts b/packages/core/src/testing-agent.ts
index 332f7eec..89d48b8d 100644
--- a/packages/core/src/testing-agent.ts
+++ b/packages/core/src/testing-agent.ts
@@ -20,7 +20,7 @@ import type { TestingDeviceTarget } from "./testing-device.ts";
import { captureServerError, recordTestingAgentRead } from "./telemetry.ts";
import { LAUNCHER_APP } from "./testing-prepare.ts";
import type { DeviceOps } from "./testing-prepare.ts";
-import { inspectProject, sameProjectPath, studioWorkspacePath, writeTestFile, writeTestTarget } from "./testing-projects.ts";
+import { inspectProject, sameProjectPath, storedTestsChangeRevision, studioWorkspacePath, writeTestFile, writeTestTarget } from "./testing-projects.ts";
/**
* Recording an e2e test from the user's own coding agent, into the Testing panel the user is
@@ -54,7 +54,12 @@ const MAX_ELEMENTS = 200;
/** How often the open Testing tab re-sends its selection, and how long silence is believed (three beats). */
export { PANEL_HEARTBEAT_MS };
-export const PANEL_EXPIRY_MS = PANEL_HEARTBEAT_MS * 3;
+/**
+ * A throttled background webview may beat only about once a minute, so a quiet panel is not a
+ * closed one for a few minutes. A real close clears the context at once (unmount, pagehide); this
+ * only catches a panel that crashed.
+ */
+export const PANEL_EXPIRY_MS = 3 * 60_000;
/** How long after an open a call waits for the panel's first report before calling the tab closed. */
export const PANEL_OPEN_GRACE_MS = 15_000;
/** How long an agent's project request stays pending for a panel document that loads late. */
@@ -227,8 +232,8 @@ export class TestingAgentRecordings {
private readonly options: { ops?: DeviceOps };
/**
- * `expiryMs` is how long the server believes a panel that has stopped reporting: about three of
- * the panel's heartbeats (`PANEL_HEARTBEAT_MS`). Both it and the clock are injectable so tests
+ * `expiryMs` is how long the server believes a panel that has stopped reporting: a few minutes,
+ * longer than a throttled background panel's heartbeat interval. Both it and the clock are injectable so tests
* need not sleep.
*/
constructor(devices: TestingDevices, drafts = new TestDraftStore(), options: { now?: () => number; expiryMs?: number; ops?: DeviceOps } = {}) {
@@ -259,6 +264,21 @@ export class TestingAgentRecordings {
* report instead of refusing: a tool call returns before the iframe has loaded and beat once.
*/
expectPanel(graceMs = PANEL_OPEN_GRACE_MS) { this.expectUntil = Date.now() + graceMs; }
+
+ private panelOpens = 0;
+ /** Counts a call that asked the host for a panel. Each one makes the host draw another view. */
+ noteOpenCall() { this.panelOpens += 1; }
+ /**
+ * What an agent that opens the panel again should be told. Hosts draw a new Mobile Dev view for
+ * every call to an opening tool and the server cannot stop that, so the only protection is to say
+ * the panel is already there: while the Testing tab reports in, or after this server was already
+ * asked for one (the tab may then be hidden or on another tab, which also silences it).
+ */
+ panelReopenNotice(): string | undefined {
+ if (this.panelProjectPath() !== undefined) return "The Mobile Dev panel was already open in this chat and the Testing tab is reporting, so this call made the host draw an extra panel. Do not call mobile_open_simulator or mobile_open_workspace again in this chat: boot, run and record with the other tools, and the open panel follows.";
+ if (this.panelOpens > 0) return "A Mobile Dev panel was already opened in this chat, so this call made the host draw another. Do not open more: if a tool says the Testing tab is not open, it may be hidden or on another tab, so ask the user to show the existing panel and its Testing tab.";
+ return undefined;
+ }
/**
* An agent opened the Testing tab for a chat: the panel selects this project once, however it was
* last used. `undefined` asks for No project. Only an agent's open sets it, so a project the user
@@ -332,9 +352,9 @@ export class TestingAgentRecordings {
refused(`An agent recording is already in flight: "${this.session.title}". Finish it with mobile_testing_agent_finish, or drop it with mobile_testing_agent_abort.`);
}
const projectPath = await this.awaitPanelProject() ?? this.context?.projectPath ?? "";
- if (!projectPath) refused("The Testing tab is not open. Call mobile_open_simulator with workspaceTool \"testing\" to open it, then begin again.");
+ if (!projectPath) refused("The Testing tab is not open. If no Mobile Dev panel is showing in this chat, call mobile_open_simulator with workspaceTool \"testing\" once to open it, then begin again; if you already opened one, do not open another (each call adds a panel): ask the user to show the existing panel and its Testing tab.");
const unmet = this.unmetProjectRequest();
- if (unmet) refused(`The Testing tab has not switched to ${sameProjectPath(unmet, studioWorkspacePath()) ? "No project" : unmet} yet. Try again in a moment, or call mobile_open_simulator with workspaceTool "testing" again.`);
+ if (unmet) refused(`The Testing tab has not switched to ${sameProjectPath(unmet, studioWorkspacePath()) ? "No project" : unmet} yet. Try again in a moment; do not open the panel again, it is already open.`);
const context = await this.resolveTarget(projectPath);
this.session = {
target: { deviceId: context.deviceId, platform: context.platform, projectPath: context.projectPath, bundleId: context.bundleId },
@@ -787,7 +807,7 @@ export function registerTestingAgentTools(server: McpServer, devices: TestingDev
inputSchema: {},
annotations: read,
_meta: appVisibility,
- }, safe(() => dataResult({ ...recordings.state(), projectRequest: recordings.panelProjectRequest() })));
+ }, safe(() => dataResult({ ...recordings.state(), storedTestsRevision: storedTestsChangeRevision(), projectRequest: recordings.panelProjectRequest() })));
registerAppTool(server, "mobile_testing_set_context", {
title: "Report the Testing panel's selection",
diff --git a/packages/core/src/testing-projects.ts b/packages/core/src/testing-projects.ts
index 7ae14de2..2d30c901 100644
--- a/packages/core/src/testing-projects.ts
+++ b/packages/core/src/testing-projects.ts
@@ -366,6 +366,14 @@ export async function resolveTestRunPaths(projectPath: string, relativePath: str
* Writes one recorded test into the project. Without `overwrite` an existing file is reported
* rather than replaced, so the panel can ask before it destroys someone's test.
*/
+/**
+ * Moves whenever a stored test or its pinned app changes on disk, by any writer: the panel, an
+ * agent's `branch_line`, `set_target`, `wait_for_app` pins, a save. The Testing panel's poll reads it
+ * so it reloads what it shows without the user reselecting the test.
+ */
+let storedTestsRevision = 0;
+export function storedTestsChangeRevision(): number { return storedTestsRevision; }
+
export async function writeTestFile(projectPath: string, relativePath: string, contents: string, overwrite = false): Promise {
const { root } = await testStorage(projectPath);
if (Buffer.byteLength(contents, "utf-8") > MAX_TEST_BYTES) throw new ExpectedOperationError("invalid_input", "That test is too large to write.");
@@ -380,6 +388,7 @@ export async function writeTestFile(projectPath: string, relativePath: string, c
} finally {
await unlink(temporary).catch(() => undefined);
}
+ storedTestsRevision += 1;
return { path: target, written: true, existed };
}
@@ -461,6 +470,7 @@ export async function writeTestTarget(projectPath: string, relativePath: string,
const kept = current?.platform === checked.platform ? current.apps : undefined;
targets[relativePath] = { ...checked, ...(kept ? { apps: kept } : {}) };
});
+ storedTestsRevision += 1;
return true;
}
@@ -595,5 +605,6 @@ export async function deleteTestFile(projectPath: string, relativePath: string):
const target = await resolveTestPath(root, relativePath);
const removed = await unlink(target).then(() => true, () => false);
if (removed && project.runtimeMode === "bundled") await changeTargets(root, targets => { delete targets[relativePath]; }).catch(() => undefined);
+ if (removed) storedTestsRevision += 1;
return { path: target, removed };
}
diff --git a/packages/core/src/testing-tools.ts b/packages/core/src/testing-tools.ts
index 5e8dc31f..c829f532 100644
--- a/packages/core/src/testing-tools.ts
+++ b/packages/core/src/testing-tools.ts
@@ -105,7 +105,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
}
// Right after an agent opened the tab its first heartbeat may not have arrived; wait for it.
const current = await panel.awaitPanelProject?.() ?? panel.panelProjectPath();
- if (!current) throw new ExpectedOperationError("invalid_input", "The Testing tab is not open, so there is no project to work on. Open it with mobile_open_simulator (workspaceTool \"testing\"), then try again.");
+ if (!current) throw new ExpectedOperationError("invalid_input", "The Testing tab is not open, so there is no project to work on. If no Mobile Dev panel is showing in this chat, open it once with mobile_open_simulator (workspaceTool \"testing\"), then try again; if you already opened one, do not open another (each call adds a panel) and ask the user to show the existing panel and its Testing tab.");
return selected ?? current;
}
const matrixWire = (run: MatrixRun) => ({ ...snapshotMatrix(run), running: run.lanes.some(lane => !["passed", "failed", "cancelled", "error"].includes(lane.state)) });
diff --git a/packages/core/test/browser-panel.test.ts b/packages/core/test/browser-panel.test.ts
index 3dd27c2b..9f460c18 100644
--- a/packages/core/test/browser-panel.test.ts
+++ b/packages/core/test/browser-panel.test.ts
@@ -144,7 +144,8 @@ test("opening the panel links the browser page only for hosts without MCP Apps",
await host.connect(hostSide);
for (const name of ["mobile_open_simulator", "mobile_open_workspace", "mobile_open_app_intel"]) {
const result = await host.callTool({ name, arguments: { platform: "android", ...(name === "mobile_open_app_intel" ? { appIntelScreen: "navigation:Profile" } : {}) } });
- const texts = (result.content as Array<{ text: string }>).map(item => item.text);
+ // A repeat open adds a warning that the panel is already there; it is not part of the host link.
+ const texts = (result.content as Array<{ text: string }>).map(item => item.text).filter(text => !/Mobile Dev panel was already open/.test(text));
const structured = result.structuredContent as { browserPanel?: { url: string } };
if (ui) { assert.equal(texts.length, 1); assert.equal(structured.browserPanel, undefined); continue; }
assert.equal(texts.length, 2);
diff --git a/packages/core/test/testing-agent-panel.test.ts b/packages/core/test/testing-agent-panel.test.ts
index 6749726d..7bfae8d2 100644
--- a/packages/core/test/testing-agent-panel.test.ts
+++ b/packages/core/test/testing-agent-panel.test.ts
@@ -230,6 +230,60 @@ test("a recording the agent saved in Studio refreshes the test list instead of a
assert.equal(testRecorder.getSnapshot().recordingDeviceId, "");
});
+test("a test the agent rewrites or re-pins refreshes the open preview and the pinned apps without reselecting", async t => {
+ const { panel, agent, tick, calls, responses } = await panelEnvironment(t);
+ panel.setAvailable(true);
+ await tick();
+ let source = "old source", pinned: Record | undefined;
+ responses.mobile_testing_read_file = () => ({ source, originalHash: source });
+ responses.mobile_testing_tests = () => ({ tests: [{ relativePath: "tests/a.e2e.ts", name: "a.e2e.ts", updatedAt: "", sizeBytes: 1, ...(pinned ? { target: pinned } : {}) }] });
+ (panel as any).update({ projectPath: "/studio", runtimeMode: "bundled", selectedTestPath: "tests/a.e2e.ts", selectedTestSource: source, selectedTestOriginalHash: source, tests: [{ relativePath: "tests/a.e2e.ts", name: "a.e2e.ts", updatedAt: "", sizeBytes: 1, target: { platform: "ios", bundleId: "com.app" } }] });
+ const reads = () => calls.filter(entry => entry.name === "mobile_testing_read_file").length;
+ Object.assign(agent, { storedTestsRevision: 1 });
+ await (panel as any).readAgentState();
+ await tick();
+ const baseline = reads();
+ // branch_line rewrote the file, and set_target added the Android app.
+ source = "new source";
+ pinned = { platform: "ios", bundleId: "com.app", apps: { android: "com.app.android" } };
+ Object.assign(agent, { storedTestsRevision: 2 });
+ await (panel as any).readAgentState();
+ await tick();
+ assert.equal(panel.getSnapshot().selectedTestSource, "new source");
+ assert.ok(reads() > baseline);
+ assert.deepEqual(panel.getSnapshot().tests[0].target.apps, { android: "com.app.android" });
+ assert.equal(panel.storedAppOn("android")?.bundleId, "com.app.android", "the add-the-app prompt has what it needs to clear");
+ // An unchanged revision reads nothing; unsaved edits are not overwritten.
+ const before = reads();
+ await (panel as any).readAgentState();
+ await tick();
+ assert.equal(reads(), before);
+ (panel as any).update({ selectedTestSource: "mine", selectedTestStaged: true });
+ source = "newer";
+ Object.assign(agent, { storedTestsRevision: 3 });
+ await (panel as any).readAgentState();
+ await tick();
+ assert.equal(panel.getSnapshot().selectedTestSource, "mine");
+});
+
+test("clicking a result row selects the lane and mirrors its booted device, during a run too", async t => {
+ const { panel, setDevice } = await panelEnvironment(t);
+ const lane = (runId: string, deviceId: string, platform: string, state: string) => ({ runId, deviceId, deviceName: deviceId, platform, state, progress: [] });
+ const shown: [string, string][] = [];
+ panel.setMirrorDevice((platform: string, deviceId: string) => { shown.push([platform, deviceId]); setDevice({ ...DEVICE, udid: deviceId, platform }); return true; });
+ (panel as any).update({ running: true, agentRun: true, matrix: { matrixId: "m", lanes: [lane("r1", "udid", "ios", "running"), lane("r2", "pixel", "android", "running")], limit: 3, startedAt: 1 } });
+ panel.openLane("r2");
+ assert.deepEqual(shown, [["android", "pixel"]], "the mirror moved to the lane's device");
+ assert.equal(panel.getSnapshot().selectedLane, "r2");
+ assert.equal(panel.getSnapshot().running, true, "the run is untouched");
+ panel.openLane("r2");
+ assert.equal(shown.length, 1, "the device already mirrored is not switched again");
+ // A device that is not booted yet cannot be mirrored; the steps still show.
+ panel.setMirrorDevice(() => false);
+ panel.openLane("r1");
+ assert.equal(panel.getSnapshot().selectedLane, "r1");
+});
+
test("an open, visible tab re-sends its selection on a heartbeat, and tells the server when it goes", async t => {
const { TestingPanel, host, deviceApps, calls, tick } = await panelEnvironment(t);
const beating = new TestingPanel(host, deviceApps, { heartbeatMs: 10 });
diff --git a/packages/core/test/testing-agent.test.ts b/packages/core/test/testing-agent.test.ts
index b3b3b365..e2880964 100644
--- a/packages/core/test/testing-agent.test.ts
+++ b/packages/core/test/testing-agent.test.ts
@@ -76,7 +76,7 @@ test("a recording refuses to start when the panel has nothing selected", async (
const recordings = new TestingAgentRecordings(devices);
// No project and no device is not something to pick for the user: the project picker is an OS
// folder dialog, which must not open inside an agent's turn.
- await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /The Testing tab is not open\. Call mobile_open_simulator with workspaceTool "testing"/);
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /The Testing tab is not open\. If no Mobile Dev panel is showing in this chat, call mobile_open_simulator with workspaceTool "testing" once.*do not open another/);
recordings.setPanelProject("/project");
await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /Boot an iOS simulator or Android emulator and mirror it/);
assert.equal(recordings.state().status, "idle");
diff --git a/packages/core/test/testing-chat-project.test.ts b/packages/core/test/testing-chat-project.test.ts
index bf68a986..e69fcc52 100644
--- a/packages/core/test/testing-chat-project.test.ts
+++ b/packages/core/test/testing-chat-project.test.ts
@@ -135,3 +135,26 @@ test("a host's MCP root stands in for the project path", async t => {
assert.equal((await other.request() as { path: string }).path, studioWorkspacePath(), "a root that is not a project is No project");
});
});
+
+test("a repeat open tells the agent the panel is already there, because the host draws a view per call", async t => {
+ await scratch(async () => {
+ const { open, client } = await openPlugin(t);
+ const texts = (result: Awaited>) => (result.content as { type: string; text: string }[]).map(part => part.text).join("\n");
+ assert.doesNotMatch(texts(await open({ projectPath: "" })), /already/i, "the first open says nothing");
+ // The tab has not reported (hidden, or still loading): the second call is told one was opened.
+ assert.match(texts(await open({ projectPath: "" })), /already opened in this chat.*Do not open more/s);
+ // Once the tab heartbeats, the warning says it is live.
+ await client.callTool({ name: "mobile_testing_set_context", arguments: { projectPath: studioWorkspacePath(), deviceId: "", bundleId: "" } });
+ assert.match(texts(await open({ projectPath: "" })), /already open in this chat and the Testing tab is reporting/);
+ });
+});
+
+test("booting a device never opens a panel", async t => {
+ await scratch(async () => {
+ const { client } = await openPlugin(t);
+ const result = await client.callTool({ name: "mobile_boot_simulator", arguments: { udid: "00000000-0000-0000-0000-000000000000" } });
+ assert.doesNotMatch(JSON.stringify(result.content), /panel/i);
+ const state = await client.callTool({ name: "mobile_testing_agent_state", arguments: {} });
+ assert.equal(state.structuredContent?.projectRequest, null, "no open call was made, so no panel was asked for");
+ });
+});
diff --git a/packages/core/test/testing-projects.test.ts b/packages/core/test/testing-projects.test.ts
index 0741e19c..1a72634d 100644
--- a/packages/core/test/testing-projects.test.ts
+++ b/packages/core/test/testing-projects.test.ts
@@ -3,7 +3,7 @@ import assert from "node:assert/strict";
import { mkdtemp, mkdir, readFile, rm, symlink, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
-import { deleteTestFile, discardStagedTestFile, findConfig, inspectProject, listTestFiles, parseTargets, previewTestFile, readTestFile, resolveTestRunPaths, saveStagedTestFile, stageTestFile, readTestTarget, studioWorkspacePath, TestingProjectChoices, writeTestTarget, writeTestFile } from "../src/testing-projects.ts";
+import { deleteTestFile, discardStagedTestFile, findConfig, inspectProject, listTestFiles, parseTargets, previewTestFile, readTestFile, resolveTestRunPaths, saveStagedTestFile, stageTestFile, readTestTarget, studioWorkspacePath, TestingProjectChoices, writeTestTarget, writeTestFile, storedTestsChangeRevision } from "../src/testing-projects.ts";
const CONFIG = `import { mobile } from "@e2e-dev/mobile";
import type { E2EConfig } from "e2e";
@@ -220,6 +220,33 @@ test("the Studio workspace needs no project: it is created on demand, bundled, a
}
});
+test("every write to a stored test or its pinned app moves the change revision the panel polls", async () => {
+ const { root } = await project();
+ const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
+ try {
+ process.env.MOBILE_DEV_TESTING_DIRECTORY = join(root, "studio-state");
+ const studio = studioWorkspacePath();
+ let seen = storedTestsChangeRevision();
+ const moved = () => { const now = storedTestsChangeRevision(); const did = now > seen; seen = now; return did; };
+ await writeTestFile(studio, "tests/flow.e2e.ts", SOURCE);
+ assert.ok(moved(), "a new file");
+ await writeTestFile(studio, "tests/flow.e2e.ts", SOURCE, false);
+ assert.ok(!moved(), "a refused overwrite changes nothing");
+ await writeTestFile(studio, "tests/flow.e2e.ts", SOURCE + "\n", true);
+ assert.ok(moved(), "a rewrite such as branch_line");
+ await writeTestTarget(studio, "tests/flow.e2e.ts", { platform: "ios", bundleId: "com.a" });
+ assert.ok(moved(), "a pin");
+ await writeTestTarget(studio, "tests/flow.e2e.ts", { platform: "android", bundleId: "com.b" }, "add");
+ assert.ok(moved(), "an added app");
+ await deleteTestFile(studio, "tests/flow.e2e.ts");
+ assert.ok(moved(), "a delete");
+ } finally {
+ if (previous === undefined) delete process.env.MOBILE_DEV_TESTING_DIRECTORY;
+ else process.env.MOBILE_DEV_TESTING_DIRECTORY = previous;
+ await rm(root, { recursive: true, force: true });
+ }
+});
+
test("a Studio test is pinned to its app beside the source, listed, re-pinned and cleared on delete", async () => {
const { root } = await project();
const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
diff --git a/packages/core/test/testing-studio-agent.test.ts b/packages/core/test/testing-studio-agent.test.ts
index 5c0af4cd..8b6d1119 100644
--- a/packages/core/test/testing-studio-agent.test.ts
+++ b/packages/core/test/testing-studio-agent.test.ts
@@ -371,7 +371,7 @@ test("a tab that stops reporting is closed: open, then stale, then refused, and
assert.equal(stale.isError, true, "stale");
assert.match(stale.content[0].text, /Testing tab is not open.*mobile_open_simulator/);
assert.equal(recordings.panelContext(), undefined, "the device selection goes with it");
- await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /Call mobile_open_simulator with workspaceTool "testing" to open it, then begin again/, "agent_begin refuses too");
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /call mobile_open_simulator with workspaceTool "testing" once to open it, then begin again/, "agent_begin refuses too");
await report();
assert.equal((await call("mobile_testing_tests")).isError, undefined, "a heartbeat revives it");
@@ -386,6 +386,23 @@ test("a tab that stops reporting is closed: open, then stale, then refused, and
});
});
+test("the default expiry outlasts a throttled background panel and still reports a silent one closed", async () => {
+ await withStudio(async studio => {
+ let clock = 1_000;
+ const { server, call } = fakeServer();
+ const recordings = new TestingAgentRecordings(fakeTreeDevices(), new TestDraftStore(join(studio, "drafts")), { now: () => clock });
+ registerTestingTools(server, PROJECTS, fakeTreeDevices(), undefined, { registry: new MatrixRegistry(), panel: recordings });
+ registerTestingAgentTools(server, fakeTreeDevices(), recordings);
+ await call("mobile_testing_set_context", { projectPath: studio, deviceId: "11111111-2222-3333-4444-555555555555", platform: "ios", bundleId: "com.app" });
+ clock += 70_000; // an unfocused window beating about once a minute
+ assert.equal((await call("mobile_testing_tests")).isError, undefined, "an unfocused panel is still open");
+ clock += 70_000;
+ assert.equal((await call("mobile_testing_tests")).isError, undefined, "a missed throttled beat is tolerated");
+ clock += 120_000;
+ assert.equal((await call("mobile_testing_tests")).isError, true, "a panel silent for minutes is closed");
+ });
+});
+
// ---- begin resolves what it can --------------------------------------------------------------------------------
const IOS_ID = "11111111-2222-3333-4444-555555555555";
@@ -485,7 +502,7 @@ test("ambiguous project mode asks which target, naming them", async () => {
test("a closed Testing tab is the only thing begin reports", async () => {
await withStudio(async studio => {
const recordings = autoRecordings(studio, AUTO_OPS(null, []));
- await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), (error: Error) => error.message === "The Testing tab is not open. Call mobile_open_simulator with workspaceTool \"testing\" to open it, then begin again.");
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), (error: Error) => /^The Testing tab is not open\..*do not open another/.test(error.message));
});
});
diff --git a/packages/mcp-app/src/components/workspace.tsx b/packages/mcp-app/src/components/workspace.tsx
index 7f6cbaaf..4a4a3287 100644
--- a/packages/mcp-app/src/components/workspace.tsx
+++ b/packages/mcp-app/src/components/workspace.tsx
@@ -46,6 +46,8 @@ export function Workspace({ panels, recordingController, banner, displayModeCont
const [simulatorsCollapsed, setSimulatorsCollapsed] = useState(false);
const [layout, setLayout] = useState(automaticLayout ?? "none");
const manualLayout = useRef(false);
+ const layoutRef = useRef(layout);
+ layoutRef.current = layout;
const recordingState = useSyncExternalStore(recordingController.subscribe, recordingController.getSnapshot);
useEffect(() => {
if (automaticLayout === undefined || manualLayout.current || recordingState.recording !== undefined) return;
@@ -70,6 +72,16 @@ export function Workspace({ panels, recordingController, banner, displayModeCont
setSavedVisible(false);
panels.show("testing");
}), [testing]);
+ // Picking a lane in the results shows that lane's platform. Only a single-mirror layout moves,
+ // and only on the pick itself: the manual platform picker and a mirror switched back by hand
+ // are never overridden.
+ useEffect(() => testing.onLanePicked(platform => {
+ const current = layoutRef.current;
+ if (current === "both" || current === "none" || current === platform) return;
+ manualLayout.current = true;
+ setLayout(platform);
+ onLayout(platform, true);
+ }), [testing]);
const performanceState = useSyncExternalStore(performance.subscribe, performance.getSnapshot);
const wide = useMediaQuery("(min-width: 900px)");
const fullscreen = document.documentElement.dataset.view === "workspace";
diff --git a/packages/mcp-app/src/workspace-app.tsx b/packages/mcp-app/src/workspace-app.tsx
index de77c2ca..503f2c61 100644
--- a/packages/mcp-app/src/workspace-app.tsx
+++ b/packages/mcp-app/src/workspace-app.tsx
@@ -45,6 +45,7 @@ export function startWorkspaceApp(options: WorkspaceOptions = {}) {
const devices = new DeviceWorkspace(app, panels, { onAutomaticLayout: renderWorkspace, connectionFailed });
panels.testing.setMirrorFocus(platform => devices.focusPlatform(platform));
+ panels.testing.setMirrorDevice((platform, deviceId) => devices.showDevice(platform, deviceId));
panels.logs.setLayout(document.documentElement.dataset.view === "workspace");
devices.changeLayout("none");
diff --git a/packages/skills/mobile-dev-testing/SKILL.md b/packages/skills/mobile-dev-testing/SKILL.md
index e059b1fd..43218331 100644
--- a/packages/skills/mobile-dev-testing/SKILL.md
+++ b/packages/skills/mobile-dev-testing/SKILL.md
@@ -20,7 +20,10 @@ The **Testing tab must be open**; it is how Mobile Dev knows the user is looking
yourself: whenever `begin` or a run tool says the Testing tab is not open, call
`mobile_open_simulator({ workspaceTool: "testing", projectPath })` (it also switches an open view to
that tab) and then call the tool again. Do not ask the user to open it; the call waits for the tab to
-report in. **Always pass `projectPath`: your workspace root (working directory), or `""` when the
+report in. **Open it once per chat.** The host draws a new Mobile Dev panel for every
+`mobile_open_simulator` call, so a second call leaves two panels. Booting devices, recording, running
+and matrix runs never need it again and never open one; if a tool still says the tab is not open after you
+opened it, it is hidden or on another tab: ask the user to show it instead of opening another. **Always pass `projectPath`: your workspace root (working directory), or `""` when the
chat has no project.** The tab then follows the chat: a folder that is not a mobile project (a
scratch folder, such as a Codex `Documents/Codex//...` one) selects No project, so recording
uses the app in the foreground; a project is selected and added to the list when missing. Never
@@ -36,7 +39,7 @@ user in a line:
Never ask the user for a project, device or target up front, and never pass them to `begin`. If it
refuses, the message names only what is missing, with one action each. Do those yourself when you
-can: boot a simulator (`mobile_boot_simulator`) or open the panel with `mobile_open_simulator`, then
+can: boot a simulator (`mobile_boot_simulator`) or, if no panel is open yet, open it with `mobile_open_simulator`, then
`begin` again. Ask the user only when the message says to: which of several devices or targets, an
app that must be opened or installed by hand, or a decision only they can make. **Never choose the project for them** — the picker is a system folder dialog, which must not open in the middle of your turn — and do not reach for another device because the chosen one is not booted.
@@ -143,8 +146,8 @@ deliverable — the panel is showing it, live, next to the steps.
No project open — the Testing tab says Studio — means tests live in Mobile Dev's own storage, each
pinned to an app. The tab must be open: every tool below reads the tab's selection and refuses
-when it has none. Then open it yourself with `mobile_open_simulator({ workspaceTool: "testing", projectPath })` and
-call the tool again; do not ask the user. `projectPath`
+when it has none. Then, if you have not opened the panel yet this chat, open it yourself with `mobile_open_simulator({ workspaceTool: "testing", projectPath })` and
+call the tool again; do not ask the user, and do not open a second panel. `projectPath`
is optional on all of them; it defaults to the tab's project.
### Record, which saves
diff --git a/packages/ui/src/components/testing-matrix.tsx b/packages/ui/src/components/testing-matrix.tsx
index 874ebf9c..207cf362 100644
--- a/packages/ui/src/components/testing-matrix.tsx
+++ b/packages/ui/src/components/testing-matrix.tsx
@@ -3,6 +3,7 @@ import { LoaderCircleIcon, RefreshCwIcon, SmartphoneIcon, XIcon } from "lucide-r
import { TestingNote } from "./testing-note";
import { platformLabel } from "../testing-panel.ts";
import type { TestingPanel } from "../testing-panel.ts";
+import type { DeviceAppsStore } from "../device-apps.ts";
import { MAX_MATRIX_LIMIT, isTerminalLane, laneDuration, laneLabel, matrixFinished, matrixSummary } from "../testing-matrix.ts";
import type { MatrixDeviceOption, MatrixLane } from "../testing-matrix.ts";
import { formatRunDuration } from "../test-recorder.ts";
@@ -72,13 +73,14 @@ const LANE_TONE: Record = {
failed: "bg-destructive/10 text-destructive", error: "bg-destructive/10 text-destructive", cancelled: "bg-muted text-muted-foreground",
};
-function LaneRow({ panel, lane, selected, totalSteps }: { panel: TestingPanel; lane: MatrixLane; selected: boolean; totalSteps?: number }) {
+function LaneRow({ panel, lane, selected, mirrored, totalSteps }: { panel: TestingPanel; lane: MatrixLane; selected: boolean; mirrored: boolean; totalSteps?: number }) {
const active = !isTerminalLane(lane.state);
const duration = laneDuration(lane);
- return
- panel.selectLane(lane.runId)}>
-
+ return
+ panel.openLane(lane.runId)}>
+ {lane.deviceName}{active && lane.state !== "queued" && }{laneLabel(lane, totalSteps)}{duration === undefined ? "" : formatRunDuration(duration)}
@@ -91,8 +93,11 @@ function LaneRow({ panel, lane, selected, totalSteps }: { panel: TestingPanel; l
* One row per device while a matrix runs and after it ends. Clicking a row shows that device's steps
* on the preview below; the summary says how many passed and failed.
*/
-export function MatrixLanes({ panel, totalSteps }: { panel: TestingPanel; totalSteps?: number }) {
+export function MatrixLanes({ panel, deviceApps, totalSteps }: { panel: TestingPanel; deviceApps: DeviceAppsStore; totalSteps?: number }) {
const state = useSyncExternalStore(panel.subscribe, panel.getSnapshot);
+ // Every hook before the early return: a matrix appearing mid-session (an agent's run) must not
+ // change the hook count, or React throws and the whole panel falls to its error boundary.
+ const mirroredDevice = useSyncExternalStore(deviceApps.subscribe, () => deviceApps.getSnapshot().device?.udid);
const matrix = state.matrix;
if (!matrix) return null;
const finished = matrixFinished(matrix);
@@ -105,7 +110,7 @@ export function MatrixLanes({ panel, totalSteps }: { panel: TestingPanel; totalS
{finished && panel.dismissMatrix()}>Dismiss}
-
{matrix.lanes.map(lane => )}
+
{matrix.lanes.map(lane => )}
{selected?.error &&
{selected.error}
}
;
}
diff --git a/packages/ui/src/components/testing-view.tsx b/packages/ui/src/components/testing-view.tsx
index 8ff2e3b0..47ad852c 100644
--- a/packages/ui/src/components/testing-view.tsx
+++ b/packages/ui/src/components/testing-view.tsx
@@ -319,7 +319,7 @@ export function TestingView({ panel, deviceApps }: { panel: TestingPanel; device
-
+
;
diff --git a/packages/ui/src/device-workspace.ts b/packages/ui/src/device-workspace.ts
index 99e57760..f50bfe05 100644
--- a/packages/ui/src/device-workspace.ts
+++ b/packages/ui/src/device-workspace.ts
@@ -86,6 +86,19 @@ export class DeviceWorkspace {
return true;
}
+ /**
+ * Switches a platform's mirror to a listed, booted device, as the device picker does, and makes
+ * that platform the active one. Answers false when the layout hides the platform or the device
+ * is not listed and booted; nothing is opened or booted.
+ */
+ showDevice(platform: Platform, deviceId: string): boolean {
+ const panel = this.panels.find(entry => entry.platform === platform);
+ if (!panel || panel.root.hidden || !panel.showDevice(deviceId)) return false;
+ this.activePlatform = platform;
+ this.updateSelection();
+ return true;
+ }
+
/** Opens the devices a tool call or host intent names. */
open(target: PanelTarget) { return this.devices.open(target); }
setAvailable(available: boolean) { return this.devices.setAvailable(available); }
diff --git a/packages/ui/src/simulator-panel.ts b/packages/ui/src/simulator-panel.ts
index e4ed3e35..fa4158ee 100644
--- a/packages/ui/src/simulator-panel.ts
+++ b/packages/ui/src/simulator-panel.ts
@@ -1071,6 +1071,15 @@ export function createSimulatorPanel(
openingTarget = undefined;
void action(async () => { await disconnect(); selectDevice(); await start(); });
});
+ /** Shows a listed, booted device in this mirror exactly as choosing it in the picker does. */
+ function showDevice(udid: string): boolean {
+ const listed = status?.devices.find(device => device.udid === udid) ?? physicalDevices.find(device => device.udid === udid);
+ if (!listed || listed.state !== "Booted" && listed.state !== "connected") return false;
+ if (devices.value !== udid) devices.value = udid;
+ if (devices.value !== udid) return false;
+ if (selected?.udid !== udid) devicePickerElement.dispatchEvent(new Event("change"));
+ return true;
+ }
element("start-device").addEventListener("click", () => { void action(start); });
root.querySelectorAll("[data-button]").forEach(button => {
button.addEventListener("click", () => { send({ type: "button", button: button.dataset.button === "home" ? "home" : "app-switcher" }); });
@@ -1129,6 +1138,7 @@ export function createSimulatorPanel(
root,
platform,
get selected() { return selected; },
+ showDevice,
fitScreen,
controls,
notice,
diff --git a/packages/ui/src/testing-panel.ts b/packages/ui/src/testing-panel.ts
index 32ad3c5e..a3ce0cb2 100644
--- a/packages/ui/src/testing-panel.ts
+++ b/packages/ui/src/testing-panel.ts
@@ -42,6 +42,29 @@ export type TestingAgentView = {
savedPath: string;
};
+/**
+ * What survives the panel document: the project the user was last in, and the agent's project
+ * request this panel already applied. The host rebuilds the document often (and after a crash),
+ * and a fresh one must reopen on the same project rather than on the newest folder, or replay an
+ * agent's request the user has since moved past. Best effort: storage can be blocked.
+ */
+const PROJECT_STATE_KEY = "mobile-dev.testing.project";
+type StoredProjectState = { project?: string; request?: { id: number; path: string } };
+function readProjectState(): StoredProjectState {
+ try {
+ const stored = JSON.parse(globalThis.localStorage?.getItem(PROJECT_STATE_KEY) ?? "null") as unknown;
+ const data = object(stored);
+ const request = object(data?.request);
+ return {
+ ...(typeof data?.project === "string" && data.project ? { project: data.project } : {}),
+ ...(typeof request?.id === "number" && typeof request.path === "string" ? { request: { id: request.id, path: request.path } } : {}),
+ };
+ } catch { return {}; }
+}
+function writeProjectState(change: StoredProjectState) {
+ try { globalThis.localStorage?.setItem(PROJECT_STATE_KEY, JSON.stringify({ ...readProjectState(), ...change })); } catch { /* best effort */ }
+}
+
/** 400 ms while an agent is recording, so a step lands in the panel as it is recorded. */
const AGENT_POLL_ACTIVE_MS = 400;
/**
@@ -212,6 +235,8 @@ export class TestingPanel {
/** The agent recording's revision the panel has already adopted; -1 before the first poll. */
private agentRevision = -1;
+ /** The server's stored-tests revision the panel has loaded; -1 before the first poll. */
+ private storedTestsRevision = -1;
private agentTimer?: ReturnType;
private agentPolling = false;
/** The last selection reported to the server, so the context tool is not called on every tick. */
@@ -239,18 +264,24 @@ export class TestingPanel {
private heartbeatTimer?: ReturnType;
private readonly onPageHide = () => { void this.clearReportedContext(); };
+ private beat() { if (this.snapshot.open) void this.reportContext(true); }
+ /** Coming back from throttling: report now rather than wait for the next (late) timer tick. */
+ private readonly onWake = () => { this.beat(); };
constructor(app: HostBridge, deviceApps: DeviceAppsStore, options: { heartbeatMs?: number } = {}) {
this.app = app;
this.deviceApps = deviceApps;
// The server only believes a panel that keeps reporting: a closed tab or window sends nothing.
- this.heartbeatTimer = setInterval(() => {
- const hidden = typeof document !== "undefined" && document.visibilityState === "hidden";
- if (this.snapshot.open && !hidden) void this.reportContext(true);
- }, options.heartbeatMs ?? PANEL_HEARTBEAT_MS);
+ // An unfocused host window reports the page hidden and throttles its timers; that is not the tab
+ // closing, so the beat does not check visibility. `snapshot.open` is the panel's own tab state.
+ this.heartbeatTimer = setInterval(() => { this.beat(); }, options.heartbeatMs ?? PANEL_HEARTBEAT_MS);
// An interval must not keep a host process alive on its own.
(this.heartbeatTimer as { unref?: () => void }).unref?.();
- if (typeof window !== "undefined") window.addEventListener("pagehide", this.onPageHide);
+ if (typeof window !== "undefined") {
+ window.addEventListener("pagehide", this.onPageHide);
+ window.addEventListener("focus", this.onWake);
+ }
+ if (typeof document !== "undefined") document.addEventListener("visibilitychange", this.onWake);
// The device is half of what an agent recording needs and it belongs to the simulator panel,
// so the selection is reported whenever either half moves.
this.stopWatchingDevices = deviceApps.subscribe(() => {
@@ -433,14 +464,17 @@ export class TestingPanel {
if (await this.applyServerProjectRequest()) return;
// No project is a state of its own: with nothing recorded against yet, Studio opens on its
// private workspace so recording never waits for a folder to be chosen.
- const latest = this.snapshot.projects[0]?.path || this.snapshot.studioPath;
+ // The one the user was last in, whether that was Studio or a folder; else the newest folder.
+ const last = readProjectState().project;
+ const known = last && (last === this.snapshot.studioPath || this.snapshot.projects.some(entry => entry.path === last)) ? last : "";
+ const latest = known || this.snapshot.projects[0]?.path || this.snapshot.studioPath;
if (latest && !this.disposed && !this.snapshot.projectPath) await this.selectProject(latest);
})();
this.restoreRequest = request;
try { await request; } finally { if (this.restoreRequest === request) this.restoreRequest = undefined; }
}
- private appliedProjectRequest = 0;
+ private appliedProjectRequest = readProjectState().request;
private projectRequestApply?: Promise;
/**
@@ -452,8 +486,12 @@ export class TestingPanel {
const request = object(data.projectRequest);
const id = request?.id, path = text(request?.path);
if (typeof id !== "number" || !path) return false;
- if (id !== this.appliedProjectRequest) {
- this.appliedProjectRequest = id;
+ // A request an earlier document of this panel already applied is spent, not a new instruction.
+ const applied = this.appliedProjectRequest;
+ if (applied && applied.id === id && applied.path === path && !this.projectRequestApply) return false;
+ if (!applied || applied.id !== id || applied.path !== path) {
+ this.appliedProjectRequest = { id, path };
+ writeProjectState({ request: { id, path } });
this.projectRequestApply = (async () => {
await this.refreshProjects();
if (this.disposed || path === this.snapshot.projectPath) return;
@@ -548,6 +586,7 @@ export class TestingPanel {
async selectProject(projectPath: string) {
const path = projectPath.trim();
const revision = ++this.loadRevision;
+ if (path) writeProjectState({ project: path });
this.clearTestPreview();
// The flow on screen belongs to the project it was recorded against, so the panel lets go of
// its draft rather than rewriting that draft under a different project's path.
@@ -838,6 +877,32 @@ export class TestingPanel {
private focusMirror: ((platform: "ios" | "android") => boolean) | undefined;
setMirrorFocus(focus: ((platform: "ios" | "android") => boolean) | undefined) { this.focusMirror = focus; }
+ private mirrorDevice: ((platform: "ios" | "android", deviceId: string) => boolean) | undefined;
+ setMirrorDevice(show: ((platform: "ios" | "android", deviceId: string) => boolean) | undefined) { this.mirrorDevice = show; }
+
+ /**
+ * A click on a result row: shows that lane's steps, and mirrors its device when the device is
+ * booted. Lanes run on their own device sessions, never through the mirror, so switching it
+ * during a run (the panel's or the agent's) does not touch the run.
+ */
+ openLane(runId: string) {
+ this.selectLane(runId);
+ const lane = this.snapshot.matrix?.lanes.find(entry => entry.runId === runId);
+ if (!lane) return;
+ // A single-mirror layout first switches to the lane's platform, since a hidden mirror cannot
+ // show a device. Only on the click itself, so a platform the user switches back to stays.
+ this.onLaneSelected?.(lane.platform);
+ if (this.deviceApps.getSnapshot().device?.udid === lane.deviceId) return;
+ if (this.mirrorDevice?.(lane.platform, lane.deviceId)) countUiEvent("ui.testing.lane_mirror");
+ }
+
+ private onLaneSelected?: (platform: "ios" | "android") => void;
+ /** The host chrome's way of hearing which platform a clicked lane ran on, to show that mirror. */
+ onLanePicked(listener: (platform: "ios" | "android") => void) {
+ this.onLaneSelected = listener;
+ return () => { if (this.onLaneSelected === listener) this.onLaneSelected = undefined; };
+ }
+
async reRecordStoredLine(line: number) {
const platform = this.reRecord?.platform;
if (!platform || line <= 0) return;
@@ -1290,6 +1355,35 @@ export class TestingPanel {
}
}
+ /**
+ * A test or its pinned app was written by someone else (the agent's branch_line, set_target,
+ * wait_for_app pin, a save). Reload the list, which carries the pins, and the open test's source,
+ * unless the user has unsaved edits to it.
+ */
+ private followStoredTests(revision: number) {
+ const previous = this.storedTestsRevision;
+ this.storedTestsRevision = revision;
+ if (previous < 0 || revision === previous) return;
+ const { selectedTestPath, selectedTestStaged, loadingTest } = this.snapshot;
+ void this.refreshTests().then(() => {
+ if (selectedTestPath && !selectedTestStaged && !loadingTest && this.snapshot.selectedTestPath === selectedTestPath && !this.snapshot.selectedTestStaged) void this.reloadSelectedTest();
+ });
+ }
+
+ /** Re-reads the open test's stored source in place, keeping the preview on screen meanwhile. */
+ private async reloadSelectedTest() {
+ const { projectPath, selectedTestPath: relativePath } = this.snapshot;
+ if (!projectPath || !relativePath) return;
+ const revision = ++this.testReadRevision;
+ try {
+ const response = await this.call("mobile_testing_read_file", { projectPath, relativePath }, 15_000);
+ if (this.disposed || revision !== this.testReadRevision || this.snapshot.selectedTestPath !== relativePath || this.snapshot.selectedTestStaged) return;
+ const data = object(response.structuredContent);
+ this.update({ selectedTestSource: text(data?.source), selectedTestOriginalHash: text(data?.originalHash), selectedTestStaged: data?.staged === true });
+ countUiEvent("ui.testing.test_preview_reload");
+ } catch { /* the next change reloads it */ }
+ }
+
private async readAgentState() {
await this.readAgentRun();
let data: Record;
@@ -1310,6 +1404,7 @@ export class TestingPanel {
title: text(data.title), goal: text(data.goal), steps: steps.length, note: text(data.note),
draftId: text(data.draftId), savedPath: text(data.savedPath),
};
+ this.followStoredTests(typeof data.storedTestsRevision === "number" ? data.storedTestsRevision : 0);
const savedPath = agent.savedPath;
const first = this.agentRevision < 0;
const unchanged = !first && revision === this.agentRevision;
@@ -1844,7 +1939,8 @@ export class TestingPanel {
void this.clearReportedContext();
this.disposed = true;
clearInterval(this.heartbeatTimer);
- if (typeof window !== "undefined") window.removeEventListener("pagehide", this.onPageHide);
+ if (typeof window !== "undefined") { window.removeEventListener("pagehide", this.onPageHide); window.removeEventListener("focus", this.onWake); }
+ if (typeof document !== "undefined") document.removeEventListener("visibilitychange", this.onWake);
clearTimeout(this.agentTimer);
clearTimeout(this.draftTimer);
this.stopWatchingDevices();
diff --git a/packages/ui/test/testing-agent-run-render.test.ts b/packages/ui/test/testing-agent-run-render.test.ts
new file mode 100644
index 00000000..7998b46a
--- /dev/null
+++ b/packages/ui/test/testing-agent-run-render.test.ts
@@ -0,0 +1,101 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { build } from "esbuild";
+import { JSDOM } from "jsdom";
+
+/** Mounts the real Testing view on a panel in the state an agent's two-device run leaves it in. */
+test("the Testing view renders while an agent runs a pinned iOS test on iOS and Android", async t => {
+ const built = await build({
+ stdin: { contents: `
+ import { createRoot } from "react-dom/client";
+ import { flushSync } from "react-dom";
+ import { TestingPanel } from "./packages/ui/src/testing-panel.ts";
+ import { TestingView } from "./packages/ui/src/components/testing-view.tsx";
+ export function mount(scenario) {
+ const host = { async callServerTool() { return { content: [], structuredContent: {} }; }, getHostCapabilities() { return undefined; } };
+ const state = { device: scenario.device, apps: [], foregroundApp: scenario.front, ready: true };
+ const deviceApps = { subscribe: () => () => undefined, getSnapshot: () => state };
+ const panel = new TestingPanel(host, deviceApps, { heartbeatMs: 1e9 });
+ panel.update({ projectPath: "/studio" });
+ panel.update({ available: true, open: true, studioPath: "/studio", runtimeMode: "bundled", ...scenario.before });
+ const errors = [];
+ const root = createRoot(document.getElementById("root"), { onUncaughtError: e => errors.push(String(e)), onCaughtError: e => errors.push(String(e)) });
+ flushSync(() => root.render());
+ return { errors, panel, apply: () => panel.update(scenario.fields), close: () => { root.unmount(); panel.dispose?.(); } };
+ }`, resolveDir: process.cwd().replace(/packages\/ui$/, ""), loader: "tsx" },
+ bundle: true, write: false, format: "iife", globalName: "RenderTest", platform: "browser", jsx: "automatic",
+ define: { "process.env.NODE_ENV": '"production"' }, logLevel: "silent",
+ });
+ const dom = new JSDOM('', { pretendToBeVisual: true, runScripts: "outside-only", url: "https://mobile-dev.test/" });
+ const window = dom.window;
+ window.ResizeObserver = class { observe() {} disconnect() {} unobserve() {} };
+ window.eval(built.outputFiles[0].text);
+ const lane = (platform: string, state: string) => ({ runId: `r-${platform}`, deviceId: `d-${platform}`, deviceName: platform, platform, state, progress: [], ...(state === "failed" ? { result: { status: "failed", steps: [{ line: 4, status: "failed", error: "nope" }] } } : {}) });
+ const source = 'import { test } from "@e2e-dev/mobile";\n\ntest("flow", async ({ app, screen }) => {\n await app.open();\n await screen.getByText("Go").tap();\n});\n';
+ const scenario = {
+ device: { udid: "u", name: "Pixel", state: "Booted", platform: "android", kind: "emulator" },
+ front: { bundleId: "com.example.android", pid: 1 },
+ fields: {
+ tests: [{ relativePath: "flow.e2e.ts", name: "flow", updatedAt: new Date().toISOString(), sizeBytes: 10, target: { platform: "ios", bundleId: "com.example", apps: { android: "com.example.android" } } }],
+ selectedTestPath: "flow.e2e.ts", selectedTestSource: source, agentRun: true,
+ matrix: { matrixId: "m", testPath: "flow.e2e.ts", limit: 3, startedAt: 1, lanes: [lane("ios", "passed"), lane("android", "failed")] },
+ selectedLane: "r-android",
+ },
+ before: {},
+ };
+ const mounted = window.RenderTest.mount(scenario);
+ t.after(() => { mounted.close(); window.close(); });
+ await new Promise(resolve => window.setTimeout(resolve, 25));
+ mounted.apply();
+ await new Promise(resolve => window.setTimeout(resolve, 25));
+ assert.equal(mounted.errors.length, 0, [...mounted.errors].join("\n"));
+ assert.ok(window.document.querySelector("[data-testing-lanes]"), "the lanes render");
+});
+
+test("the panel adopts an agent run through its own polling and keeps rendering", async t => {
+ const built = await build({
+ stdin: { contents: `
+ import { createRoot } from "react-dom/client";
+ import { flushSync } from "react-dom";
+ import { TestingPanel } from "./packages/ui/src/testing-panel.ts";
+ import { TestingView } from "./packages/ui/src/components/testing-view.tsx";
+ export function mount(scenario) {
+ const host = { async callServerTool({ name }) { return { content: [], structuredContent: scenario.responses[name] ?? {} }; }, getHostCapabilities() { return undefined; } };
+ const state = { device: scenario.device, apps: [], foregroundApp: scenario.front, ready: true };
+ const deviceApps = { subscribe: () => () => undefined, getSnapshot: () => state };
+ const panel = new TestingPanel(host, deviceApps, { heartbeatMs: 1e9 });
+ const errors = [];
+ const root = createRoot(document.getElementById("root"), { onUncaughtError: e => errors.push(String(e)), onCaughtError: e => errors.push(String(e)) });
+ flushSync(() => root.render());
+ panel.show();
+ panel.setAvailable(true);
+ return { errors, panel, close: () => { root.unmount(); panel.dispose?.(); } };
+ }`, resolveDir: process.cwd().replace(/packages\/ui$/, ""), loader: "tsx" },
+ bundle: true, write: false, format: "iife", globalName: "RenderTest2", platform: "browser", jsx: "automatic",
+ define: { "process.env.NODE_ENV": '"production"' }, logLevel: "silent",
+ });
+ const dom = new JSDOM('', { pretendToBeVisual: true, runScripts: "outside-only", url: "https://mobile-dev.test/" });
+ const window = dom.window;
+ window.ResizeObserver = class { observe() {} disconnect() {} unobserve() {} };
+ window.eval(built.outputFiles[0].text);
+ const lane = (platform: string, state: string) => ({ runId: `r-${platform}`, deviceId: `d-${platform}`, deviceName: platform, platform, state, progress: [{ stepIndex: 0, phase: "start" }], ...(state === "failed" ? { result: { status: "failed", steps: [{ line: 4, status: "failed", error: "nope" }] } } : {}) });
+ const source = 'import { test } from "@e2e-dev/mobile";\n\ntest("flow", async ({ app, screen }) => {\n await app.open();\n await screen.getByText("Go").tap();\n});\n';
+ const mounted = window.RenderTest2.mount({
+ device: { udid: "u", name: "Pixel", state: "Booted", platform: "android", kind: "emulator" },
+ front: { bundleId: "com.example.android", pid: 1 },
+ responses: {
+ mobile_testing_projects: { projects: [{ path: "/studio", name: "Studio" }], studioPath: "/studio" },
+ mobile_testing_project_config: { runtimeMode: "bundled", targets: [], setupState: "available" },
+ mobile_testing_tests: { tests: [{ relativePath: "flow.e2e.ts", name: "flow", updatedAt: new Date().toISOString(), sizeBytes: 10, target: { platform: "ios", bundleId: "com.example", apps: { android: "com.example.android" } } }] },
+ mobile_testing_read_file: { source, originalHash: "h" },
+ mobile_testing_run_progress: { running: true, matrixId: "m", testPath: "flow.e2e.ts", limit: 3, startedAt: 1, lanes: [lane("ios", "passed"), lane("android", "running")] },
+ },
+ });
+ t.after(() => { mounted.close(); window.close(); });
+ await new Promise(resolve => window.setTimeout(resolve, 300));
+ await (mounted.panel as unknown as { readAgentState(): Promise }).readAgentState();
+ await new Promise(resolve => window.setTimeout(resolve, 300));
+ assert.equal(mounted.errors.length, 0, [...mounted.errors].join("\n"));
+ const s = mounted.panel.getSnapshot();
+ assert.equal(s.agentRun, true, JSON.stringify({ p: s.projectPath, t: s.selectedTestPath, e: s.error, m: !!s.matrix, tests: s.tests.length }));
+});
diff --git a/packages/ui/test/testing-panel-project-state.test.ts b/packages/ui/test/testing-panel-project-state.test.ts
new file mode 100644
index 00000000..219633db
--- /dev/null
+++ b/packages/ui/test/testing-panel-project-state.test.ts
@@ -0,0 +1,94 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import type { HostBridge } from "../src/host-bridge.ts";
+import type { DeviceAppsStore } from "../src/device-apps.ts";
+import { TestingPanel } from "../src/testing-panel.ts";
+
+const STUDIO = "/support/mobile-dev/studio";
+const APP = "/Users/someone/expoapp57";
+const KEY = "mobile-dev.testing.project";
+const deviceApps = { subscribe: () => () => undefined, getSnapshot: () => ({ device: undefined }) } as unknown as DeviceAppsStore;
+
+function storage(initial?: unknown) {
+ const values = new Map(initial === undefined ? [] : [[KEY, JSON.stringify(initial)]]);
+ (globalThis as unknown as { localStorage: unknown }).localStorage = {
+ getItem: (key: string) => values.get(key) ?? null, setItem: (key: string, value: string) => { values.set(key, value); },
+ };
+ return values;
+}
+
+function host(calls: string[], request?: { id: number; path: string }) {
+ return { async callServerTool({ name, arguments: input }: { name: string; arguments: Record }) {
+ calls.push(name === "mobile_testing_choose_project" ? `${name}:${String(input.projectPath)}` : name);
+ const structuredContent: Record =
+ name === "mobile_testing_projects" ? { projects: [{ path: APP, name: "expoapp57" }], studioPath: STUDIO }
+ : name === "mobile_testing_agent_state" ? { projectRequest: request ?? null }
+ : name === "mobile_testing_choose_project" ? { project: { path: input.projectPath, name: "expoapp57" } }
+ : {};
+ return { content: [], structuredContent };
+ } } as unknown as HostBridge;
+}
+const settle = async (panel: TestingPanel, path: string) => {
+ const deadline = Date.now() + 2000;
+ while (panel.getSnapshot().projectPath !== path && Date.now() < deadline) await new Promise(resolve => setTimeout(resolve, 10));
+ return panel.getSnapshot().projectPath;
+};
+
+test("a reopened panel returns to No project, not the newest folder", async t => {
+ storage({ project: STUDIO });
+ const panel = new TestingPanel(host([]), deviceApps, { heartbeatMs: 1e9 });
+ t.after(() => panel.dispose?.());
+ panel.setAvailable(true);
+ assert.equal(await settle(panel, STUDIO), STUDIO);
+});
+
+test("without a saved choice the newest folder still opens", async t => {
+ storage();
+ const panel = new TestingPanel(host([]), deviceApps, { heartbeatMs: 1e9 });
+ t.after(() => panel.dispose?.());
+ panel.setAvailable(true);
+ assert.equal(await settle(panel, APP), APP);
+});
+
+test("an agent's project request already applied by an earlier document is not replayed", async t => {
+ const values = storage({ project: STUDIO, request: { id: 4, path: APP } });
+ const calls: string[] = [];
+ const panel = new TestingPanel(host(calls, { id: 4, path: APP }), deviceApps, { heartbeatMs: 1e9 });
+ t.after(() => panel.dispose?.());
+ panel.setAvailable(true);
+ assert.equal(await settle(panel, STUDIO), STUDIO);
+ await new Promise(resolve => setTimeout(resolve, 50));
+ assert.equal(calls.some(call => call.startsWith("mobile_testing_choose_project")), false);
+ assert.equal(panel.getSnapshot().projectPath, STUDIO);
+ assert.ok(values.get(KEY));
+});
+
+test("a new agent request is still applied once and remembered", async t => {
+ const values = storage({ project: STUDIO, request: { id: 4, path: APP } });
+ const panel = new TestingPanel(host([], { id: 5, path: APP }), deviceApps, { heartbeatMs: 1e9 });
+ t.after(() => panel.dispose?.());
+ panel.setAvailable(true);
+ assert.equal(await settle(panel, APP), APP);
+ assert.deepEqual(JSON.parse(values.get(KEY)!).request, { id: 5, path: APP });
+});
+
+test("clicking a lane switches the layout and mirror to it, and a poll does not", async t => {
+ storage();
+ const panel = new TestingPanel(host([]), deviceApps, { heartbeatMs: 1e9 });
+ t.after(() => panel.dispose?.());
+ const lane = (platform: "ios" | "android", state: string) => ({ runId: `r-${platform}`, deviceId: `d-${platform}`, deviceName: platform, platform, state, progress: [] });
+ const internals = panel as unknown as { update(fields: Record): void; readMatrix(id: string): Promise };
+ internals.update({ matrix: { matrixId: "m", limit: 3, startedAt: 1, lanes: [lane("ios", "passed"), lane("android", "failed")] }, selectedLane: "r-ios" });
+ const picked: string[] = [], focused: string[] = [];
+ panel.onLanePicked(platform => picked.push(platform));
+ panel.setMirrorDevice((platform, deviceId) => { focused.push(`${platform}:${deviceId}`); return true; });
+ panel.openLane("r-android");
+ assert.deepEqual(picked, ["android"]);
+ assert.deepEqual(focused, ["android:d-android"]);
+ panel.openLane("r-ios");
+ assert.deepEqual(focused, ["android:d-android", "ios:d-ios"]);
+ // The panel's own refresh of the run re-selects the lane quietly: it must not move the mirror.
+ const before = focused.length;
+ await internals.readMatrix("m").catch(() => undefined);
+ assert.equal(focused.length, before);
+});
From 0b63ac8759d74a490827ac517e707bd713d6127a Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Fri, 20 Nov 2026 13:37:09 +0500
Subject: [PATCH 20/23] feat: project mode
---
docs/mcp-tools.md | 2 +-
docs/test-matrix.md | 2 +-
docs/testing-panel.md | 21 ++-
packages/core/src/testing-prepare.ts | 29 ++-
packages/core/src/testing-run.ts | 165 +++++++++++++++++-
packages/core/src/testing-tools.ts | 50 +++++-
.../core/test/testing-matrix-project.test.ts | 130 ++++++++++++++
packages/core/test/testing-panel-ui.test.ts | 10 +-
packages/core/test/testing-prepare.test.ts | 9 +
packages/core/test/testing-run.test.ts | 158 ++++++++++++++++-
packages/skills/mobile-dev-testing/SKILL.md | 6 +
packages/ui/src/components/testing-matrix.tsx | 8 +-
packages/ui/src/components/testing-view.tsx | 6 +-
packages/ui/src/testing-panel.ts | 57 +++++-
packages/ui/test/testing-matrix.test.ts | 15 +-
packages/ui/test/testing-panel.test.ts | 9 +-
16 files changed, 626 insertions(+), 51 deletions(-)
create mode 100644 packages/core/test/testing-matrix-project.test.ts
diff --git a/docs/mcp-tools.md b/docs/mcp-tools.md
index 92685952..d8c43451 100644
--- a/docs/mcp-tools.md
+++ b/docs/mcp-tools.md
@@ -68,7 +68,7 @@
| `mobile_appflow_submit_decision` | Submit one role-valid JSON decision and wait briefly for the next (model only) |
| `mobile_appflow_screenshot` | Read an authorized App Flow PNG (app only) |
| `mobile_testing_run_test` | Run one saved Testing Studio test on the single device the runner picks and wait for its steps (app only). It is a matrix of one |
-| `mobile_testing_run_matrix` | Run one test on several devices at once, one lane per device; returns a `matrixId` immediately. `devices: {deviceId, platform}[]`, `apps: {ios?, android?}`, `limit` (default 3, max 8, the rest queue). Boots devices that are off and copies the app from another listed device when missing (app only). Bundled runner only |
+| `mobile_testing_run_matrix` | Run one test on several devices at once, one lane per device; returns a `matrixId` immediately. `devices: {deviceId, platform}[]`, `apps: {ios?, android?}`, `limit` (default 3, max 8, the rest queue). Boots devices that are off. Bundled mode copies the app from another booted device when missing (app only). A project with its own e2e config runs its target for each device's platform (`targets: {ios?, android?}` picks by name) on that device; a missing app is copied the same way and the target's engine must be a direct `mobile(...)` call |
| `mobile_testing_run_progress` | Read a matrix's lanes: state (`queued`, `booting`, `installing`, `running`, `passed`, `failed`, `cancelled`, `error`), live steps and result per device. `matrixId` optional; without it the latest run (app only) |
| `mobile_testing_cancel` | Cancel one device's lane (`deviceId`) or every unfinished lane of a `matrixId`; a queued lane never starts (app only) |
diff --git a/docs/test-matrix.md b/docs/test-matrix.md
index d3d24872..c8d03571 100644
--- a/docs/test-matrix.md
+++ b/docs/test-matrix.md
@@ -1,6 +1,6 @@
# Test matrix — plan
-Status: **bundled mode implemented** (milestones 1, 2, 3 and 5). Project mode (milestone 4) is deferred: it needs a device override the runner does not offer yet. Docs: [testing-panel.md](testing-panel.md#running-on-several-devices-test-matrix), [mcp-tools.md](mcp-tools.md).
+Status: **bundled mode implemented** (milestones 1, 2, 3 and 5). Project mode (milestone 4) works through a text-rewritten copy of the config (`runProjectLane`, `rewriteLaneConfig` in `testing-run.ts`); the upstream `e2e run --device` flag that replaces it is tracked in `items-todo.md`. Docs: [testing-panel.md](testing-panel.md#running-on-several-devices-test-matrix), [mcp-tools.md](mcp-tools.md).
Run one recorded e2e test on several devices at once — e.g. iPhone 17, iPhone 16 and a Pixel emulator — from the Testing panel, or from chat through MCP.
diff --git a/docs/testing-panel.md b/docs/testing-panel.md
index ad6201fc..7ff8c7b7 100644
--- a/docs/testing-panel.md
+++ b/docs/testing-panel.md
@@ -796,9 +796,17 @@ E2E setup → **Devices** lists the iOS simulators and Android emulators with *B
or none is the plain single-device run. "Run up to [3] at once" caps how many devices work at the
same time (1–8); the rest queue. The ticked devices and the limit are saved per project.
-Bundled runtime only. A project with its own `e2e.config.ts` pins its own device and `mobile()`
-returns an opaque engine handle, so the Devices section is disabled with a note there and single
-runs behave exactly as before.
+A project with its own `e2e.config.ts` works too, with differences. Each lane runs the config's
+target for the device's platform (the selected target wins its platform), and the plugin neither
+installs nor launches the app: a device without it fails its lane with "App not installed", and
+the runner's own `app.open` starts it. `mobile()` returns an opaque engine handle and the e2e CLI has
+no per-run device flag, so a lane **copies the config text** and rewrites that target's
+`mobile(ARG)` into `mobile({ ...(ARG), device, session })`, which keeps the user's other options.
+The copy runs from an isolated mirror of the project (or, for a run of the file itself, as a hidden
+`.e2e.mobile-dev-lane--` file beside the config) and is removed when the lane ends; stale
+ones from a dead process are swept. A target whose engine is not a direct `mobile(...)` call is
+refused with a message saying so. This workaround is replaced by an upstream `e2e run --device`
+flag; see `items-todo.md`.
```mermaid
flowchart LR
@@ -811,13 +819,14 @@ flowchart LR
- **One `e2e run` per device**, not the runner's device pool: a pool gives *different files* to
different devices, a matrix needs the *same* test on each with its own progress, failure and
- cancel. Each lane gets a generated config with `mobile({ platform, device })` and a target name
+ cancel. A bundled lane gets a generated config with `mobile({ platform, device })` and a target name
unique to the device (the engine names its agent-device session after the target), plus its own
- `--output` directory inside its temporary workspace. Nothing is written to the project.
+ `--output` directory inside its temporary workspace. Nothing is written to the project. (A project
+ lane is described above.)
- **Lane states:** Queued → Booting → Installing → Running → Passed / Failed / Cancelled / Error.
A device that is off is booted (`xcrun simctl boot` + `bootstatus -b`, or the Android emulator
through `ServeEmu`; an `avd:` id becomes the running serial). Booting counts against the limit.
-- **A missing app is copied from another device in the run that has it**: iOS with `simctl
+- **A missing app is copied from another booted device that has it**: iOS with `simctl
get_app_container` + `install`, Android with `pm path` + `adb pull`, installed with
`install-multiple` when the app is split. No device has it → the lane fails with "App not
installed" and the others carry on. The request carries one app id per platform
diff --git a/packages/core/src/testing-prepare.ts b/packages/core/src/testing-prepare.ts
index a94d9c7b..51ac98a5 100644
--- a/packages/core/src/testing-prepare.ts
+++ b/packages/core/src/testing-prepare.ts
@@ -33,6 +33,11 @@ export interface DeviceOps {
export interface LaneExecutorDeps {
ops: DeviceOps;
apps: MatrixAppIds;
+ /**
+ * Project mode: the plugin does not launch the user's app — the runner's own `app.open` starts it.
+ * A device that lacks the app gets it copied from another booted device that has it, as in bundled mode.
+ */
+ projectMode?: boolean;
runTest(lane: Lane, deviceId: string, signal: AbortSignal, onProgress: (progress: TestRunProgress) => void): Promise;
}
@@ -58,11 +63,11 @@ export function createLaneExecutor(deps: LaneExecutorDeps): LaneExecutor {
if (!await deps.ops.hasApp(lane.platform, deviceId, appId)) {
setState("installing");
const source = await findSource(deps.ops, lane, lanes, deviceId, appId);
- if (!source) throw new ExpectedOperationError("app_unavailable", `App not installed: ${appId} is not on ${lane.deviceName}, and no other device in this run has it to copy. Build and install it once, then run again.`);
+ if (!source) throw new ExpectedOperationError("app_unavailable", `App not installed: ${appId} is not on ${lane.deviceName}, and no other booted device has it to copy. Build and install it once, then run again.`);
await deps.ops.copyApp(lane.platform, source, deviceId, appId, signal);
}
signal.throwIfAborted();
- await deps.ops.launch(lane.platform, deviceId, appId);
+ if (!deps.projectMode) await deps.ops.launch(lane.platform, deviceId, appId);
return deviceId;
},
run: (lane, deviceId, signal, onProgress) => deps.runTest(lane, deviceId, signal, onProgress),
@@ -70,16 +75,26 @@ export function createLaneExecutor(deps: LaneExecutorDeps): LaneExecutor {
}
/** The first other device of the same platform in the matrix that has the app installed. */
+/**
+ * A device to copy the app from: another device in this run first, then any other booted device of
+ * the platform. The app is often installed only on the device it was built for, which need not be
+ * one the user ticked; copying reads its app container and leaves that device as it is.
+ */
async function findSource(ops: DeviceOps, lane: Lane, lanes: readonly Lane[], own: string, appId: string): Promise {
+ const tried = new Set([own]);
+ // A device that is off, offline or going away cannot be a source; that is not an error here.
+ const usable = async (candidate: string) => {
+ if (tried.has(candidate)) return false;
+ tried.add(candidate);
+ try { return await ops.isBooted(lane.platform, candidate) && await ops.hasApp(lane.platform, candidate, appId); } catch { return false; }
+ };
for (const other of lanes) {
if (other.runId === lane.runId || other.platform !== lane.platform) continue;
const candidate = other.resolvedDeviceId ?? other.deviceId;
- if (candidate === own) continue;
- // A device that is off, offline or going away cannot be a source; that is not an error here.
- try {
- if (await ops.isBooted(lane.platform, candidate) && await ops.hasApp(lane.platform, candidate, appId)) return candidate;
- } catch { /* try the next one */ }
+ if (await usable(candidate)) return candidate;
}
+ const booted = await ops.bootedDevices?.(lane.platform).catch(() => []) ?? [];
+ for (const device of booted) if (await usable(device.deviceId)) return device.deviceId;
return undefined;
}
diff --git a/packages/core/src/testing-run.ts b/packages/core/src/testing-run.ts
index c39a62fa..8c25c860 100644
--- a/packages/core/src/testing-run.ts
+++ b/packages/core/src/testing-run.ts
@@ -2,7 +2,8 @@ import { spawn } from "node:child_process";
import { existsSync } from "node:fs";
import { mkdir, mkdtemp, readFile, readdir, realpath, rm, symlink, writeFile } from "node:fs/promises";
import { homedir, tmpdir } from "node:os";
-import { dirname, join } from "node:path";
+import { randomBytes } from "node:crypto";
+import { dirname, extname, join, relative } from "node:path";
import { pathToFileURL } from "node:url";
import { APP_FLOW_DIRECTORY } from "./app-flow-host.ts";
import { ExpectedOperationError } from "@mobile-dev/shared/error-reporting.ts";
@@ -286,6 +287,11 @@ export interface TestRunRequest {
runtime?: { mode: "project" | "bundled"; root: string };
/** Required only for a bundled run, whose ephemeral config cannot read a project target. */
bundledTarget?: BundledTarget;
+ /**
+ * A project-mode matrix lane: run the project's own config on one chosen device. See `runProjectLane`.
+ * `target` is the config's target name (its engine must be a direct `mobile(...)` call).
+ */
+ projectLane?: { target: string; device: string };
/** Non-secret preference for a bundled test containing agent.* calls. */
model?: { provider: BundledModelProvider; model: string; endpoint?: string };
}
@@ -423,6 +429,7 @@ function refusedTheConfig(result: TestRunResult): boolean {
export async function runRecordedTest(request: TestRunRequest, deps: TestRunDeps = {}): Promise {
if (request.runtime?.mode === "bundled") return runBundledTest(request, deps);
+ if (request.projectLane) return runProjectLane(request, deps);
if (request.untilSource !== undefined) return runProjectPreview(request, deps);
const result = await runOnce(request, deps);
if (!refusedTheConfig(result) || !request.configPath || !deps.onProgress) return result;
@@ -469,6 +476,162 @@ async function runProjectPreview(request: TestRunRequest, deps: TestRunDeps): Pr
function quoted(value: string): string { return JSON.stringify(value); }
+/*
+ * TODO(e2e-device-flag): everything from here to `runProjectLane` is a workaround and gets replaced
+ * by an upstream `e2e run --device ` flag, which makes `mobile()` read an override that wins over
+ * the config's `device` and adds the device to the default session name. Then a lane is just
+ * `e2e run --target --device `: no config copy, no rewrite, no sweep. See
+ * `items-todo.md` at the repository root.
+ */
+
+/** The prefix of every file a project lane writes beside the project's config. Hidden, and swept when stale. */
+export const LANE_FILE_PREFIX = ".e2e.mobile-dev-lane-";
+
+/** The index just past the string, template literal or comment that starts at `index`, or `index` if none does. */
+function skipLiteral(source: string, index: number): number {
+ const char = source[index];
+ if (char === "/" && source[index + 1] === "/") { const end = source.indexOf("\n", index); return end < 0 ? source.length : end; }
+ if (char === "/" && source[index + 1] === "*") { const end = source.indexOf("*/", index + 2); return end < 0 ? source.length : end + 2; }
+ if (char !== '"' && char !== "'" && char !== "`") return index;
+ for (let cursor = index + 1; cursor < source.length; cursor++) {
+ if (source[cursor] === "\\") { cursor++; continue; }
+ if (source[cursor] === char) return cursor + 1;
+ }
+ return source.length;
+}
+
+/** The index of the bracket that closes the one at `open`, skipping strings and comments; -1 if unbalanced. */
+function closingBracket(source: string, open: number): number {
+ const pairs: Record = { "(": ")", "[": "]", "{": "}" };
+ const stack: string[] = [];
+ for (let index = open; index < source.length; index++) {
+ const skipped = skipLiteral(source, index);
+ if (skipped !== index) { index = skipped - 1; continue; }
+ const char = source[index]!;
+ if (pairs[char]) stack.push(pairs[char]!);
+ else if (char === ")" || char === "]" || char === "}") {
+ if (stack.pop() !== char) return -1;
+ if (stack.length === 0) return index;
+ }
+ }
+ return -1;
+}
+
+/**
+ * Rewrites the chosen target's `mobile(ARG)` into `mobile({ ...(ARG), device, session })`.
+ *
+ * Text, not evaluation: the user's own options (`settle`, `transition`, `snapshot`, variables, spreads)
+ * stay exactly as written and only the device and session change. Only the target named `targetName`
+ * is touched, and only when its engine is a direct `mobile(` call — an engine built elsewhere (a
+ * helper, a variable) cannot be pinned by rewriting text, so that is refused rather than guessed at.
+ */
+export function rewriteLaneConfig(source: string, targetName: string, device: string, session: string): string {
+ const refuse = (reason: string) => new ExpectedOperationError("invalid_input",
+ `Cannot run target "${targetName}" on a chosen device: ${reason} Run it on one device, or write the target's engine as a direct mobile({ ... }) call in e2e.config.ts.`);
+ const list = /targets\s*:\s*\[/.exec(source);
+ if (!list) throw refuse("the config has no literal `targets: [...]` list.");
+ const listOpen = list.index + list[0].length - 1;
+ const listClose = closingBracket(source, listOpen);
+ if (listClose < 0) throw refuse("the config's targets list could not be read.");
+ // The top-level `{ ... }` entries of the list.
+ for (let index = listOpen + 1; index < listClose; index++) {
+ const skipped = skipLiteral(source, index);
+ if (skipped !== index) { index = skipped - 1; continue; }
+ if (source[index] !== "{") continue;
+ const end = closingBracket(source, index);
+ if (end < 0 || end > listClose) break;
+ const entry = source.slice(index, end + 1);
+ const name = /\bname\s*:\s*["'`]([^"'`]+)["'`]/.exec(entry)?.[1];
+ if (name !== targetName) { index = end; continue; }
+ const engine = /\bengine\s*:\s*mobile\s*\(/.exec(entry);
+ if (!engine) throw refuse("its engine is not a direct mobile(...) call.");
+ const open = index + engine.index + engine[0].length - 1;
+ const close = closingBracket(source, open);
+ if (close < 0) throw refuse("its mobile(...) call could not be read.");
+ const original = source.slice(open + 1, close).trim();
+ const pinned = `device: ${quoted(device)}, session: ${quoted(session)}`;
+ return `${source.slice(0, open + 1)}{ ${original ? `...(${original}), ` : ""}${pinned} }${source.slice(close)}`;
+ }
+ throw refuse(`the config has no target with that name.`);
+}
+
+function processAlive(pid: number): boolean {
+ try { process.kill(pid, 0); return true; } catch (error) { return (error as NodeJS.ErrnoException).code === "EPERM"; }
+}
+
+/**
+ * Removes lane files an earlier process left behind. A lane file is named after the process that wrote
+ * it, so one whose process is gone is stale and one whose process lives (another plugin instance
+ * mid-run, or this one) is never touched: no lane can delete a file another lane still uses.
+ */
+export async function sweepLaneFiles(directory: string): Promise {
+ const names = await readdir(directory).catch(() => [] as string[]);
+ await Promise.all(names.filter(name => name.startsWith(LANE_FILE_PREFIX)).map(async name => {
+ const pid = Number(name.slice(LANE_FILE_PREFIX.length).split("-")[0]);
+ if (Number.isInteger(pid) && pid > 0 && processAlive(pid)) return;
+ await rm(join(directory, name), { recursive: true, force: true });
+ }));
+}
+
+/**
+ * One matrix lane of a project run: the user's config, copied with this lane's device pinned.
+ *
+ * The copy sits beside the original so its imports resolve (`@e2e-dev/mobile`, `e2e/oauth/...`,
+ * `./helpers`). Live progress comes from a second per-lane file that imports the lane copy, so the
+ * reporter wrapper and the lane's device are never shared with another lane. Each lane has its own
+ * `--output`, and the files and directory are removed when the run ends.
+ *
+ * A run of the editor's own text (`untilSource`, which is every run the panel starts) goes in an
+ * isolated symlink mirror of the project instead, as a single project preview does, so the user's
+ * folder is not written to at all and the mirror's removal takes everything away.
+ * TODO(e2e-device-flag): replaced by `e2e run --device`.
+ */
+async function runProjectLane(request: TestRunRequest, deps: TestRunDeps): Promise {
+ const lane = request.projectLane!;
+ if (!request.configPath) throw new ExpectedOperationError("invalid_input", "Open the project's e2e config before running on a chosen device.");
+ const bin = runnerBin(request.projectPath);
+ const id = `${process.pid}-${randomBytes(4).toString("hex")}`;
+ const rewritten = rewriteLaneConfig(await readFile(request.configPath, "utf8"), lane.target, lane.device, `mobile-dev-lane-${id}`);
+ await deps.release?.();
+ const configDir = dirname(request.configPath);
+ const laneName = `${LANE_FILE_PREFIX}${id}${extname(request.configPath) || ".mts"}`;
+ const laneRelative = join(relative(request.projectPath, configDir), laneName);
+ const progressName = `${LANE_FILE_PREFIX}${id}.progress.mts`;
+ const progressRelative = join(relative(request.projectPath, configDir), progressName);
+ const mirror = request.untilSource !== undefined ? await mkdtemp(join(tmpdir(), "mobile-dev-e2e-lane-run-")) : undefined;
+ const root = mirror ?? request.projectPath;
+ const laneFile = join(root, laneRelative), progressFile = join(root, progressRelative);
+ // The runner refuses an `--output` outside the project root it runs from, so the lane's output sits
+ // inside that root: in the mirror (removed with it), or as a hidden lane directory the sweep knows.
+ const output = join(root, mirror ? ".e2e-mobile-dev-lane-output" : `${LANE_FILE_PREFIX}${id}.output`);
+ if (!mirror) await sweepLaneFiles(configDir);
+ const run = (config: string, onProgress?: TestRunDeps["onProgress"]) => spawnRun({
+ command: bin, cwd: root, runPath: request.relativePath, configName: config, output,
+ target: lane.target, timeoutMs: request.timeoutMs, spawner: deps.spawner ?? spawn, onProgress, signal: deps.signal,
+ });
+ try {
+ if (mirror) {
+ await mirrorProject(request.projectPath, mirror, new Set([request.relativePath, laneRelative, progressRelative]));
+ await mkdir(dirname(join(mirror, request.relativePath)), { recursive: true, mode: 0o700 });
+ await writeFile(join(mirror, request.relativePath), request.untilSource!, { mode: 0o600 });
+ }
+ await mkdir(dirname(laneFile), { recursive: true });
+ await writeFile(laneFile, rewritten, { mode: 0o600 });
+ if (!deps.onProgress) return await run(laneFile);
+ await writeFile(progressFile, progressConfigSource(laneFile), { mode: 0o600 });
+ const result = await run(progressFile, deps.onProgress);
+ // Live progress is not worth the run: if the runner refused the wrapper, run the lane copy as it is.
+ if (!refusedTheConfig(result)) return result;
+ const retried = await run(laneFile);
+ return retried.steps.length > 0 || retried.status !== result.status ? retried : result;
+ } finally {
+ await Promise.all([
+ mirror ? rm(mirror, { recursive: true, force: true })
+ : Promise.all([rm(laneFile, { force: true }), rm(progressFile, { force: true }), rm(output, { recursive: true, force: true })]),
+ ]);
+ }
+}
+
function bundledModelSource(model: TestRunRequest["model"]): { imports: string[]; field: string } | undefined {
if (!model) return;
const id = quoted(model.model);
diff --git a/packages/core/src/testing-tools.ts b/packages/core/src/testing-tools.ts
index c829f532..67e18a8c 100644
--- a/packages/core/src/testing-tools.ts
+++ b/packages/core/src/testing-tools.ts
@@ -15,7 +15,7 @@ import { TestDraftStore } from "./testing-drafts.ts";
import { MAX_DRAFT_STEPS, recordedStepSchema, testDraftIdSchema } from "@mobile-dev/shared/test-drafts.ts";
import type { TestDraft } from "@mobile-dev/shared/test-drafts.ts";
import { TestingDevices } from "./testing-device.ts";
-import { runRecordedTest } from "./testing-run.ts";
+import { runRecordedTest, sweepLaneFiles } from "./testing-run.ts";
import type { TestRunRequest } from "./testing-run.ts";
import { MatrixRegistry, MAX_MATRIX_LIMIT, snapshotMatrix, startMatrix } from "./testing-matrix.ts";
import type { LaneExecutor, MatrixDevice, MatrixRun } from "./testing-matrix.ts";
@@ -79,6 +79,23 @@ function dataResult(data: Record, message?: string): CallToolRe
return { content: [{ type: "text", text: message ?? JSON.stringify(data) }], structuredContent: data };
}
+/**
+ * The config target each platform of a project matrix runs: the named one, else the platform's first.
+ * A platform with no target, or a named target of another platform, refuses before anything boots.
+ */
+export function projectLaneTargets(targets: readonly { name: string; platform?: string; bundleId?: string }[], devices: readonly MatrixDevice[], named?: { ios?: string; android?: string }): Partial> {
+ const chosen: Partial> = {};
+ for (const platform of new Set(devices.map(device => device.platform))) {
+ const target = named?.[platform]
+ ? targets.find(entry => entry.name === named[platform])
+ : targets.find(entry => entry.platform === platform && entry.bundleId);
+ if (!target || target.platform !== platform || !target.bundleId)
+ throw new ExpectedOperationError("invalid_input", `The project's e2e config has no ${platform} target${named?.[platform] ? ` named "${named[platform]}"` : ""} with a bundleId, so devices of that platform cannot run it.`);
+ chosen[platform] = { name: target.name, bundleId: target.bundleId };
+ }
+ return chosen;
+}
+
/** The Testing panel's project selection, and the device tree its recorder names selectors from. */
/** Returns the shutdown the plugin has to run: the recorder's device session, handed back. */
export function registerTestingTools(server: McpServer, projects: TestingProjectChoices, devices = new TestingDevices(), drafts = new TestDraftStore(), matrix: { ops?: DeviceOps; registry?: MatrixRegistry; run?: typeof runRecordedTest; panel?: PanelContext; pollMs?: number; failureReadMs?: number } = {}): () => Promise {
@@ -91,6 +108,8 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
* open for a feature whose whole output is a spinner moving down a dozen lines.
*/
const registry = matrix.registry ?? new MatrixRegistry();
+ // Lane copies of a project's config that a crashed run left beside it. Best effort, and only files whose process is gone.
+ void projects.list().then(list => Promise.all(list.map(entry => sweepLaneFiles(entry.path)))).catch(() => undefined);
const runTest = matrix.run ?? runRecordedTest;
/**
* The project a model-visible tool works on. With a panel, the Testing tab must have reported a
@@ -484,7 +503,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
registerAppTool(server, "mobile_testing_run_matrix", {
title: "Run a recorded test on several devices",
description:
- "Run one saved test on several devices at once, one independent lane per device (iOS and Android can be mixed), and return a matrixId immediately; read progress with mobile_testing_run_progress. At most `limit` lanes run at once (default 3, max 8); the rest are queued. Devices that are off are booted, and a device missing the app gets it installed by copying it from another device in the run that has it; otherwise that lane fails with \"App not installed\". `apps` defaults to the apps the test is pinned to; a platform with no app is refused, naming the fix. Bundled mode only. A failure on one device does not stop the others, and its lane carries `failure` (line, error, screen). projectPath defaults to the Testing tab's project.",
+ "Run one saved test on several devices at once, one independent lane per device (iOS and Android can be mixed), and return a matrixId immediately; read progress with mobile_testing_run_progress. At most `limit` lanes run at once (default 3, max 8); the rest are queued. Devices that are off are booted. In bundled mode a device missing the app gets it installed by copying it from another booted device that has it (one in the run first); otherwise that lane fails with \"App not installed\"; `apps` defaults to the apps the test is pinned to, and a platform with no app is refused, naming the fix. In a project with its own e2e config each lane runs the config's target for the device's platform (or `targets`) on that device, a device missing the app gets it copied the same way, and the target's engine must be a direct mobile(...) call. A failure on one device does not stop the others, and its lane carries `failure` (line, error, screen). projectPath defaults to the Testing tab's project.",
inputSchema: {
projectPath: projectPath.optional(),
relativePath: z.string().min(1).max(512).describe("The test to run, relative to the project."),
@@ -494,7 +513,9 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
name: z.string().min(1).max(128).optional().describe("A label for the lane."),
})).min(1).max(16),
apps: z.object({ ios: z.string().min(1).max(512).optional(), android: z.string().min(1).max(512).optional() }).optional()
- .describe("The app id per platform: the iOS bundle id and the Android package name. Defaults to the apps the test is pinned to."),
+ .describe("The app id per platform: the iOS bundle id and the Android package name. Defaults to the apps the test is pinned to. Ignored for a project with its own e2e config, which uses its targets' apps."),
+ targets: z.object({ ios: z.string().min(1).max(256).optional(), android: z.string().min(1).max(256).optional() }).optional()
+ .describe("Project mode only: the config's target name per platform. Defaults to the first target of each platform."),
limit: z.number().int().min(1).max(MAX_MATRIX_LIMIT).optional().describe("How many devices run at once. Default 3."),
timeoutMs: z.number().int().min(10_000).max(30 * 60_000).optional(),
model: modelSchema.optional(),
@@ -502,21 +523,32 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
},
annotations: destructive,
_meta: sharedVisibility,
- }, safe(async (raw: Omit & { projectPath?: string; devices: MatrixDevice[]; apps?: { ios?: string; android?: string }; limit?: number }) => {
+ }, safe(async (raw: Omit & { projectPath?: string; devices: MatrixDevice[]; apps?: { ios?: string; android?: string }; targets?: { ios?: string; android?: string }; limit?: number }) => {
const projectPathValue = await resolveProject(raw.projectPath);
const stored = await readTestTarget(projectPathValue, raw.relativePath).catch(() => undefined);
const apps: { ios?: string; android?: string } = { ...(stored ? { [stored.platform]: stored.bundleId, ...stored.apps } : {}), ...raw.apps };
const input = { ...raw, projectPath: projectPathValue, apps };
- for (const platform of ["ios", "android"] as const) {
- if (input.devices.some(device => device.platform === platform) && !apps[platform])
- throw new ExpectedOperationError("app_unavailable", `This test has no ${platform} app yet. Ask the user to open the app on a ${platform} device, call mobile_testing_wait_for_app with platform "${platform}", pin the bundleId it returns with mobile_testing_set_target mode "add", then run again.`);
- }
const unique = new Set(input.devices.map(device => device.deviceId));
if (unique.size !== input.devices.length) throw new ExpectedOperationError("invalid_input", "Each device can appear only once in a matrix.");
if (!matrix.ops) throw new ExpectedOperationError("unsupported_platform", "This server cannot prepare devices for a matrix run.");
const first = input.devices[0]!;
const { request, project } = await prepareRequest({ ...input, platform: first.platform, ...(input.apps[first.platform] ? { bundleId: input.apps[first.platform]! } : {}) });
- if (project.runtimeMode !== "bundled") throw new ExpectedOperationError("invalid_input", "Running on several devices is available for Mobile Dev's bundled runner. This project uses its own e2e config, so run it on one device.");
+ if (project.runtimeMode === "project") {
+ const lanes = projectLaneTargets(project.targets, input.devices, input.targets);
+ await devices.releaseOn(input.devices.map(device => device.deviceId)).catch(() => undefined);
+ const projectExecutor = createLaneExecutor({
+ ops: matrix.ops, projectMode: true, apps: Object.fromEntries(Object.entries(lanes).map(([platform, target]) => [platform, target.bundleId])),
+ runTest: (lane, deviceId, signal, onProgress) => runTest(
+ { ...request, configPath: project.configPath, target: lanes[lane.platform]!.name, projectLane: { target: lanes[lane.platform]!.name, device: deviceId } },
+ { release: () => devices.releaseOn([lane.deviceId, deviceId]), onProgress, signal }),
+ });
+ const { run } = launchMatrix(input.relativePath, input.devices, input.limit, projectExecutor);
+ return dataResult({ matrixId: run.matrixId, limit: run.limit, lanes: snapshotMatrix(run).lanes }, `Started ${run.lanes.length} lanes, up to ${run.limit} at once.`);
+ }
+ for (const platform of ["ios", "android"] as const) {
+ if (input.devices.some(device => device.platform === platform) && !apps[platform])
+ throw new ExpectedOperationError("app_unavailable", `This test has no ${platform} app yet. Ask the user to open the app on a ${platform} device, call mobile_testing_wait_for_app with platform "${platform}", pin the bundleId it returns with mobile_testing_set_target mode "add", then run again.`);
+ }
// Only the devices of this matrix lose the recorder; a recorder on another device keeps its session.
await devices.releaseOn(input.devices.map(device => device.deviceId)).catch(() => undefined);
const executor = createLaneExecutor({
diff --git a/packages/core/test/testing-matrix-project.test.ts b/packages/core/test/testing-matrix-project.test.ts
new file mode 100644
index 00000000..cd65e443
--- /dev/null
+++ b/packages/core/test/testing-matrix-project.test.ts
@@ -0,0 +1,130 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { mkdtemp, mkdir, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { Client } from "@modelcontextprotocol/sdk/client/index.js";
+import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
+import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
+import { projectLaneTargets, registerTestingTools } from "../src/testing-tools.ts";
+import { TestingProjectChoices } from "../src/testing-projects.ts";
+import { TestingDevices } from "../src/testing-device.ts";
+import { createLaneExecutor } from "../src/testing-prepare.ts";
+import { MatrixRegistry, startMatrix } from "../src/testing-matrix.ts";
+import type { DeviceOps } from "../src/testing-prepare.ts";
+import type { TestRunRequest } from "../src/testing-run.ts";
+
+const CONFIG = `import { mobile } from "@e2e-dev/mobile";
+export default { targets: [
+ { name: "ios", engine: mobile({ platform: "ios" }), app: { bundleId: "com.example.ios" } },
+ { name: "android", engine: mobile({ platform: "android" }), app: { bundleId: "com.example.android" } },
+] };
+`;
+
+async function projectWithRuntime(): Promise {
+ const root = await mkdtemp(join(tmpdir(), "matrix-project-"));
+ await writeFile(join(root, "e2e.config.ts"), CONFIG);
+ await mkdir(join(root, "node_modules/.bin"), { recursive: true });
+ await mkdir(join(root, "node_modules/e2e"), { recursive: true });
+ await mkdir(join(root, "node_modules/@e2e-dev/mobile/dist"), { recursive: true });
+ await writeFile(join(root, "node_modules/.bin/e2e"), "");
+ await writeFile(join(root, "node_modules/e2e/package.json"), JSON.stringify({ version: "0.17.0" }));
+ await writeFile(join(root, "node_modules/@e2e-dev/mobile/package.json"), JSON.stringify({ version: "0.9.2" }));
+ await writeFile(join(root, "node_modules/@e2e-dev/mobile/dist/nodes.js"), "export {};\n");
+ return root;
+}
+
+function machine(apps: Record) {
+ const log: string[] = [];
+ const ops: DeviceOps = {
+ async isBooted(_p, id) { return id !== "OFF"; },
+ async boot(_p, id) { log.push(`boot ${id}`); return id; },
+ async hasApp(_p, id, app) { return apps[id]?.includes(app) ?? false; },
+ async copyApp() { log.push("copy"); },
+ async launch(_p, id) { log.push(`launch ${id}`); },
+ };
+ return { ops, log };
+}
+
+async function connect(root: string, ops: DeviceOps, run: (request: TestRunRequest) => void) {
+ const server = new McpServer({ name: "t", version: "1" });
+ const registry = new MatrixRegistry();
+ registerTestingTools(server, new TestingProjectChoices(join(root, "state")), new TestingDevices(), undefined, {
+ ops, registry, run: async request => { run(request); return { status: "passed", exitCode: 0, steps: [] }; },
+ });
+ const client = new Client({ name: "c", version: "1" });
+ const [a, b] = InMemoryTransport.createLinkedPair();
+ await Promise.all([server.connect(a), client.connect(b)]);
+ return { client, registry };
+}
+
+async function settled(registry: MatrixRegistry) {
+ for (let i = 0; i < 200 && registry.busy; i++) await new Promise(resolve => setTimeout(resolve, 10));
+}
+
+test("a project with its own e2e config now runs a matrix: each lane gets the config's target for its platform and its own device", async () => {
+ const root = await projectWithRuntime();
+ const { ops, log } = machine({ A: ["com.example.ios"], B: ["com.example.ios"], E: ["com.example.android"] });
+ const requests: TestRunRequest[] = [];
+ const { client, registry } = await connect(root, ops, request => requests.push(request));
+ const result = await client.callTool({ name: "mobile_testing_run_matrix", arguments: {
+ projectPath: root, relativePath: "tests/flow.e2e.ts", untilSource: 'test("x", async () => {});\n', apps: {},
+ devices: [{ deviceId: "A", platform: "ios" }, { deviceId: "B", platform: "ios" }, { deviceId: "E", platform: "android" }],
+ } });
+ assert.notEqual(result.isError, true, JSON.stringify(result.content));
+ await settled(registry);
+ assert.deepEqual(requests.map(request => request.projectLane).sort((l, r) => l!.device.localeCompare(r!.device)), [
+ { target: "ios", device: "A" }, { target: "ios", device: "B" }, { target: "android", device: "E" }].sort((l, r) => l.device.localeCompare(r.device)));
+ assert.ok(requests.every(request => request.configPath === join(root, "e2e.config.ts")));
+ assert.ok(log.every(line => line.startsWith("boot") === false) && !log.some(line => line.startsWith("launch") || line === "copy"), "the plugin does not launch a project's app, and nothing needed copying");
+ assert.deepEqual(registry.latest()!.lanes.map(lane => lane.state), ["passed", "passed", "passed"]);
+});
+
+test("a project lane on a device without the app gets it copied from another device in the run", async () => {
+ const root = await projectWithRuntime();
+ const { ops, log } = machine({ A: ["com.example.ios"], B: [] });
+ const requests: TestRunRequest[] = [];
+ const { client, registry } = await connect(root, ops, request => requests.push(request));
+ await client.callTool({ name: "mobile_testing_run_matrix", arguments: {
+ projectPath: root, relativePath: "tests/flow.e2e.ts", untilSource: 'test("x", async () => {});\n', apps: {},
+ devices: [{ deviceId: "A", platform: "ios" }, { deviceId: "B", platform: "ios" }],
+ } });
+ await settled(registry);
+ assert.deepEqual(registry.latest()!.lanes.map(lane => lane.state), ["passed", "passed"]);
+ assert.ok(log.includes("copy"), "the missing app is copied from A");
+ assert.deepEqual(requests.map(request => request.projectLane!.device).sort(), ["A", "B"]);
+});
+
+test("a platform the config has no target for is refused before anything boots", async () => {
+ const root = await projectWithRuntime();
+ await writeFile(join(root, "e2e.config.ts"), CONFIG.replace(/\n \{ name: "android"[^\n]*/, ""));
+ const { ops, log } = machine({});
+ const { client, registry } = await connect(root, ops, () => undefined);
+ const result = await client.callTool({ name: "mobile_testing_run_matrix", arguments: {
+ projectPath: root, relativePath: "tests/flow.e2e.ts", untilSource: 'test("x", async () => {});\n', apps: {},
+ devices: [{ deviceId: "OFF", platform: "android" }],
+ } });
+ assert.equal(result.isError, true);
+ assert.match(JSON.stringify(result.content), /no android target/);
+ assert.equal(registry.latest(), undefined);
+ assert.deepEqual(log, []);
+});
+
+test("project lane targets default to each platform's first target and honour a named one", () => {
+ const targets = [
+ { name: "ios-a", platform: "ios", bundleId: "a" }, { name: "ios-b", platform: "ios", bundleId: "b" }, { name: "web" }, { name: "android", platform: "android", bundleId: "c" },
+ ];
+ const devices = [{ deviceId: "1", platform: "ios" as const }, { deviceId: "2", platform: "android" as const }];
+ assert.deepEqual(projectLaneTargets(targets, devices), { ios: { name: "ios-a", bundleId: "a" }, android: { name: "android", bundleId: "c" } });
+ assert.equal(projectLaneTargets(targets, devices, { ios: "ios-b" }).ios!.bundleId, "b");
+ assert.throws(() => projectLaneTargets(targets, devices, { ios: "android" }), /no ios target named "android"/);
+ assert.throws(() => projectLaneTargets(targets, devices, { ios: "missing" }), /no ios target named "missing"/);
+});
+
+test("project mode skips the launch the bundled lane does", async () => {
+ const { ops, log } = machine({ A: ["com.app"] });
+ const executor = createLaneExecutor({ ops, apps: { ios: "com.app" }, projectMode: true, runTest: async () => ({ status: "passed", exitCode: 0, steps: [] }) });
+ const { done } = startMatrix(new MatrixRegistry(), { testPath: "t", devices: [{ deviceId: "A", platform: "ios" }] }, executor);
+ await done;
+ assert.deepEqual(log, []);
+});
diff --git a/packages/core/test/testing-panel-ui.test.ts b/packages/core/test/testing-panel-ui.test.ts
index 7bb5dd49..8f5d0fdd 100644
--- a/packages/core/test/testing-panel-ui.test.ts
+++ b/packages/core/test/testing-panel-ui.test.ts
@@ -160,7 +160,7 @@ test("a run marks the preview line by line, and marks nothing it was not told ab
getSnapshot: () => panelState,
canLaunch: true, canRun: true, canRunStored: true, dirty: true,
noProject: false, storedTarget: undefined, foregroundTarget: undefined, storedRunHint: "", repinStoredTest: async () => {},
- matrixEnabled: true, matrixRunCount: 0, matrixApps: () => ({}), matrixBusy: () => false, loadMatrixDevices: async () => {},
+ matrixEnabled: true, matrixRunCount: 0, runsOnMatrix: false, matrixApps: () => ({}), matrixBusy: () => false, loadMatrixDevices: async () => {},
setMatrixSelection: () => {}, setMatrixLimit: () => {}, selectLane: () => {}, cancelMatrix: async () => {}, dismissMatrix: () => {},
refreshProjects: async () => {}, chooseProject: async () => {}, pickProject: async () => {},
launchApp: async () => {}, saveTest: async () => {}, runTest: async (options?: unknown) => { runs.push(options); }, selectTarget: () => {},
@@ -586,7 +586,7 @@ function panelStub(overrides: Record = {}) {
canLaunch: true, canRun: true, canRunStored: true, dirty: true,
get noProject() { return state.projectPath === state.studioPath; }, useNoProject: async () => {},
storedTarget: undefined, foregroundTarget: undefined, storedRunHint: "", repinStoredTest: async () => {},
- matrixEnabled: true, matrixRunCount: 0, matrixApps: () => ({}), matrixBusy: () => false, loadMatrixDevices: async () => {},
+ matrixEnabled: true, matrixRunCount: 0, runsOnMatrix: false, matrixApps: () => ({}), matrixBusy: () => false, loadMatrixDevices: async () => {},
setMatrixSelection: () => {}, setMatrixLimit: () => {}, selectLane: () => {}, cancelMatrix: async () => {}, dismissMatrix: () => {},
refreshProjects: async () => {}, chooseProject: async () => {}, pickProject: async () => {},
launchApp: async () => {}, saveTest: async () => {}, runTest: async () => {}, selectTarget: () => {},
@@ -1115,7 +1115,7 @@ test("the matrix shows its devices, one lane per device with a cancel, and Run o
],
matrix: { matrixId: "m", limit: 3, startedAt: 1, lanes: [lane(0, "running", { startedAt: Date.now() }), lane(1, "queued"), lane(2, "passed", { result: { status: "passed", steps: [], durationMs: 1500 } })] },
selectedLane: "r0",
- }), matrixRunCount: 2, matrixApps: () => ({ ios: "com.example.app" }),
+ }), matrixRunCount: 2, runsOnMatrix: true, matrixApps: () => ({ ios: "com.example.app" }),
cancelMatrix: async (id?: string) => { cancelled.push(id); }, setMatrixSelection: (ids: string[]) => { selected.push(ids); } };
await act(async () => { root.render(createElement(TestingView, { panel, deviceApps: { subscribe: () => () => undefined, getSnapshot: () => DEVICE_SNAPSHOT } })); });
const doc = dom.window.document;
@@ -1140,7 +1140,7 @@ test("the matrix shows its devices, one lane per device with a cancel, and Run o
onTeardown(async () => { await act(async () => { root.unmount(); }); });
});
-test("a project that runs from its own config shows the matrix as unavailable", async t => {
+test("a panel without the matrix shows it as unavailable", async t => {
const { module: { TestingView }, dom, onTeardown } = await renderEnvironment(t, {
exports: 'export { TestingView } from "./packages/ui/src/components/testing-view.tsx";', slug: "testing-matrix-project",
});
@@ -1152,7 +1152,7 @@ test("a project that runs from its own config shows the matrix as unavailable",
const doc = dom.window.document;
const toggle = [...doc.querySelectorAll('[data-slot="collapsible-trigger"]')].find(el => el.textContent?.includes("Devices")) as HTMLElement;
await act(async () => { toggle.click(); });
- assert.match(doc.querySelector("[data-matrix-disabled]")?.textContent ?? "", /bundled runner/);
+ assert.match(doc.querySelector("[data-matrix-disabled]")?.textContent ?? "", /not available/);
assert.equal(doc.querySelector("[data-testing-matrix]"), null);
await act(async () => { root.render(createElement("div")); });
await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
diff --git a/packages/core/test/testing-prepare.test.ts b/packages/core/test/testing-prepare.test.ts
index 4ab46e1c..6fb5d480 100644
--- a/packages/core/test/testing-prepare.test.ts
+++ b/packages/core/test/testing-prepare.test.ts
@@ -47,6 +47,15 @@ test("a device without the app gets it copied from another device that has it",
assert.ok(ops_log.indexOf("copy A->B") < ops_log.indexOf("launch B"), "installed before launch");
});
+test("a lone device without the app gets it copied from a booted device outside the run", async () => {
+ const { ops, log } = machine({ PRO: { booted: true, apps: ["com.app"] }, AIR: { booted: true, apps: [] }, OFF: { booted: false, apps: ["com.app"] } });
+ ops.bootedDevices = async () => [{ deviceId: "AIR", name: "iPhone Air" }, { deviceId: "OFF", name: "Off" }, { deviceId: "PRO", name: "iPhone 17 Pro" }];
+ const { matrix } = await run(ios("AIR"), ops);
+ assert.equal(matrix.lanes[0]!.state, "passed");
+ assert.ok(log.includes("copy PRO->AIR"), "the device the app was built on is the source though it was not ticked");
+ assert.equal(log.some(line => line.startsWith("boot")), false, "an unticked device is never booted to be a source");
+});
+
test("a device that is off and lacks the app is booted, then installed", async () => {
const { ops, log } = machine({ A: { booted: true, apps: ["com.app"] }, B: { booted: false, apps: [] } });
await run(ios("A", "B"), ops);
diff --git a/packages/core/test/testing-run.test.ts b/packages/core/test/testing-run.test.ts
index ce8237f7..24e928ef 100644
--- a/packages/core/test/testing-run.test.ts
+++ b/packages/core/test/testing-run.test.ts
@@ -2,12 +2,12 @@ import test from "node:test";
import assert from "node:assert/strict";
import { EventEmitter } from "node:events";
import { Readable } from "node:stream";
-import { mkdtemp, mkdir, writeFile } from "node:fs/promises";
+import { mkdtemp, mkdir, writeFile, readdir } from "node:fs/promises";
import { tmpdir } from "node:os";
import { dirname, isAbsolute, join } from "node:path";
import { existsSync, realpathSync } from "node:fs";
import { readFileSync } from "node:fs";
-import { RUNNER_CWD, bundledConfigSource, bundledTargetName, parseProgressLine, parseReport, progressConfigSource, reportDuration, reportError, reportSteps, reportStatus, runRecordedTest, runnerBin, runnerEnv, untilTestPath } from "../src/testing-run.ts";
+import { RUNNER_CWD, bundledConfigSource, bundledTargetName, parseProgressLine, parseReport, progressConfigSource, reportDuration, reportError, rewriteLaneConfig, sweepLaneFiles, LANE_FILE_PREFIX, reportSteps, reportStatus, runRecordedTest, runnerBin, runnerEnv, untilTestPath } from "../src/testing-run.ts";
import { bundledE2eRoot } from "../src/e2e-runtime.ts";
const FILE = "tests/a-recorded-flow.e2e.ts";
@@ -426,3 +426,157 @@ test("aborting a run kills its process and reports it as cancelled", async () =>
await assert.rejects(run, /cancelled/);
assert.equal(killed, true);
});
+
+// ---- Project-mode matrix lanes: the config text, copied with one target's device pinned -------------------
+
+const LANE_CONFIG = `import { mobile } from "@e2e-dev/mobile";
+import { chatgpt } from "e2e/oauth/chatgpt";
+const shared = { settle: 300 };
+
+export default {
+ agents: { default: { model: chatgpt("gpt-6-luna") } },
+ targets: [
+ {
+ name: "ios",
+ engine: mobile({ platform: "ios", settle: 300 }),
+ app: { bundleId: "com.example.app" },
+ },
+ {
+ name: "android",
+ engine: mobile({ platform: "android", transition: { mode: "fast" } }),
+ app: { bundleId: "com.example.app" },
+ },
+ ],
+};
+`;
+
+test("a lane pins the device and session on its own target only, keeping the other options", () => {
+ const out = rewriteLaneConfig(LANE_CONFIG, "ios", "UDID-1", "lane-1");
+ assert.match(out, /engine: mobile\(\{ \.\.\.\(\{ platform: "ios", settle: 300 \}\), device: "UDID-1", session: "lane-1" \}\)/);
+ assert.match(out, /engine: mobile\(\{ platform: "android", transition: \{ mode: "fast" \} \}\)/, "the other target is untouched");
+ assert.equal(out, LANE_CONFIG.replace('mobile({ platform: "ios", settle: 300 })', 'mobile({ ...({ platform: "ios", settle: 300 }), device: "UDID-1", session: "lane-1" })'), "nothing else changes");
+});
+
+test("the second target is the one rewritten when it is the one named", () => {
+ const out = rewriteLaneConfig(LANE_CONFIG, "android", "emulator-5554", "s");
+ assert.match(out, /mobile\(\{ \.\.\.\(\{ platform: "android", transition: \{ mode: "fast" \} \}\), device: "emulator-5554", session: "s" \}\)/);
+ assert.match(out, /mobile\(\{ platform: "ios", settle: 300 \}\)/);
+});
+
+test("a variable argument and a spread are kept by spreading them", () => {
+ const variable = rewriteLaneConfig('const opts = { platform: "ios" };\nexport default { targets: [\n{ name: "ios", engine: mobile(opts), app: {} },\n] };', "ios", "D", "s");
+ assert.match(variable, /mobile\(\{ \.\.\.\(opts\), device: "D", session: "s" \}\)/);
+ const spread = rewriteLaneConfig('export default { targets: [\n{ name: "a", engine: mobile({ ...base, platform: "android" }) },\n] };', "a", "D", "s");
+ assert.match(spread, /mobile\(\{ \.\.\.\(\{ \.\.\.base, platform: "android" \}\), device: "D", session: "s" \}\)/);
+ const none = rewriteLaneConfig('export default { targets: [{ name: "a", engine: mobile() }] };', "a", "D", "s");
+ assert.match(none, /mobile\(\{ device: "D", session: "s" \}\)/);
+});
+
+test("parentheses inside strings and comments do not end the call early", () => {
+ const out = rewriteLaneConfig('export default { targets: [{ name: "a", engine: mobile({ platform: "ios", label: ")(" /* ) */ }) }] };', "a", "D", "s");
+ assert.match(out, /session: "s" \}\) \}\] \};$/);
+});
+
+test("a target whose engine is not a direct mobile call, or that does not exist, is refused with a reason", () => {
+ assert.throws(() => rewriteLaneConfig('export default { targets: [{ name: "web", engine: playwright({}) }] };', "web", "D", "s"), /not a direct mobile\(\.\.\.\) call/);
+ assert.throws(() => rewriteLaneConfig('export default { targets: [{ name: "ios", engine: makeEngine("ios") }] };', "ios", "D", "s"), /not a direct mobile/);
+ assert.throws(() => rewriteLaneConfig('const targets = []; export default { targets };', "ios", "D", "s"), /no literal `targets/);
+ assert.throws(() => rewriteLaneConfig(LANE_CONFIG, "tvos", "D", "s"), /no target with that name/);
+});
+
+async function laneProject() {
+ const root = await project();
+ await writeFile(join(root, "e2e.config.ts"), LANE_CONFIG);
+ await mkdir(join(root, "tests"), { recursive: true });
+ return root;
+}
+
+/** A spawn that records the lane config as it is while the run is alive, then answers. */
+function laneSpawner(seen: { args?: readonly string[]; cwd?: string; config?: string; existed?: string[] }) {
+ return ((command: string, args: readonly string[], options: { cwd?: string }) => {
+ seen.args = args; seen.cwd = options.cwd;
+ const config = args[args.indexOf("--config") + 1]!;
+ seen.config = readFileSync(config.endsWith(".progress.mts") ? readFileSync(config, "utf8").match(/file:\/\/[^"]+/)![0].replace("file://", "") : config, "utf8");
+ return spawner(JSON.stringify(report([{ line: 8, status: "passed" }])))(command, args, options as never);
+ }) as never;
+}
+
+test("a project lane runs a hidden rewritten copy beside the config, with its own output, and leaves nothing behind", async () => {
+ const root = await laneProject();
+ const seen: { args?: readonly string[]; cwd?: string; config?: string } = {};
+ const result = await runRecordedTest({ projectPath: root, relativePath: FILE, configPath: join(root, "e2e.config.ts"), target: "ios",
+ projectLane: { target: "ios", device: "UDID-1" }, runtime: { mode: "project", root } }, { spawner: laneSpawner(seen), onProgress: () => undefined });
+ assert.equal(result.status, "passed");
+ const args = seen.args ?? [];
+ assert.equal(seen.cwd, root);
+ assert.equal(args[args.indexOf("--target") + 1], "ios");
+ const config = args[args.indexOf("--config") + 1]!;
+ assert.ok(config.includes(`/${LANE_FILE_PREFIX}`) && config.startsWith(root), "the lane's config sits beside the project's own");
+ assert.match(seen.config!, /device: "UDID-1", session: "mobile-dev-lane-/);
+ assert.notEqual(args[args.indexOf("--output") + 1], undefined);
+ assert.ok(args[args.indexOf("--output") + 1]!.startsWith(`${root}/`), "the runner refuses an --output outside the root it runs from");
+ assert.equal(existsSync(args[args.indexOf("--output") + 1]!), false, "the output directory is removed");
+ assert.deepEqual((await readdir(root)).filter(name => name.startsWith(LANE_FILE_PREFIX)), [], "the lane files are removed");
+ assert.equal(readFileSync(join(root, "e2e.config.ts"), "utf8"), LANE_CONFIG, "the project's own config is never touched");
+});
+
+test("two lanes at once use different files and different sessions, and one finishing removes only its own", async () => {
+ const root = await laneProject();
+ const a: { args?: readonly string[]; config?: string } = {}, b: { args?: readonly string[]; config?: string } = {};
+ const request = (device: string) => ({ projectPath: root, relativePath: FILE, configPath: join(root, "e2e.config.ts"), target: "ios", projectLane: { target: "ios", device } });
+ await Promise.all([
+ runRecordedTest(request("A"), { spawner: laneSpawner(a) }),
+ runRecordedTest(request("B"), { spawner: laneSpawner(b) }),
+ ]);
+ assert.notEqual(a.args![a.args!.indexOf("--config") + 1], b.args![b.args!.indexOf("--config") + 1]);
+ assert.notEqual(a.args![a.args!.indexOf("--output") + 1], b.args![b.args!.indexOf("--output") + 1]);
+ assert.notEqual(a.config!.match(/session: "([^"]+)"/)![1], b.config!.match(/session: "([^"]+)"/)![1]);
+ assert.match(a.config!, /device: "A"/);
+ assert.match(b.config!, /device: "B"/);
+});
+
+test("a lane of the editor's own text runs in an isolated mirror and writes nothing into the project", async () => {
+ const root = await laneProject();
+ const seen: { args?: readonly string[]; cwd?: string; config?: string } = {};
+ const before = await readdir(root);
+ await runRecordedTest({ projectPath: root, relativePath: FILE, configPath: join(root, "e2e.config.ts"), untilSource: 'test("x", async () => {});\n',
+ projectLane: { target: "android", device: "emulator-5554" } }, { spawner: laneSpawner(seen), onProgress: () => undefined });
+ assert.notEqual(seen.cwd, root);
+ assert.ok(seen.args![seen.args!.indexOf("--output") + 1]!.startsWith(`${seen.cwd}/`), "the output sits inside the mirror the runner runs from");
+ assert.ok(seen.cwd!.includes("mobile-dev-e2e-lane-run-"));
+ assert.equal(existsSync(seen.cwd!), false, "the mirror is removed");
+ assert.deepEqual(await readdir(root), before, "the project folder is exactly as it was");
+});
+
+test("a lane whose target is not a direct mobile call fails before the runner starts", async () => {
+ const root = await project();
+ await writeFile(join(root, "e2e.config.ts"), 'export default { targets: [{ name: "ios", engine: makeEngine() }] };');
+ let spawned = false;
+ await assert.rejects(runRecordedTest({ projectPath: root, relativePath: FILE, configPath: join(root, "e2e.config.ts"), projectLane: { target: "ios", device: "D" } },
+ { spawner: (() => { spawned = true; throw new Error("no"); }) as never }), /not a direct mobile/);
+ assert.equal(spawned, false);
+});
+
+test("the lane files are removed when the run is cancelled", async () => {
+ const root = await laneProject();
+ const controller = new AbortController();
+ const hanging = (() => {
+ const child = new EventEmitter() as EventEmitter & { stdout: Readable; stderr: Readable; kill: () => void };
+ child.stdout = Readable.from([""]); child.stderr = Readable.from([""]); child.kill = () => undefined;
+ queueMicrotask(() => setTimeout(() => controller.abort(), 20));
+ return child;
+ }) as never;
+ await assert.rejects(runRecordedTest({ projectPath: root, relativePath: FILE, configPath: join(root, "e2e.config.ts"), projectLane: { target: "ios", device: "D" } },
+ { spawner: hanging, signal: controller.signal, onProgress: () => undefined }), /cancelled/);
+ assert.deepEqual((await readdir(root)).filter(name => name.startsWith(LANE_FILE_PREFIX)), []);
+});
+
+test("the sweep removes lane files of a dead process and keeps those of a live one", async () => {
+ const root = await project();
+ await writeFile(join(root, `${LANE_FILE_PREFIX}999999999-dead.ts`), "");
+ await writeFile(join(root, `${LANE_FILE_PREFIX}999999999-dead.progress.mts`), "");
+ await writeFile(join(root, `${LANE_FILE_PREFIX}${process.pid}-live.ts`), "");
+ await writeFile(join(root, "e2e.config.ts"), "");
+ await sweepLaneFiles(root);
+ assert.deepEqual((await readdir(root)).filter(name => name !== "node_modules").sort(), [`${LANE_FILE_PREFIX}${process.pid}-live.ts`, "e2e.config.ts"].sort());
+});
diff --git a/packages/skills/mobile-dev-testing/SKILL.md b/packages/skills/mobile-dev-testing/SKILL.md
index 43218331..014a29ef 100644
--- a/packages/skills/mobile-dev-testing/SKILL.md
+++ b/packages/skills/mobile-dev-testing/SKILL.md
@@ -131,6 +131,12 @@ asserting text you have not seen.
them. (Studio mode's `finish` saves for you; that is the one exception.)
- **Never run the test** while recording. There is no file to run, and a run resets the app and
takes the device session the recording is being read through.
+ When the user asks for a saved test to run on several devices, that is `mobile_testing_run_matrix`,
+ and it works in both modes: a Studio test runs on each device with the bundled runner, and a project
+ with its own `e2e.config.ts` runs the config's target for each device's platform (a device missing
+ the app gets it copied from another booted device that has it, and the target's engine must be a direct
+ `mobile(...)` call). It is a run, so
+ never during a recording.
- **Never drive the device another way while recording** — not `device_*`, not `mobile_open_url`,
not the mirror. The recorder's steps and another driver's taps interleave into a flow that does
not describe anything. Everything the flow does goes through `mobile_testing_agent_step`, which
diff --git a/packages/ui/src/components/testing-matrix.tsx b/packages/ui/src/components/testing-matrix.tsx
index 207cf362..77ec0721 100644
--- a/packages/ui/src/components/testing-matrix.tsx
+++ b/packages/ui/src/components/testing-matrix.tsx
@@ -24,7 +24,7 @@ function DeviceRow({ device, checked, busy, appMissing, onToggle }: { device: Ma
{busy && Busy}
{device.booted ? "Booted" : "Off"}
- {device.booted && device.installed !== undefined && {device.installed ? "Installed" : "App missing"}}
;
@@ -32,7 +32,7 @@ function DeviceRow({ device, checked, busy, appMissing, onToggle }: { device: Ma
/**
* The matrix checklist in the setup popover: tick devices to run the open test on all of them.
- * It is disabled when the project uses its own e2e config, which pins its own device.
+ * A project with its own e2e config gets it too: each lane runs the config's target for the device's platform.
*/
export function MatrixDevices({ panel }: { panel: TestingPanel }) {
const state = useSyncExternalStore(panel.subscribe, panel.getSnapshot);
@@ -41,7 +41,7 @@ export function MatrixDevices({ panel }: { panel: TestingPanel }) {
const apps = panel.matrixApps();
const selected = new Set(state.matrixSelected);
const toggle = (id: string, value: boolean) => panel.setMatrixSelection(value ? [...state.matrixSelected, id] : state.matrixSelected.filter(entry => entry !== id));
- if (!enabled) return Running on several devices needs the bundled runner. This project uses its own e2e config, so tests run on one device.;
+ if (!enabled) return Running on several devices is not available yet.;
const only = panel.matrixPlatform;
const groups = ([["iOS", "ios"], ["Android", "android"]] as const)
.filter(([, platform]) => !only || platform === only)
@@ -63,7 +63,7 @@ export function MatrixDevices({ panel }: { panel: TestingPanel }) {
at once
- {count > state.matrixLimit ? `${count - state.matrixLimit} will queue until a slot frees. ` : ""}Devices that are off are booted, and a missing app is copied from another selected device. Agent steps call the model once per device.
+ {count > state.matrixLimit ? `${count - state.matrixLimit} will queue until a slot frees. ` : ""}{state.runtimeMode === "project" ? "Devices that are off are booted, and a missing app is copied from another booted device that has it. Each device runs the config's target for its platform." : "Devices that are off are booted, and a missing app is copied from another booted device that has it."} Agent steps call the model once per device.
;
}
diff --git a/packages/ui/src/components/testing-view.tsx b/packages/ui/src/components/testing-view.tsx
index 47ad852c..d805c7e7 100644
--- a/packages/ui/src/components/testing-view.tsx
+++ b/packages/ui/src/components/testing-view.tsx
@@ -269,7 +269,7 @@ export function TestingView({ panel, deviceApps }: { panel: TestingPanel; device
const devices = useSyncExternalStore(deviceApps.subscribe, deviceApps.getSnapshot);
const device = devices.device;
// The Run button's "N devices" needs the device list before the setup popover is ever opened.
- useEffect(() => { if (state.available && state.projectPath && state.runtimeMode === "bundled") void panel.loadMatrixDevices(); }, [panel, state.available, state.projectPath, state.runtimeMode]);
+ useEffect(() => { if (state.available && state.projectPath) void panel.loadMatrixDevices(); }, [panel, state.available, state.projectPath, state.runtimeMode]);
const booted = device?.state === "Booted" || device?.state === "connected";
const target = state.targets.find(entry => entry.name === state.targetName) ?? state.targets[0];
const mismatch = panel.targetMismatch;
@@ -406,9 +406,9 @@ function TestingControls({ panel, recordable, deviceId, platform }: { panel: Tes
: testRecorder.start(deviceId, platform)}>Record}
1 ? `Run the current preview on ${panel.matrixRunCount} devices, up to ${panelState.matrixLimit} at once, without saving it.` : "Run the current preview without saving it. Recording stops because the runner needs the device to itself."}
+ title={panelState.selectedTestPath && panel.storedRunHint ? panel.storedRunHint : panel.runsOnMatrix ? `Run the current preview on ${panel.matrixRunCount === 1 ? panel.matrixSelection[0]!.name : `${panel.matrixRunCount} devices, up to ${panelState.matrixLimit} at once,`} without saving it.` : "Run the current preview without saving it. Recording stops because the runner needs the device to itself."}
onClick={() => void (panelState.selectedTestPath ? panel.runStoredTest() : panel.runTest())}>
- {panelState.running ? : }{panel.matrixRunCount > 1 ? `Run on ${panel.matrixRunCount} devices` : "Run test"}
+ {panelState.running ? : }{panel.runsOnMatrix ? (panel.matrixRunCount === 1 ? `Run on ${panel.matrixSelection[0]!.name}` : `Run on ${panel.matrixRunCount} devices`) : "Run test"}
{state.resolving && Reading the screen…}
;
diff --git a/packages/ui/src/testing-panel.ts b/packages/ui/src/testing-panel.ts
index a3ce0cb2..f778cc31 100644
--- a/packages/ui/src/testing-panel.ts
+++ b/packages/ui/src/testing-panel.ts
@@ -188,6 +188,16 @@ function text(value: unknown): string { return typeof value === "string" ? value
/** How a platform reads in the panel. */
export function platformLabel(platform: "ios" | "android"): string { return platform === "ios" ? "iOS" : "Android"; }
+/**
+ * Launch app opens an app that is already installed; it never builds one, since a build is the
+ * project's own (Expo, EAS, Gradle, Xcode) and takes minutes. A missing app says so, with the way to fix it.
+ */
+export function launchErrorMessage(message: string, bundleId: string, platform: "ios" | "android"): string {
+ if (!/is not installed|Unable to find package|Unknown package/i.test(message)) return message;
+ const where = platform === "ios" ? "this simulator" : "this emulator";
+ return `${bundleId} is not installed on ${where}. Build and install it (for an Expo app, \`npx expo run:${platform}\`), then launch again.`;
+}
+
function projectName(projectPath: string): string { return projectPath.split("/").filter(Boolean).at(-1) ?? projectPath; }
/** The targets a `mobile_testing_project_config` result lists, keeping only named entries. */
@@ -710,7 +720,7 @@ export class TestingPanel {
this.update({ appLaunched: true });
countUiEvent("ui.testing.launch");
} catch (error) {
- this.update({ error: error instanceof Error ? error.message : String(error) });
+ this.update({ error: launchErrorMessage(error instanceof Error ? error.message : String(error), bundleId, recordablePlatform(device)) });
captureUiError(error, "testing.launch", telemetryContext);
} finally {
if (getUiTelemetryAttributes() === telemetryContext) recordUiTiming("ui.testing.launch", performance.now() - startedAt);
@@ -1597,7 +1607,7 @@ export class TestingPanel {
const pinned = stored && mirrored ? this.storedAppOn(mirrored) : stored;
const runTarget = pinned ?? (stored ? undefined : this.foregroundTarget);
if (this.snapshot.runtimeMode === "bundled" && !runTarget) return;
- if (this.matrixRunCount > 1) { await this.runMatrix({ relativePath, source: untilSource, ...(untilLine === undefined ? {} : { untilLine }), callLines: storedTestCallLines(source) }); return; }
+ if (this.runsOnMatrix) { await this.runMatrix({ relativePath, source: untilSource, ...(untilLine === undefined ? {} : { untilLine }), callLines: storedTestCallLines(source) }); return; }
this.update({ running: true, error: null });
if (pinned && this.deviceApps.getSnapshot().foregroundApp?.bundleId !== pinned.bundleId) {
try {
@@ -1682,7 +1692,7 @@ export class TestingPanel {
const previewSource = until?.source ?? testRecorder.source;
if (!this.hasBundledModel(previewSource, { kind: "recording", options })) return;
const relativePath = this.relativePath;
- if (this.matrixRunCount > 1) { await this.runMatrix({ relativePath, source: previewSource, ...(until ? { untilLine: until.untilLine } : {}) }); return; }
+ if (this.runsOnMatrix) { await this.runMatrix({ relativePath, source: previewSource, ...(until ? { untilLine: until.untilLine } : {}) }); return; }
this.update({ running: true, error: null, pendingRun: false });
testRecorder.clearRun();
// A recording left armed would read the tree mid-run and take the session straight back.
@@ -1742,8 +1752,11 @@ export class TestingPanel {
// ---- Test matrix: the same test on several devices at once -------------------------------------------------
- /** The matrix runs on Mobile Dev's bundled runner only; a project's own config pins its own device. */
- get matrixEnabled(): boolean { return this.snapshot.runtimeMode === "bundled"; }
+ /**
+ * Both runtimes can run on several devices: the bundled runner pins each lane's device in its own
+ * config, and a project's lanes run its own config's target with the device rewritten in a copy.
+ */
+ get matrixEnabled(): boolean { return this.snapshot.available; }
/** The ticked devices that still exist. Zero when the matrix is unavailable. */
get matrixSelection(): MatrixDeviceOption[] {
@@ -1762,18 +1775,47 @@ export class TestingPanel {
return stored && !stored.apps?.[stored.platform === "ios" ? "android" : "ios"] ? stored.platform : undefined;
}
- /** How many devices Run would use; a single device runs the plain way. */
+ /** How many devices Run would use. */
get matrixRunCount(): number { return this.matrixSelection.length; }
+ /**
+ * Whether Run goes to the ticked devices rather than the mirror. Any tick does, except one tick on
+ * the mirrored device itself, which runs the plain way there (its preview and failure marks).
+ * One ticked device that is not the mirror must run there, never on the mirror.
+ */
+ get runsOnMatrix(): boolean {
+ const selection = this.matrixSelection;
+ if (selection.length !== 1) return selection.length > 1;
+ return selection[0]!.deviceId !== this.deviceApps.getSnapshot().device?.udid;
+ }
+
+ private matrixTargetOrder(): TestingTargetOption[] {
+ const selected = this.target;
+ return selected ? [selected, ...this.snapshot.targets.filter(entry => entry !== selected)] : this.snapshot.targets;
+ }
+
+ /** Project mode: the config target each platform's lanes run, so the server uses the selected one. */
+ private matrixProjectTargets(): { ios?: string; android?: string } {
+ const targets: { ios?: string; android?: string } = {};
+ for (const entry of this.matrixTargetOrder()) {
+ const platform = entry.platform;
+ if ((platform === "ios" || platform === "android") && entry.bundleId && !targets[platform]) targets[platform] = entry.name;
+ }
+ return targets;
+ }
+
/** The app a run would drive, per platform: the open test's own app first, then the project's targets. */
matrixApps(): { ios?: string; android?: string } {
// A pinned Studio test runs only the apps it has; the project's targets are not its apps.
if (this.snapshot.runtimeMode === "bundled" && this.storedTarget) return this.storedApps;
const apps: { ios?: string; android?: string } = {};
- for (const entry of this.snapshot.targets) {
+ // The selected target first, so its app wins its platform; the server picks the same target.
+ for (const entry of this.matrixTargetOrder()) {
const platform = entry.platform;
if ((platform === "ios" || platform === "android") && entry.bundleId && !apps[platform]) apps[platform] = entry.bundleId;
}
+ // A project's lanes run its config's targets, never the app in front on the mirror.
+ if (this.snapshot.runtimeMode !== "bundled") return apps;
const own: StoredTestSummary["target"] = this.snapshot.selectedTestPath ? (this.storedTarget ?? this.foregroundTarget)
: this.target?.platform && this.target.bundleId && (this.target.platform === "ios" || this.target.platform === "android") ? { platform: this.target.platform, bundleId: this.target.bundleId } : this.foregroundTarget;
if (own) apps[own.platform] = own.bundleId;
@@ -1897,6 +1939,7 @@ export class TestingPanel {
projectPath: this.snapshot.projectPath, relativePath: input.relativePath, untilSource: input.source,
devices: selection.map(device => ({ deviceId: device.deviceId, platform: device.platform, name: device.name })),
apps, limit: this.snapshot.matrixLimit,
+ ...(this.snapshot.runtimeMode === "project" ? { targets: this.matrixProjectTargets() } : {}),
...(this.snapshot.modelPreference ? { model: this.snapshot.modelPreference } : {}),
}, 60_000);
const started = parseMatrix(response.structuredContent);
diff --git a/packages/ui/test/testing-matrix.test.ts b/packages/ui/test/testing-matrix.test.ts
index dab51abb..6f70314c 100644
--- a/packages/ui/test/testing-matrix.test.ts
+++ b/packages/ui/test/testing-matrix.test.ts
@@ -94,18 +94,25 @@ test("a run on three devices starts one matrix with the limit, polls its lanes a
panel.dispose();
});
-test("one selected device is a plain run, and a project config disables the matrix", async () => {
- const panel = new TestingPanel(matrixHost([]), deviceApps);
+test("one selected device runs as a lane unless it is the mirrored device, and a project config runs the matrix too", async () => {
+ const mirrored = { subscribe: () => () => undefined, getSnapshot: () => ({ device: { udid: "d0" } }) } as unknown as DeviceAppsStore;
+ const panel = new TestingPanel(matrixHost([]), mirrored);
const set = (fields: Record) => (panel as unknown as { update(fields: Record): void }).update(fields);
panel.setAvailable(true);
set({ projectPath: PROJECT, runtimeMode: "bundled", matrixDevices: [{ deviceId: "d0", name: "P", platform: "ios", runtime: "", booted: true }, { deviceId: "d1", name: "Q", platform: "ios", runtime: "", booted: true }] });
panel.setMatrixSelection(["d0"]);
assert.equal(panel.matrixRunCount, 1);
+ assert.equal(panel.runsOnMatrix, false, "the mirrored device alone runs the plain way");
+ panel.setMatrixSelection(["d1"]);
+ assert.equal(panel.runsOnMatrix, true, "one device that is not the mirror runs there, not on the mirror");
+ panel.setMatrixSelection([]);
+ assert.equal(panel.runsOnMatrix, false);
panel.setMatrixSelection(["d0", "d1"]);
assert.equal(panel.matrixRunCount, 2);
+ assert.equal(panel.runsOnMatrix, true);
set({ runtimeMode: "project" });
- assert.equal(panel.matrixEnabled, false);
- assert.equal(panel.matrixRunCount, 0, "a project's own config runs on one device");
+ assert.equal(panel.matrixEnabled, true);
+ assert.equal(panel.matrixRunCount, 2, "a project's lanes run its config's targets on each device");
panel.dispose();
});
diff --git a/packages/ui/test/testing-panel.test.ts b/packages/ui/test/testing-panel.test.ts
index 8185357b..21284552 100644
--- a/packages/ui/test/testing-panel.test.ts
+++ b/packages/ui/test/testing-panel.test.ts
@@ -2,7 +2,7 @@ import test from "node:test";
import assert from "node:assert/strict";
import type { HostBridge } from "../src/host-bridge.ts";
import type { DeviceAppsStore } from "../src/device-apps.ts";
-import { TestingPanel } from "../src/testing-panel.ts";
+import { TestingPanel, launchErrorMessage } from "../src/testing-panel.ts";
import { OPEN_STEP, testRecorder } from "../src/test-recorder.ts";
import type { ScreenComponent } from "../../shared/src/screen-annotations.ts";
@@ -531,3 +531,10 @@ test("Run is unavailable for a Studio test with neither a pinned app nor one in
assert.match(panel.storedRunHint, /Open the app in the mirror/);
panel.dispose();
});
+
+test("a launch of a missing app says to build and install it, and other launch errors pass through", () => {
+ assert.equal(launchErrorMessage("com.app is not installed or has no launcher activity.", "com.app", "android"),
+ "com.app is not installed on this emulator. Build and install it (for an Expo app, `npx expo run:android`), then launch again.");
+ assert.match(launchErrorMessage("com.app is not installed or could not open.", "com.app", "ios"), /this simulator.*npx expo run:ios/);
+ assert.equal(launchErrorMessage("The device is busy.", "com.app", "ios"), "The device is busy.");
+});
From 1796954a8c24921ec8cdf18a2f9ec63b97a8a24e Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Fri, 20 Nov 2026 15:55:34 +0500
Subject: [PATCH 21/23] feat: rename to testing studio
---
docs/agent-recording.md | 20 ++---
docs/telemetry.md | 4 +-
docs/test-matrix.md | 6 +-
docs/testing-panel.md | 49 ++++++------
packages/core/src/panel-tools.ts | 2 +-
packages/core/src/plugin.ts | 4 +-
packages/core/src/testing-agent.ts | 58 +++++++--------
packages/core/src/testing-device.ts | 4 +-
packages/core/src/testing-drafts.ts | 2 +-
packages/core/src/testing-projects.ts | 16 ++--
packages/core/src/testing-run.ts | 6 +-
packages/core/src/testing-tools.ts | 44 +++++------
packages/core/test/mobile-dev-skill.test.ts | 10 +--
packages/core/test/plugin.test.ts | 2 +-
.../core/test/testing-agent-panel.test.ts | 10 +--
packages/core/test/testing-agent.test.ts | 4 +-
.../core/test/testing-chat-project.test.ts | 10 +--
packages/core/test/testing-panel-ui.test.ts | 24 ++++--
packages/core/test/testing-projects.test.ts | 10 +--
packages/core/test/testing-run.test.ts | 2 +-
.../core/test/testing-studio-agent.test.ts | 28 +++----
packages/mcp-app/src/components/workspace.tsx | 16 ++--
packages/shared/src/panel-target.ts | 8 +-
packages/shared/src/test-recording.ts | 4 +-
packages/skills/mobile-dev-testing/SKILL.md | 28 +++----
packages/ui/src/components/cascading-menu.tsx | 2 +-
.../src/components/test-recorder-overlay.tsx | 2 +-
packages/ui/src/components/testing-note.tsx | 2 +-
packages/ui/src/components/testing-setup.tsx | 18 ++---
packages/ui/src/components/testing-view.tsx | 28 +++----
packages/ui/src/popover-placement.ts | 2 +-
packages/ui/src/simulator-panel.ts | 4 +-
packages/ui/src/test-recorder.ts | 4 +-
packages/ui/src/testing-matrix.ts | 2 +-
packages/ui/src/testing-panel.ts | 64 ++++++++--------
packages/ui/test/test-recorder.test.ts | 2 +-
.../ui/test/testing-agent-run-render.test.ts | 2 +-
packages/ui/test/testing-panel.test.ts | 26 +++----
website/astro.config.mjs | 2 +-
.../src/content/docs/docs/getting-started.md | 2 +-
website/src/content/docs/docs/introduction.md | 2 +-
website/src/content/docs/docs/privacy.md | 4 +-
website/src/content/docs/docs/testing.md | 74 +++++++++++++------
website/src/pages/index.astro | 2 +-
44 files changed, 332 insertions(+), 283 deletions(-)
diff --git a/docs/agent-recording.md b/docs/agent-recording.md
index c7cd3d7a..d7731d8b 100644
--- a/docs/agent-recording.md
+++ b/docs/agent-recording.md
@@ -1,4 +1,4 @@
-# Agent-driven recording in the Testing panel
+# Agent-driven recording in the Testing Studio panel
Status: implemented. The five model tools, `mobile_testing_agent_state` and
`mobile_testing_set_context` are in `packages/core/src/testing-agent.ts`; the panel polls, adopts
@@ -6,10 +6,10 @@ and locks the mirror; the skill is `packages/skills/mobile-dev-testing`. Android
through the context's `deviceId` and `platform`; physical devices, Maestro, saving and running are
still out, as below.
-The Testing panel records an e2e test from the user's own taps on the mirror
+The Testing Studio panel records an e2e test from the user's own taps on the mirror
([docs/testing-panel.md](testing-panel.md)). This adds the other driver: the user tells their
coding agent *"use Mobile Dev and record the test for the important areas on the Explore Details
-screen"*, the Testing tab opens, and the steps appear in it one at a time as the agent works. When
+screen"*, the Testing Studio tab opens, and the steps appear in it one at a time as the agent works. When
the agent stops, the flow is sitting in the panel unsaved and the user adjusts it, saves it and
runs it exactly as if they had tapped it themselves.
@@ -56,10 +56,10 @@ in `packages/core/src/app-flow-tools.ts`):
| Tool | Input | Does |
|---|---|---|
-| `mobile_testing_agent_begin` | `{ title, goal }` | Opens the Testing tab, starts one session against the panel's current project, device and bundle id. Refuses, with what is missing, when any of the three is unset. |
+| `mobile_testing_agent_begin` | `{ title, goal }` | Opens the Testing Studio tab, starts one session against the panel's current project, device and bundle id. Refuses, with what is missing, when any of the three is unset. |
| `mobile_testing_agent_screen` | `{}` | The runner's element tree as the agent's eyes: one compact row per element — `ref`, `role`, `name`, `text`, `placeholder`, `value`, `testId`, `enabled`, `selected`, `bounds` — **and the selector the recorder would emit for it**, with its rank and whether it is unique. The agent never writes a locator; it names a `ref`. |
| `mobile_testing_agent_step` | `{ ref?, kind, value?, direction?, instruction? }` | Records one step and performs it. `kind` is a `PinnedStepKind`; `instruction` with no `ref` records an `AgentStep`. Assertions record without touching the device, mirroring the element menu. An acting step answers with `navigated: true` when it replaced the screen — see "Where a flow ends". |
-| `mobile_testing_agent_finish` | `{ note? }` | Ends the session. In a project the steps are left dirty in the panel and nothing is saved; in Studio the test is saved, pinned to the recorded app, and its `relativePath` returned. Runs nothing either way. |
+| `mobile_testing_agent_finish` | `{ note? }` | Ends the session. In a project the steps are left dirty in the panel and nothing is saved; in Testing Studio the test is saved, pinned to the recorded app, and its `relativePath` returned. Runs nothing either way. |
| `mobile_testing_agent_abort` | `{ reason }` | Drops the session; whatever was recorded stays in the panel. |
App-only:
@@ -69,16 +69,16 @@ App-only:
| `mobile_testing_agent_state` | `{}` | `{ active, status, revision, title, goal, steps, note, error }`. The panel polls it. |
| `mobile_testing_set_context` | `{ projectPath, udid, bundleId }` | The panel reports its selection whenever it changes. This is the only thing that knows the selected device, and `agent_begin` reads it. |
-## Studio mode: the agent saves, runs and repairs
+## Testing Studio mode: the agent saves, runs and repairs
-In No project (Studio) mode the agent drives the whole loop, so more of `testing-tools.ts` is
+In No project (Testing Studio) mode the agent drives the whole loop, so more of `testing-tools.ts` is
model-visible (`sharedVisibility`): `run_test`, `run_matrix`, `run_progress`, `cancel`, `set_target`,
`read_file`, `tests`, plus two new tools. The rest (`write_file`, `stage_file`, `save_staged_file`,
`delete_file`, drafts, setup) stay app-only.
-- **Gate.** Each model-visible tool refuses unless the Testing tab has reported a project
+- **Gate.** Each model-visible tool refuses unless the Testing Studio tab has reported a project
(`mobile_testing_set_context`), and `projectPath` defaults to it. The agent never needs to know
- where Studio lives.
+ where Testing Studio lives.
- **`agent_finish` saves** in bundled mode: `tests/.e2e.ts`, never replacing a name that is
taken, pinned to the recorded platform and bundle id. It returns `relativePath`; no draft is kept.
In a project it still hands over unsaved.
@@ -175,7 +175,7 @@ describes: all three plugins for Codex and Cursor, and `apps/claude/skills` for
It covers:
- **When**: the user asks to record, write or capture an e2e test for a screen or a flow.
-- **Prerequisites**: the Testing tab, a chosen project, a booted iOS simulator with the app
+- **Prerequisites**: the Testing Studio tab, a chosen project, a booted iOS simulator with the app
launched. Missing any, say which and ask — never open the folder picker on the user's behalf.
- **The loop**: `agent_begin` → `agent_screen` → choose a `ref` → `agent_step` → re-read → … →
`agent_finish`.
diff --git a/docs/telemetry.md b/docs/telemetry.md
index 9b1ecd1b..473173bc 100644
--- a/docs/telemetry.md
+++ b/docs/telemetry.md
@@ -544,7 +544,7 @@ it does not confirm user submission or a model response. Notes remain until the
user clears them. Message/context construction timings, surface attribution, and
content scrubbing are preserved; no note text or selection evidence enters telemetry.
-The Testing panel's recorder measures `ui.testing.tree_read`, the read that resolves a tap into a
+The Testing Studio panel's recorder measures `ui.testing.tree_read`, the read that resolves a tap into a
selector, and counts `ui.testing.record_start`/`record_stop`, `ui.testing.step_tap`,
`ui.testing.step_assert`, `ui.testing.step_unresolved`, `ui.testing.hover_walk`,
`ui.testing.menu_open`. Editing a recorded step counts `ui.testing.step_duplicate`,
@@ -643,7 +643,7 @@ while this one answers "how long is Record unusable for" — the number the over
of. A read that fails still records the timing, because the wait happened; it carries no selector,
element name, bundle id or project path.
-The Testing panel records on Android emulators as well as iOS simulators, so `ui.testing.tree_read`,
+The Testing Studio panel records on Android emulators as well as iOS simulators, so `ui.testing.tree_read`,
`ui.testing.record_prepare` and the `testing.agent.screen.*` metrics now carry a `platform`
attribute (`ios` or `android`; two values, no device ids). One series hid that waiting on an
emulator is a different number from waiting on a simulator. Names, units and boundaries are
diff --git a/docs/test-matrix.md b/docs/test-matrix.md
index c8d03571..1e01b176 100644
--- a/docs/test-matrix.md
+++ b/docs/test-matrix.md
@@ -2,11 +2,11 @@
Status: **bundled mode implemented** (milestones 1, 2, 3 and 5). Project mode (milestone 4) works through a text-rewritten copy of the config (`runProjectLane`, `rewriteLaneConfig` in `testing-run.ts`); the upstream `e2e run --device` flag that replaces it is tracked in `items-todo.md`. Docs: [testing-panel.md](testing-panel.md#running-on-several-devices-test-matrix), [mcp-tools.md](mcp-tools.md).
-Run one recorded e2e test on several devices at once — e.g. iPhone 17, iPhone 16 and a Pixel emulator — from the Testing panel, or from chat through MCP.
+Run one recorded e2e test on several devices at once — e.g. iPhone 17, iPhone 16 and a Pixel emulator — from the Testing Studio panel, or from chat through MCP.
## Goals
-- Pick N devices (iOS simulators, Android emulators, connected phones) in the Testing panel and run the open test on all of them in parallel.
+- Pick N devices (iOS simulators, Android emulators, connected phones) in the Testing Studio panel and run the open test on all of them in parallel.
- One lane of live progress and one result per device; a failure on one device does not stop the others.
- Devices that are off get booted; devices missing the app get it installed.
- At most **3** devices run at once by default; the user can change the limit. Extra devices queue.
@@ -37,7 +37,7 @@ Run one recorded e2e test on several devices at once — e.g. iPhone 17, iPhone
```mermaid
flowchart LR
- UI[Testing panel: Matrix] --> T[mobile_testing_run_matrix]
+ UI[Testing Studio panel: Matrix] --> T[mobile_testing_run_matrix]
Chat[Chat agent via MCP] --> T
T --> Q[Scheduler: limit 3, queue rest]
Q --> P1[Prepare: boot → install → launch]
diff --git a/docs/testing-panel.md b/docs/testing-panel.md
index 7ff8c7b7..4ed39ac7 100644
--- a/docs/testing-panel.md
+++ b/docs/testing-panel.md
@@ -1,4 +1,4 @@
-# Testing panel — record e2e tests from the mirror
+# Testing Studio panel — record e2e tests from the mirror
## Zero-setup runtime and optional project setup
@@ -8,27 +8,27 @@ and release metadata. A project with its own config, a compatible mobile target
`e2e` CLI is always authoritative, whatever its e2e version: runs use the project's own CLI. Only the
recorder's tree reading is version-sensitive; when the project's `@e2e-dev/mobile` node projection is
missing or does not load, the recorder reads the tree with the bundled one instead. With no config,
-no compatible mobile target, or no installed `e2e` CLI, Studio switches to **Bundled runtime** and keeps generated config plus saved tests in Mobile Dev's private state. Record,
+no compatible mobile target, or no installed `e2e` CLI, Testing Studio switches to **Bundled runtime** and keeps generated config plus saved tests in Mobile Dev's private state. Record,
Save, Run, Play until here, manual recording and agent recording therefore do not modify the project.
### No project open
-Opening a project is optional. With no recorded project, Studio opens on **No project**: a private,
+Opening a project is optional. With no recorded project, Testing Studio opens on **No project**: a private,
empty workspace in Mobile Dev's state (`testing/studio-workspace`, reported as `studioPath` by
`mobile_testing_projects`). It has no config, so it always runs on the Bundled runtime. The user picks
nothing up front: the target is the app in the mirror's foreground (platform from the mirrored device,
bundle id from the foreground app), so Launch app, Record, Save and Run work as in any bundled project.
-Saved tests are listed under **In Studio**. The project picker's first entry, **No project**, returns
+Saved tests are listed under **In Testing Studio**. The project picker's first entry, **No project**, returns
to this workspace; any recorded or newly chosen folder still switches to project behavior, and the
workspace is never listed as a project. **Set up project** is hidden in this mode because there is
no project to write into.
### Pinned app
-A Studio (bundled) test is pinned to `{ platform, bundleId }`, stored in `targets.json` beside the
+A Testing Studio (bundled) test is pinned to `{ platform, bundleId }`, stored in `targets.json` beside the
tests in Mobile Dev's private state, never in the test source. Save pins the app being recorded
against. Run on a test with no pin pins the app in front first (`mobile_testing_run_test` `pin`).
-A pinned test always runs against its own app: Studio opens it if it is not in front, and says so
+A pinned test always runs against its own app: Testing Studio opens it if it is not in front, and says so
if it is not installed or the mirrored platform differs. The preview shows the pinned app with
**Use current app** to re-pin (`mobile_testing_set_target`). With no pin and no foreground app, Run
is disabled with a hint. Project tests keep using their config's targets.
@@ -48,7 +48,7 @@ Hosts may preselect a choice only through advertised `configuration.mobileDev.te
the equivalent experimental capability); no host-name branch exists.
The toolbar has one **E2E setup** entry (a status dot plus `Bundled`/`Project`; its tooltip explains the
-runtime, replacing the separate runtime chip, Model button and Zero-setup banner). Both runtimes open on a compact summary; **Set up project** / **Update setup** opens the form. The popover holds the
+runtime, replacing the separate runtime chip, Model button and Zero-setup banner). Both runtimes open on a compact summary; **Set up project** / **Update setup** opens the form. The summary's sections (Project, Mobile apps, Devices, Agent model) all start collapsed in both runtimes; Agent model opens by itself when a run needs a model. **Launch app** opens an installed app and never builds one; when the app is missing it says so with the build to run (for an Expo app, `npx expo run:ios` / `npx expo run:android`). The popover holds the
agent model (provider, model id, sign-in, **Use model** for bundled runs), the mobile targets and the
opt-in GUI equivalent of `e2e init`:
target names, platforms, identifiers and provider are editable, then
@@ -58,7 +58,7 @@ supports cancellation and reports partial failures without pretending already-wr
back. MCP registration is preselected and previews both `.mcp.json` and `.cursor/mcp.json`, preserving
all other servers. Configured projects open on a read-only summary—effective
targets/config, statically discoverable model, dependency versions, skill state and MCP registrations shown as status items—
-with mutations behind a separate **Update setup** action. Setup is the only zero-setup Studio path that
+with mutations behind a separate **Update setup** action. Setup is the only zero-setup Testing Studio path that
writes configuration into the selected project.
Status: Android emulators are supported alongside iOS simulators — the device is identified by
@@ -73,9 +73,9 @@ A test can also be recorded by the user's own coding agent, which drives the sam
the server — see [docs/agent-recording.md](agent-recording.md).
A workspace tool, **Testing**, that turns the existing simulator mirror into a
-Maestro-Studio-style recorder: pick a project, launch its app, tap the mirror, and watch the test
+Maestro-Testing Studio-style recorder: pick a project, launch its app, tap the mirror, and watch the test
source grow one step per interaction. In project mode Save writes to the project; in bundled mode it
-writes to Studio's private state until the user explicitly runs project setup.
+writes to Testing Studio's private state until the user explicitly runs project setup.
First pass targets the **iOS simulator** (and now the **Android emulator**) and the **e2e** runner (`@e2e-dev/mobile`).
Maestro YAML is a second emitter behind the same recorder.
@@ -144,7 +144,7 @@ it holds **two groups**:
| Group | Holds | Starts |
|---|---|---|
| **Not stored** | The drafts: a kept flow with its step count, how long ago it was touched and whether the user or an agent recorded it. **New recording** is at its foot | Expanded — it is what is being worked on |
-| **In the project / Studio** | Project `.e2e.ts` files in project mode; private Studio tests in bundled mode | Collapsed — it is the archive |
+| **In the project / Testing Studio** | Project `.e2e.ts` files in project mode; private Testing Studio tests in bundled mode | Collapsed — it is the archive |
The second group exists because deleting the draft on save had an effect nobody asked for: the
test the user had just saved **left the list**. There was nowhere for it to go. Now it moves from
@@ -204,7 +204,7 @@ flowchart LR
### Where the mirror sits
-In the Testing panel the mirror is on the **left** and the preview and step list on the right;
+In the Testing Studio panel the mirror is on the **left** and the preview and step list on the right;
every other tool keeps the simulator on the right. Recording is done by tapping the mirror and read
back in the preview beside it, so the mirror leads in the same direction the panel is read. It is
one flag in `packages/mcp-app/src/components/workspace.tsx` that reverses the resizable group's
@@ -446,7 +446,7 @@ produce. The step is right; the screen behind it is not. `toBeVisible` and `scro
nothing, because they change nothing: an assertion reads, and `scrollUntilVisible` is only offered
for an element the user just pointed at, which is on screen already.
-In its place is Maestro Studio's model. **Right-click an element on the mirror and the panel offers
+In its place is Maestro Testing Studio's model. **Right-click an element on the mirror and the panel offers
what the runner can do with it**. The selected element is named once, followed by compact actions:
```
@@ -681,7 +681,7 @@ Save behaviour:
- The panel tracks a dirty flag: steps recorded since the last Save. Stopping or switching projects
with unsaved steps warns.
-Alternative considered and rejected: debounced live-write after every tap. It is what Maestro Studio
+Alternative considered and rejected: debounced live-write after every tap. It is what Maestro Testing Studio
feels like, but each write is an MCP tool call and so a host permission prompt — unusable in a
recorder where a flow is thirty taps.
@@ -792,18 +792,21 @@ line to mark, so the panel shows the runner's own output instead of going quiet.
#### Running on several devices (test matrix)
E2E setup → **Devices** lists the iOS simulators and Android emulators with *Booted*/*Off* and
-*Installed*/*App missing* badges. Tick two or more and **Run test** becomes **Run on N devices**; one
-or none is the plain single-device run. "Run up to [3] at once" caps how many devices work at the
+*Installed*/*App missing* badges. Tick two or more and **Run test** becomes **Run on N devices**. One
+ticked device that is not the mirrored one runs there as a single lane (**Run on iPhone Air**); none,
+or only the mirrored device, is the plain single-device run on the mirror. "Run up to [3] at once" caps how many devices work at the
same time (1–8); the rest queue. The ticked devices and the limit are saved per project.
A project with its own `e2e.config.ts` works too, with differences. Each lane runs the config's
-target for the device's platform (the selected target wins its platform), and the plugin neither
-installs nor launches the app: a device without it fails its lane with "App not installed", and
-the runner's own `app.open` starts it. `mobile()` returns an opaque engine handle and the e2e CLI has
+target for the device's platform (the selected target wins its platform). The plugin does not
+launch the app — the runner's own `app.open` starts it — but a device without it gets it copied
+exactly as in bundled mode (below). `mobile()` returns an opaque engine handle and the e2e CLI has
no per-run device flag, so a lane **copies the config text** and rewrites that target's
`mobile(ARG)` into `mobile({ ...(ARG), device, session })`, which keeps the user's other options.
The copy runs from an isolated mirror of the project (or, for a run of the file itself, as a hidden
-`.e2e.mobile-dev-lane--` file beside the config) and is removed when the lane ends; stale
+`.e2e.mobile-dev-lane--` file beside the config) and is removed when the lane ends. Its
+`--output` directory sits inside that same root, because the runner refuses an output outside the
+project it runs from; stale
ones from a dead process are swept. A target whose engine is not a direct `mobile(...)` call is
refused with a message saying so. This workaround is replaced by an upstream `e2e run --device`
flag; see `items-todo.md`.
@@ -828,8 +831,10 @@ flowchart LR
through `ServeEmu`; an `avd:` id becomes the running serial). Booting counts against the limit.
- **A missing app is copied from another booted device that has it**: iOS with `simctl
get_app_container` + `install`, Android with `pm path` + `adb pull`, installed with
- `install-multiple` when the app is split. No device has it → the lane fails with "App not
- installed" and the others carry on. The request carries one app id per platform
+ `install-multiple` when the app is split. A device in the run is tried first, then any other
+ booted device of the platform, so the device the app was built on need not be ticked; a device
+ that is off is never booted to be a source. No booted device has it → the lane fails with "App
+ not installed" and the others carry on. The request carries one app id per platform
(`apps: { ios, android }`); a platform with none fails fast.
- **The lanes view** shows a row per device (state, duration, cancel) and a summary such as
"2 passed · 1 failed". Clicking a row puts that device's steps on the preview. The recorder is
diff --git a/packages/core/src/panel-tools.ts b/packages/core/src/panel-tools.ts
index f9d672d2..3cf377ec 100644
--- a/packages/core/src/panel-tools.ts
+++ b/packages/core/src/panel-tools.ts
@@ -264,7 +264,7 @@ function registerPanel(server: McpServer, { android, cpu, fps, drivers, page, sh
});
openingTool("mobile_open_simulator", {
- description: "Open Mobile Dev alongside the chat for local mobile app development, before the first device launch unless a view is open or the workflow is tool-only. Pass established platform, kind, or discovered deviceId to select the initial device; omit undecided fields. Pass workspaceTool \"testing\" to open (or switch an open view to) the Testing tab, which e2e recording and test runs need; with it, pass projectPath, your workspace root (\"\" when the chat has no project), so the tab selects that project, or No project for a folder that is not one. Starts the bundled backend without booting devices. Every call makes the host draw another panel in the chat, so call it once per chat and never to \"make sure\" a panel is open; booting, recording and running tests do not need it again.",
+ description: "Open Mobile Dev alongside the chat for local mobile app development, before the first device launch unless a view is open or the workflow is tool-only. Pass established platform, kind, or discovered deviceId to select the initial device; omit undecided fields. Pass workspaceTool \"testing\" to open (or switch an open view to) the Testing Studio tab, which e2e recording and test runs need; with it, pass projectPath, your workspace root (\"\" when the chat has no project), so the tab selects that project, or No project for a folder that is not one. Starts the bundled backend without booting devices. Every call makes the host draw another panel in the chat, so call it once per chat and never to \"make sure\" a panel is open; booting, recording and running tests do not need it again.",
resourceUri: APP_URI, entrypoint: "thread",
});
diff --git a/packages/core/src/plugin.ts b/packages/core/src/plugin.ts
index f1824f7a..a8e77f8c 100644
--- a/packages/core/src/plugin.ts
+++ b/packages/core/src/plugin.ts
@@ -172,7 +172,7 @@ export async function createPlugin(html: string | (() => Promise), o
registerEarlierReleases(server, "mobile-dev-devices-earlier", "devices", readCard("devices"));
const panelOpeners: PanelOpener[] = [];
/**
- * Makes the Testing tab show the chat's project. The chat's workspace root comes from the agent
+ * Makes the Testing Studio tab show the chat's project. The chat's workspace root comes from the agent
* (`projectPath`), else from the host's MCP roots when it offers them. A root that is no project
* (a scratch folder) selects No project; with neither signal the panel keeps its own selection.
*/
@@ -194,7 +194,7 @@ export async function createPlugin(html: string | (() => Promise), o
}
// One place shows the panel beyond the host; the first feature that offers one wins.
const opened: PanelOpener = async open => {
- // The Testing tab beats a moment after it loads; calls made in between wait for it rather than refuse.
+ // The Testing Studio tab beats a moment after it loads; calls made in between wait for it rather than refuse.
testingRecordings.expectPanel();
testingRecordings.noteOpenCall();
const { projectPath, ...target } = open.target;
diff --git a/packages/core/src/testing-agent.ts b/packages/core/src/testing-agent.ts
index 89d48b8d..d915a960 100644
--- a/packages/core/src/testing-agent.ts
+++ b/packages/core/src/testing-agent.ts
@@ -23,7 +23,7 @@ import type { DeviceOps } from "./testing-prepare.ts";
import { inspectProject, sameProjectPath, storedTestsChangeRevision, studioWorkspacePath, writeTestFile, writeTestTarget } from "./testing-projects.ts";
/**
- * Recording an e2e test from the user's own coding agent, into the Testing panel the user is
+ * Recording an e2e test from the user's own coding agent, into the Testing Studio panel the user is
* looking at.
*
* The manual recorder lives entirely in the iframe — `testRecorder` is a singleton there and
@@ -52,7 +52,7 @@ const RANK_LABEL: Record = {
*/
const MAX_ELEMENTS = 200;
-/** How often the open Testing tab re-sends its selection, and how long silence is believed (three beats). */
+/** How often the open Testing Studio tab re-sends its selection, and how long silence is believed (three beats). */
export { PANEL_HEARTBEAT_MS };
/**
* A throttled background webview may beat only about once a minute, so a quiet panel is not a
@@ -86,13 +86,13 @@ export type TestingAgentState = {
*
* The server writes the draft rather than the panel, because the panel may never have been
* looking: the user asks their agent for a test in the chat, reads the answer there, and only
- * opens the Testing tab later. The panel adopts this id so its own autosave keeps replacing the
+ * opens the Testing Studio tab later. The panel adopts this id so its own autosave keeps replacing the
* same draft instead of leaving a second copy of the same flow in the list.
*/
draftId: string;
/**
* Where the finished session was saved as a test, or "" when it was only kept as a draft.
- * Set in Studio (bundled) mode, where finishing writes the test; the panel refreshes its list
+ * Set in Testing Studio (bundled) mode, where finishing writes the test; the panel refreshes its list
* from it instead of adopting a draft.
*/
savedPath: string;
@@ -125,7 +125,7 @@ type Session = {
identities: Set;
/** Set once the session ends and its steps are kept as an unsaved recording. */
draftId: string;
- /** Set once a Studio session's steps are written as a test, relative to its tests folder root. */
+ /** Set once a Testing Studio session's steps are written as a test, relative to its tests folder root. */
savedPath: string;
};
@@ -215,13 +215,13 @@ export class TestingAgentRecordings {
private readonly devices: TestingDevices;
private readonly drafts: TestDraftStore;
private context?: TestingAgentContext;
- /** The project the Testing panel reports, whether or not a device is selected: proof the tab is open. */
+ /** The project the Testing Studio panel reports, whether or not a device is selected: proof the tab is open. */
private panelProject = "";
private session?: Session;
/** `Date.now()` until which a silent panel is believed to be loading rather than closed. */
private expectUntil = 0;
private revision = 0;
- /** The project an agent asked the panel to show when it opened it: a folder, or Studio's workspace. */
+ /** The project an agent asked the panel to show when it opened it: a folder, or Testing Studio's workspace. */
private projectRequest?: { id: number; path: string; at: number };
private projectRequests = 0;
@@ -257,7 +257,7 @@ export class TestingAgentRecordings {
/** The panel reports its project on every selection change, even with no device; empty means it has none. */
setPanelProject(projectPath: string) { this.panelProject = projectPath; this.reportedAt = projectPath ? this.now() : 0; }
- /** The project the Testing panel has selected, or undefined when the tab has not reported one. */
+ /** The project the Testing Studio panel has selected, or undefined when the tab has not reported one. */
panelProjectPath(): string | undefined { this.expire(); return this.panelProject || undefined; }
/**
* Notes that the panel was just opened, so a call that finds the tab silent waits for its first
@@ -271,16 +271,16 @@ export class TestingAgentRecordings {
/**
* What an agent that opens the panel again should be told. Hosts draw a new Mobile Dev view for
* every call to an opening tool and the server cannot stop that, so the only protection is to say
- * the panel is already there: while the Testing tab reports in, or after this server was already
+ * the panel is already there: while the Testing Studio tab reports in, or after this server was already
* asked for one (the tab may then be hidden or on another tab, which also silences it).
*/
panelReopenNotice(): string | undefined {
- if (this.panelProjectPath() !== undefined) return "The Mobile Dev panel was already open in this chat and the Testing tab is reporting, so this call made the host draw an extra panel. Do not call mobile_open_simulator or mobile_open_workspace again in this chat: boot, run and record with the other tools, and the open panel follows.";
- if (this.panelOpens > 0) return "A Mobile Dev panel was already opened in this chat, so this call made the host draw another. Do not open more: if a tool says the Testing tab is not open, it may be hidden or on another tab, so ask the user to show the existing panel and its Testing tab.";
+ if (this.panelProjectPath() !== undefined) return "The Mobile Dev panel was already open in this chat and the Testing Studio tab is reporting, so this call made the host draw an extra panel. Do not call mobile_open_simulator or mobile_open_workspace again in this chat: boot, run and record with the other tools, and the open panel follows.";
+ if (this.panelOpens > 0) return "A Mobile Dev panel was already opened in this chat, so this call made the host draw another. Do not open more: if a tool says the Testing Studio tab is not open, it may be hidden or on another tab, so ask the user to show the existing panel and its Testing Studio tab.";
return undefined;
}
/**
- * An agent opened the Testing tab for a chat: the panel selects this project once, however it was
+ * An agent opened the Testing Studio tab for a chat: the panel selects this project once, however it was
* last used. `undefined` asks for No project. Only an agent's open sets it, so a project the user
* picks afterwards is theirs.
*/
@@ -339,9 +339,9 @@ export class TestingAgentRecordings {
/**
* Starts a recording against what the panel has selected, filling in only what is unambiguous.
*
- * The Testing tab has to be open (it is the proof the user is looking, and its heartbeat is the
+ * The Testing Studio tab has to be open (it is the proof the user is looking, and its heartbeat is the
* only thing that says so). Past that, nothing is asked that the machine can answer: the device is
- * the mirrored one, or the only one booted; in Studio the app is whichever is in the foreground;
+ * the mirrored one, or the only one booted; in Testing Studio the app is whichever is in the foreground;
* in a project it is the config target the foreground app matches, or the only target for the
* platform. A real ambiguity or a missing piece comes back as one refusal that names only what is
* missing, with one action each. The project is never picked here — choosing it is an explicit act
@@ -352,9 +352,9 @@ export class TestingAgentRecordings {
refused(`An agent recording is already in flight: "${this.session.title}". Finish it with mobile_testing_agent_finish, or drop it with mobile_testing_agent_abort.`);
}
const projectPath = await this.awaitPanelProject() ?? this.context?.projectPath ?? "";
- if (!projectPath) refused("The Testing tab is not open. If no Mobile Dev panel is showing in this chat, call mobile_open_simulator with workspaceTool \"testing\" once to open it, then begin again; if you already opened one, do not open another (each call adds a panel): ask the user to show the existing panel and its Testing tab.");
+ if (!projectPath) refused("The Testing Studio tab is not open. If no Mobile Dev panel is showing in this chat, call mobile_open_simulator with workspaceTool \"testing\" once to open it, then begin again; if you already opened one, do not open another (each call adds a panel): ask the user to show the existing panel and its Testing Studio tab.");
const unmet = this.unmetProjectRequest();
- if (unmet) refused(`The Testing tab has not switched to ${sameProjectPath(unmet, studioWorkspacePath()) ? "No project" : unmet} yet. Try again in a moment; do not open the panel again, it is already open.`);
+ if (unmet) refused(`The Testing Studio tab has not switched to ${sameProjectPath(unmet, studioWorkspacePath()) ? "No project" : unmet} yet. Try again in a moment; do not open the panel again, it is already open.`);
const context = await this.resolveTarget(projectPath);
this.session = {
target: { deviceId: context.deviceId, platform: context.platform, projectPath: context.projectPath, bundleId: context.bundleId },
@@ -383,7 +383,7 @@ export class TestingAgentRecordings {
const picked: string[] = [];
const bundled = (await inspectProject(projectPath).catch(() => undefined))?.runtimeMode === "bundled";
// A selection the panel reported whole is the user's own choice; nothing second-guesses it. In
- // Studio the app in front is the target, so only a project's complete selection is final.
+ // Testing Studio the app in front is the target, so only a project's complete selection is final.
if (reported?.deviceId && reported.bundleId && !bundled) return { ...reported, projectPath, picked };
const problems: string[] = [];
@@ -630,7 +630,7 @@ export class TestingAgentRecordings {
/**
* Ends the recording.
*
- * In Studio (bundled) mode the test is written into Studio, pinned to the recorded platform and
+ * In Testing Studio (bundled) mode the test is written into Testing Studio, pinned to the recorded platform and
* app, and its path is returned: there is no project file for a user to review, and the agent
* runs the test next. In a project the steps stay unsaved in the panel for the user to adjust,
* name and save themselves. Nothing is run either way — a run resets the app and takes the
@@ -650,21 +650,21 @@ export class TestingAgentRecordings {
steps: session.steps.length,
source,
...(saved.relativePath ? {
- saved: true, relativePath: saved.relativePath, path: `Studio/${saved.relativePath}`,
+ saved: true, relativePath: saved.relativePath, path: `Testing Studio/${saved.relativePath}`,
platform: session.target.platform, bundleId: session.target.bundleId,
- next: `${count} saved in Studio as ${saved.relativePath}, pinned to ${session.target.platform} ${session.target.bundleId}. Run it with mobile_testing_run_test or mobile_testing_run_matrix, passing that relativePath.`,
+ next: `${count} saved in Testing Studio as ${saved.relativePath}, pinned to ${session.target.platform} ${session.target.bundleId}. Run it with mobile_testing_run_test or mobile_testing_run_matrix, passing that relativePath.`,
} : {
saved: false,
...(saved.error ? { saveError: saved.error } : {}),
- next: `${count} are waiting in Mobile Dev's Testing panel, unsaved. Tell the user to review them there and press Save; nothing has been written to the project and nothing has been run.${saved.error ? ` Saving to Studio failed: ${saved.error}` : ""}`,
+ next: `${count} are waiting in Mobile Dev's Testing Studio panel, unsaved. Tell the user to review them there and press Save; nothing has been written to the project and nothing has been run.${saved.error ? ` Saving to Testing Studio failed: ${saved.error}` : ""}`,
}),
};
}
- /** Writes a Studio session's test and its app pin. Never throws: a failed save falls back to the draft. */
+ /** Writes a Testing Studio session's test and its app pin. Never throws: a failed save falls back to the draft. */
private async saveToStudio(session: Session, source: string): Promise<{ relativePath?: string; error?: string }> {
if (session.steps.length === 0) return {};
- // A project that cannot be read is not Studio; the draft path handles it as it always did.
+ // A project that cannot be read is not Testing Studio; the draft path handles it as it always did.
const project = await inspectProject(session.target.projectPath).catch(() => undefined);
if (project?.runtimeMode !== "bundled") return {};
try {
@@ -750,7 +750,7 @@ export function registerTestingAgentTools(server: McpServer, devices: TestingDev
registerAppTool(server, "mobile_testing_agent_begin", {
title: "Begin recording an e2e test",
description:
- "Start recording an e2e test into Mobile Dev's Testing panel, against the project the panel has selected. The Testing tab must be open. The device and app are picked automatically when unambiguous (the mirrored or only booted device; in Studio the app in the foreground, in a project the matching config target) and reported back in `picked`, so tell the user. Otherwise it refuses naming only what is missing and the one action for each; do that (boot a device, open the app) or ask the user only when they really must open or install the app, then begin again. The steps appear in the panel as you record them. In No project (Studio) mode mobile_testing_agent_finish saves the test pinned to the recorded app and returns its relativePath for mobile_testing_run_test / mobile_testing_run_matrix; in a project the steps stay unsaved for the user.",
+ "Start recording an e2e test into Mobile Dev's Testing Studio panel, against the project the panel has selected. The Testing Studio tab must be open. The device and app are picked automatically when unambiguous (the mirrored or only booted device; in Testing Studio the app in the foreground, in a project the matching config target) and reported back in `picked`, so tell the user. Otherwise it refuses naming only what is missing and the one action for each; do that (boot a device, open the app) or ask the user only when they really must open or install the app, then begin again. The steps appear in the panel as you record them. In No project (Testing Studio) mode mobile_testing_agent_finish saves the test pinned to the recorded app and returns its relativePath for mobile_testing_run_test / mobile_testing_run_matrix; in a project the steps stay unsaved for the user.",
inputSchema: {
title: z.string().min(1).max(200).describe("The test's title, e.g. \"the explore details screen\"."),
goal: z.string().min(1).max(500).describe("What this flow covers, in one sentence. Shown to the user in the panel's banner."),
@@ -787,7 +787,7 @@ export function registerTestingAgentTools(server: McpServer, devices: TestingDev
registerAppTool(server, "mobile_testing_agent_finish", {
title: "Finish the recording",
description:
- "End the recording. In No project (Studio) mode the test is saved into Studio, pinned to the recorded platform and app, and its relativePath is returned so you can run it. In a project the steps are left unsaved in the Testing panel for the user to adjust and save, and nothing is written. Nothing is run either way.",
+ "End the recording. In No project (Testing Studio) mode the test is saved into Testing Studio, pinned to the recorded platform and app, and its relativePath is returned so you can run it. In a project the steps are left unsaved in the Testing Studio panel for the user to adjust and save, and nothing is written. Nothing is run either way.",
inputSchema: { note: z.string().max(500).optional().describe("One line on what was recorded, for the user.") },
annotations: write,
_meta: sharedVisibility,
@@ -795,7 +795,7 @@ export function registerTestingAgentTools(server: McpServer, devices: TestingDev
registerAppTool(server, "mobile_testing_agent_abort", {
title: "Abandon the recording",
- description: "Drop the recording. Whatever was recorded stays in the Testing panel for the user.",
+ description: "Drop the recording. Whatever was recorded stays in the Testing Studio panel for the user.",
inputSchema: { reason: z.string().min(1).max(500).describe("Why the recording stopped.") },
annotations: write,
_meta: sharedVisibility,
@@ -803,16 +803,16 @@ export function registerTestingAgentTools(server: McpServer, devices: TestingDev
registerAppTool(server, "mobile_testing_agent_state", {
title: "Read the agent recording",
- description: "Read the agent recording's status and steps. The Testing panel polls this and adopts the steps as they arrive.",
+ description: "Read the agent recording's status and steps. The Testing Studio panel polls this and adopts the steps as they arrive.",
inputSchema: {},
annotations: read,
_meta: appVisibility,
}, safe(() => dataResult({ ...recordings.state(), storedTestsRevision: storedTestsChangeRevision(), projectRequest: recordings.panelProjectRequest() })));
registerAppTool(server, "mobile_testing_set_context", {
- title: "Report the Testing panel's selection",
+ title: "Report the Testing Studio panel's selection",
description:
- "Tell the server which project, device and bundle id the Testing panel has selected, so an agent recording has something to record against. The panel calls this whenever the selection changes; nothing is ever inferred from the server's own working directory.",
+ "Tell the server which project, device and bundle id the Testing Studio panel has selected, so an agent recording has something to record against. The panel calls this whenever the selection changes; nothing is ever inferred from the server's own working directory.",
inputSchema: {
projectPath: z.string().max(4096),
deviceId: deviceIdSchema.or(z.literal("")),
diff --git a/packages/core/src/testing-device.ts b/packages/core/src/testing-device.ts
index e9aff2ff..771c0259 100644
--- a/packages/core/src/testing-device.ts
+++ b/packages/core/src/testing-device.ts
@@ -8,7 +8,7 @@ import { bundledE2eRoot } from "./e2e-runtime.ts";
import { captureServerError } from "./telemetry.ts";
/**
- * The element tree the Testing panel's recorder names selectors from: the one the `e2e` runner
+ * The element tree the Testing Studio panel's recorder names selectors from: the one the `e2e` runner
* will query when it runs the recorded test.
*
* The recorder used to read the macOS accessibility API through Baguette and translate its role
@@ -137,7 +137,7 @@ async function loadProjection(projectPath: string): Promise {
/**
* The project's projection when it loads, else the bundled runtime's. A project on an e2e version
- * Studio was not built against still runs its tests with its own CLI; only the recorder's tree
+ * Testing Studio was not built against still runs its tests with its own CLI; only the recorder's tree
* reading drops back to the pinned copy, so recording keeps working instead of refusing.
*/
async function loadProjectionWithFallback(runtimeRoot: string): Promise {
diff --git a/packages/core/src/testing-drafts.ts b/packages/core/src/testing-drafts.ts
index c0eae6cc..c4970902 100644
--- a/packages/core/src/testing-drafts.ts
+++ b/packages/core/src/testing-drafts.ts
@@ -25,7 +25,7 @@ function sameProject(left: string, right: string): boolean {
}
/**
- * The recordings the Testing panel has not written into a project yet.
+ * The recordings the Testing Studio panel has not written into a project yet.
*
* One file per draft, named by its id, the same shape `RecordingStore` uses for performance
* recordings: a draft is read and replaced whole, and a file per draft means a delete is an
diff --git a/packages/core/src/testing-projects.ts b/packages/core/src/testing-projects.ts
index 2d30c901..18801590 100644
--- a/packages/core/src/testing-projects.ts
+++ b/packages/core/src/testing-projects.ts
@@ -11,7 +11,7 @@ import { discoverTestingTargets } from "./testing-target-discovery.ts";
import type { ForegroundTestingTarget } from "./testing-target-discovery.ts";
/**
- * The projects the Testing panel can record against: folders holding an `e2e.config.ts`. The user
+ * The projects the Testing Studio panel can record against: folders holding an `e2e.config.ts`. The user
* always picks one explicitly — the server's own cwd is never assumed to be a project, because the
* host launches the server from wherever it likes and a wrong guess would write a test file into a
* folder the user never chose.
@@ -81,7 +81,7 @@ function timestamp(value: unknown): string {
}
/**
- * The workspace Studio records against when no project is open: an empty folder in Mobile Dev's
+ * The workspace Testing Studio records against when no project is open: an empty folder in Mobile Dev's
* private state. It has no e2e config, so the bundled runtime owns it and its tests stay in Mobile
* Dev. Only the host can name it, so the panel asks the server instead of guessing a path.
*/
@@ -91,10 +91,10 @@ export function studioWorkspacePath(): string {
}
/**
- * Whether a chat's working directory is a mobile project the Testing panel can work in: a project
+ * Whether a chat's working directory is a mobile project the Testing Studio panel can work in: a project
* the panel already lists, or a folder carrying a project marker (a package manifest, an Expo
* config, an e2e config, a native iOS or Android project). A scratch folder holds none of these, so
- * it is not a project and the panel records in No project (Studio) instead.
+ * it is not a project and the panel records in No project (Testing Studio) instead.
*/
export async function isChatProject(directory: string, known: readonly { path: string }[] = []): Promise {
const path = normalize(directory.trim());
@@ -170,7 +170,7 @@ export async function inspectProject(projectPath: string, foreground?: Foregroun
const discovered = await discoverTestingTargets(path, foreground);
const reason = !configPath ? "No e2e config is present."
: compatibleTargets.length === 0 ? "The project config has no compatible mobile target."
- : "The project-local e2e runtime is missing or incompatible with this Studio version.";
+ : "The project-local e2e runtime is missing or incompatible with this Mobile Dev version.";
return {
path, name: basename(path) || path, configPath: configPath ?? "", targets: discovered.targets,
runtimeMode: "bundled", runtime: await bundledRuntimeDescriptor(reason), setupState: "available",
@@ -368,7 +368,7 @@ export async function resolveTestRunPaths(projectPath: string, relativePath: str
*/
/**
* Moves whenever a stored test or its pinned app changes on disk, by any writer: the panel, an
- * agent's `branch_line`, `set_target`, `wait_for_app` pins, a save. The Testing panel's poll reads it
+ * agent's `branch_line`, `set_target`, `wait_for_app` pins, a save. The Testing Studio panel's poll reads it
* so it reloads what it shows without the user reselecting the test.
*/
let storedTestsRevision = 0;
@@ -405,7 +405,7 @@ export interface StoredTest {
}
/**
- * The app a Studio test runs against, kept beside the test and never inside its source.
+ * The app a Testing Studio test runs against, kept beside the test and never inside its source.
* `platform` and `bundleId` are the app it was recorded or first pinned against; `apps` holds the
* app id the user added for the other platform, so the same test can run there too.
*/
@@ -448,7 +448,7 @@ async function changeTargets(root: string, change: (targets: Record {
diff --git a/packages/core/src/testing-run.ts b/packages/core/src/testing-run.ts
index 8c25c860..2bb9a558 100644
--- a/packages/core/src/testing-run.ts
+++ b/packages/core/src/testing-run.ts
@@ -203,7 +203,7 @@ const PROGRESS_TAG = "@@mobile-dev-step ";
*/
export function progressConfigSource(configPath: string, projectRoot?: string): string {
return [
- `// Generated by the mobile-dev Testing panel for one run, then deleted. Do not edit or commit.`,
+ `// Generated by the mobile-dev Testing Studio panel for one run, then deleted. Do not edit or commit.`,
`import base from ${JSON.stringify(pathToFileURL(configPath).href)};`,
...(projectRoot ? [`import { isAbsolute, resolve as resolvePath } from "node:path";`] : []),
``,
@@ -407,7 +407,7 @@ export function runnerEnv(environment: NodeJS.ProcessEnv = process.env, stateDir
}
/**
- * The state directory bundled (Studio) runs use: the app's own, never agent-device's default
+ * The state directory bundled (Testing Studio) runs use: the app's own, never agent-device's default
* `~/.agent-device`. That default is shared with every other agent-device user on the machine, and two
* daemons racing to register there produce "Daemon registration ownership could not be verified" until
* the folder is deleted. The bundled runner is the same build as the app's own clients, so sharing the
@@ -681,7 +681,7 @@ async function runBundledTest(request: TestRunRequest, deps: TestRunDeps): Promi
if (!request.runtime || !request.bundledTarget) throw new ExpectedOperationError("invalid_input", "Choose the mirrored app before running in bundled mode.");
const source = request.untilSource ?? await readFile(join(request.projectPath, request.relativePath), "utf8");
if (requiresModel(source) && !request.model)
- throw new ExpectedOperationError("invalid_input", "This test contains agent steps. Choose a provider and model in Testing, then run it again.");
+ throw new ExpectedOperationError("invalid_input", "This test contains agent steps. Choose a provider and model in Testing Studio, then run it again.");
const requiredKey = request.model?.provider === "vercel" ? "AI_GATEWAY_API_KEY" : request.model?.provider === "openrouter" ? "OPENROUTER_API_KEY" : undefined;
if (requiredKey && !process.env[requiredKey]) throw new ExpectedOperationError("invalid_input", `${requiredKey} is not set. Add it to Mobile Dev's environment, then run again.`);
await deps.release?.();
diff --git a/packages/core/src/testing-tools.ts b/packages/core/src/testing-tools.ts
index 67e18a8c..2b0cdaf6 100644
--- a/packages/core/src/testing-tools.ts
+++ b/packages/core/src/testing-tools.ts
@@ -29,15 +29,15 @@ import type { SetupOptions } from "./testing-setup.ts";
const read = { readOnlyHint: true, destructiveHint: false, openWorldHint: false };
const write = { readOnlyHint: false, destructiveHint: false, openWorldHint: false };
const destructive = { readOnlyHint: false, destructiveHint: true, openWorldHint: false };
-/** The Testing panel drives these itself; the model has its own e2e MCP server for test work. */
+/** The Testing Studio panel drives these itself; the model has its own e2e MCP server for test work. */
const appVisibility = { ui: { visibility: ["app"] as ("app" | "model")[] } };
/**
- * The tools an agent drives No project (Studio) mode with: run, progress, cancel, pin an app,
+ * The tools an agent drives No project (Testing Studio) mode with: run, progress, cancel, pin an app,
* read a test, list tests, branch a line, wait for an app. The panel calls them too.
*/
const sharedVisibility = { ui: { visibility: ["app", "model"] as ("app" | "model")[] } };
-/** What the Testing tab has told the server; see `TestingAgentRecordings.setPanelProject`. */
+/** What the Testing Studio tab has told the server; see `TestingAgentRecordings.setPanelProject`. */
export interface PanelContext {
panelProjectPath(): string | undefined;
/** Like `panelProjectPath`, but waits out the panel's first report when the tab was only just opened. */
@@ -96,7 +96,7 @@ export function projectLaneTargets(targets: readonly { name: string; platform?:
return chosen;
}
-/** The Testing panel's project selection, and the device tree its recorder names selectors from. */
+/** The Testing Studio panel's project selection, and the device tree its recorder names selectors from. */
/** Returns the shutdown the plugin has to run: the recorder's device session, handed back. */
export function registerTestingTools(server: McpServer, projects: TestingProjectChoices, devices = new TestingDevices(), drafts = new TestDraftStore(), matrix: { ops?: DeviceOps; registry?: MatrixRegistry; run?: typeof runRecordedTest; panel?: PanelContext; pollMs?: number; failureReadMs?: number } = {}): () => Promise {
/**
@@ -112,9 +112,9 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
void projects.list().then(list => Promise.all(list.map(entry => sweepLaneFiles(entry.path)))).catch(() => undefined);
const runTest = matrix.run ?? runRecordedTest;
/**
- * The project a model-visible tool works on. With a panel, the Testing tab must have reported a
+ * The project a model-visible tool works on. With a panel, the Testing Studio tab must have reported a
* project — that is the only proof the user has it open — and a call that names none defaults to
- * it, so the agent never needs to know where Studio lives.
+ * it, so the agent never needs to know where Testing Studio lives.
*/
const panel = matrix.panel;
async function resolveProject(selected?: string): Promise {
@@ -124,13 +124,13 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
}
// Right after an agent opened the tab its first heartbeat may not have arrived; wait for it.
const current = await panel.awaitPanelProject?.() ?? panel.panelProjectPath();
- if (!current) throw new ExpectedOperationError("invalid_input", "The Testing tab is not open, so there is no project to work on. If no Mobile Dev panel is showing in this chat, open it once with mobile_open_simulator (workspaceTool \"testing\"), then try again; if you already opened one, do not open another (each call adds a panel) and ask the user to show the existing panel and its Testing tab.");
+ if (!current) throw new ExpectedOperationError("invalid_input", "The Testing Studio tab is not open, so there is no project to work on. If no Mobile Dev panel is showing in this chat, open it once with mobile_open_simulator (workspaceTool \"testing\"), then try again; if you already opened one, do not open another (each call adds a panel) and ask the user to show the existing panel and its Testing Studio tab.");
return selected ?? current;
}
const matrixWire = (run: MatrixRun) => ({ ...snapshotMatrix(run), running: run.lanes.some(lane => !["passed", "failed", "cancelled", "error"].includes(lane.state)) });
registerAppTool(server, "mobile_testing_projects", {
title: "List testing projects",
- description: "List the e2e project folders the Testing panel can record against, most recent first, and the private Studio workspace it uses when no project is open.",
+ description: "List the e2e project folders the Testing Studio panel can record against, most recent first, and the private Testing Studio workspace it uses when no project is open.",
inputSchema: {},
annotations: read,
_meta: appVisibility,
@@ -139,7 +139,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
registerAppTool(server, "mobile_testing_choose_project", {
title: "Choose a testing project",
description:
- "Choose the project the Testing panel records against: pass projectPath to select one the panel already lists, or nothing to open the system folder picker. The folder must hold an e2e.config.ts. The choice persists across sessions.",
+ "Choose the project the Testing Studio panel records against: pass projectPath to select one the panel already lists, or nothing to open the system folder picker. The folder must hold an e2e.config.ts. The choice persists across sessions.",
inputSchema: { projectPath: projectPath.optional() },
annotations: write,
_meta: appVisibility,
@@ -157,7 +157,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
relativePath: z.string().min(1).max(512).describe("Path under the project, inside tests/, ending in .e2e.ts."),
contents: z.string().max(256 * 1024),
overwrite: z.boolean().optional(),
- platform: z.enum(["ios", "android"]).optional().describe("With bundleId: the app a Studio test is pinned to. Stored beside the test, never in its source."),
+ platform: z.enum(["ios", "android"]).optional().describe("With bundleId: the app a Testing Studio test is pinned to. Stored beside the test, never in its source."),
bundleId: z.string().min(1).max(512).optional(),
},
// Replacing someone's test file is destructive, so the host asks before this runs.
@@ -167,7 +167,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
const project = await inspectProject(selected);
const result = await writeTestFile(selected, relativePath, contents, overwrite ?? false);
if (result.written && platform && bundleId) await writeTestTarget(selected, relativePath, { platform, bundleId });
- const shownPath = project.runtimeMode === "bundled" ? `Studio/${relativePath}` : result.path;
+ const shownPath = project.runtimeMode === "bundled" ? `Testing Studio/${relativePath}` : result.path;
return dataResult({ ...result, path: shownPath, storageMode: project.runtimeMode }, result.written ? `Saved ${shownPath}` : `${shownPath} already exists.`);
}));
@@ -181,7 +181,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
*/
registerAppTool(server, "mobile_testing_tests", {
title: "List the project's tests",
- description: "List the .e2e.ts files already in the project's tests/ folder, newest first. Each carries the app it is pinned to: target.platform and target.bundleId for the app it was recorded against, and target.apps for the app added on the other platform. projectPath defaults to the Testing tab's project.",
+ description: "List the .e2e.ts files already in the project's tests/ folder, newest first. Each carries the app it is pinned to: target.platform and target.bundleId for the app it was recorded against, and target.apps for the app added on the other platform. projectPath defaults to the Testing Studio tab's project.",
inputSchema: { projectPath: projectPath.optional() },
annotations: read,
_meta: sharedVisibility,
@@ -190,7 +190,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
registerAppTool(server, "mobile_testing_read_file", {
title: "Preview a project test",
- description: "Read the source of one .e2e.ts file in the project's tests/ folder. Lines are numbered from 1; the line numbers in a failed run's steps and failure refer to this source. projectPath defaults to the Testing tab's project.",
+ description: "Read the source of one .e2e.ts file in the project's tests/ folder. Lines are numbered from 1; the line numbers in a failed run's steps and failure refer to this source. projectPath defaults to the Testing Studio tab's project.",
inputSchema: { projectPath: projectPath.optional(), relativePath: z.string().min(1).max(512) },
annotations: read,
_meta: sharedVisibility,
@@ -375,15 +375,15 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
}));
registerAppTool(server, "mobile_testing_set_target", {
- title: "Pin a Studio test to an app",
- description: "Store the app (platform and bundle id) a saved Studio test runs against. Only Studio tests carry one; a project test keeps using its config's target. With mode add, the app is added for its platform and the app the test was recorded against stays: use it to give a test the app for its other platform, with the bundleId mobile_testing_wait_for_app returned. Returns the app id pinned. projectPath defaults to the Testing tab's project.",
+ title: "Pin a Testing Studio test to an app",
+ description: "Store the app (platform and bundle id) a saved Testing Studio test runs against. Only Testing Studio tests carry one; a project test keeps using its config's target. With mode add, the app is added for its platform and the app the test was recorded against stays: use it to give a test the app for its other platform, with the bundleId mobile_testing_wait_for_app returned. Returns the app id pinned. projectPath defaults to the Testing Studio tab's project.",
inputSchema: { projectPath: projectPath.optional(), relativePath: z.string().min(1).max(512), platform: z.enum(["ios", "android"]), bundleId: z.string().min(1).max(512), mode: z.enum(["replace", "add"]).optional() },
annotations: write,
_meta: sharedVisibility,
}, safe(async ({ projectPath: selected, relativePath, platform, bundleId, mode }: { projectPath?: string; relativePath: string; platform: "ios" | "android"; bundleId: string; mode?: "replace" | "add" }) => {
const pinned = await writeTestTarget(await resolveProject(selected), relativePath, { platform, bundleId }, mode);
return dataResult({ pinned, ...(pinned ? { added: { platform, bundleId, mode: mode ?? "replace" } } : {}) },
- pinned ? `Pinned ${platform} ${bundleId} to ${relativePath} (${mode ?? "replace"}).` : "Only Studio tests carry a pinned app; nothing was changed.");
+ pinned ? `Pinned ${platform} ${bundleId} to ${relativePath} (${mode ?? "replace"}).` : "Only Testing Studio tests carry a pinned app; nothing was changed.");
}));
const modelSchema = z.object({
@@ -395,7 +395,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
/** Everything a run needs before a device is chosen: the same for a single run and for every lane. */
async function prepareRequest(input: RunInput) {
const { projectPath: selected, relativePath, configPath, timeoutMs, target, pin, model, untilSource } = input;
- // A Studio test remembers its app, so a caller that names none runs the one it was pinned to.
+ // A Testing Studio test remembers its app, so a caller that names none runs the one it was pinned to.
let { platform, bundleId } = input;
if (!(platform && bundleId)) {
const stored = await readTestTarget(selected, relativePath).catch(() => undefined);
@@ -458,7 +458,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
registerAppTool(server, "mobile_testing_run_test", {
title: "Run a recorded test",
description:
- "Run one saved test and report each step with the line it came from. Blocks until the run ends; for a long test, or to choose the device, start it with mobile_testing_run_matrix and read mobile_testing_run_progress. Without platform and bundleId a Studio test runs the app it is pinned to. The recorder's device session is released first. A failed run carries `failure`: the failing line, its error and, when the device can be read, its screen as locator rows to pick from. projectPath defaults to the Testing tab's project.",
+ "Run one saved test and report each step with the line it came from. Blocks until the run ends; for a long test, or to choose the device, start it with mobile_testing_run_matrix and read mobile_testing_run_progress. Without platform and bundleId a Testing Studio test runs the app it is pinned to. The recorder's device session is released first. A failed run carries `failure`: the failing line, its error and, when the device can be read, its screen as locator rows to pick from. projectPath defaults to the Testing Studio tab's project.",
inputSchema: {
projectPath: projectPath.optional(),
relativePath: z.string().min(1).max(512).describe("The test to run, relative to the project, e.g. tests/a-recorded-flow.e2e.ts."),
@@ -503,7 +503,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
registerAppTool(server, "mobile_testing_run_matrix", {
title: "Run a recorded test on several devices",
description:
- "Run one saved test on several devices at once, one independent lane per device (iOS and Android can be mixed), and return a matrixId immediately; read progress with mobile_testing_run_progress. At most `limit` lanes run at once (default 3, max 8); the rest are queued. Devices that are off are booted. In bundled mode a device missing the app gets it installed by copying it from another booted device that has it (one in the run first); otherwise that lane fails with \"App not installed\"; `apps` defaults to the apps the test is pinned to, and a platform with no app is refused, naming the fix. In a project with its own e2e config each lane runs the config's target for the device's platform (or `targets`) on that device, a device missing the app gets it copied the same way, and the target's engine must be a direct mobile(...) call. A failure on one device does not stop the others, and its lane carries `failure` (line, error, screen). projectPath defaults to the Testing tab's project.",
+ "Run one saved test on several devices at once, one independent lane per device (iOS and Android can be mixed), and return a matrixId immediately; read progress with mobile_testing_run_progress. At most `limit` lanes run at once (default 3, max 8); the rest are queued. Devices that are off are booted. In bundled mode a device missing the app gets it installed by copying it from another booted device that has it (one in the run first); otherwise that lane fails with \"App not installed\"; `apps` defaults to the apps the test is pinned to, and a platform with no app is refused, naming the fix. In a project with its own e2e config each lane runs the config's target for the device's platform (or `targets`) on that device, a device missing the app gets it copied the same way, and the target's engine must be a direct mobile(...) call. A failure on one device does not stop the others, and its lane carries `failure` (line, error, screen). projectPath defaults to the Testing Studio tab's project.",
inputSchema: {
projectPath: projectPath.optional(),
relativePath: z.string().min(1).max(512).describe("The test to run, relative to the project."),
@@ -630,10 +630,10 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
registerAppTool(server, "mobile_testing_branch_line", {
title: "Give one line its own locator for one platform",
description:
- "Repair a Studio test for one platform: replace the locator on one line with `locator` on `platform` only, keeping the old locator for the other platform (`platform === \"android\" ? new : old`). The assertion or action on the line is never changed, and only the locator is. Take `locator` from a failed run's `failure.elements`, e.g. screen.getByText(\"Home\"). Writes the test and returns the new source; refuses, naming why, when the line cannot be rewritten with certainty (a multi-line call, no locator on the line). projectPath defaults to the Testing tab's project.",
+ "Repair a Testing Studio test for one platform: replace the locator on one line with `locator` on `platform` only, keeping the old locator for the other platform (`platform === \"android\" ? new : old`). The assertion or action on the line is never changed, and only the locator is. Take `locator` from a failed run's `failure.elements`, e.g. screen.getByText(\"Home\"). Writes the test and returns the new source; refuses, naming why, when the line cannot be rewritten with certainty (a multi-line call, no locator on the line). projectPath defaults to the Testing Studio tab's project.",
inputSchema: {
projectPath: projectPath.optional(),
- relativePath: z.string().min(1).max(512).describe("The Studio test, e.g. tests/checkout.e2e.ts."),
+ relativePath: z.string().min(1).max(512).describe("The Testing Studio test, e.g. tests/checkout.e2e.ts."),
line: z.number().int().min(1).max(100_000).describe("The 1-based line of the failing step, from the run's failure.line."),
platform: z.enum(["ios", "android"]).describe("The platform whose run failed. The other platform keeps its locator."),
locator: z.string().min(1).max(1000).describe("A single screen.getBy… locator expression."),
@@ -642,7 +642,7 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
_meta: sharedVisibility,
}, safe(async ({ projectPath: selected, relativePath, line, platform, locator }: { projectPath?: string; relativePath: string; line: number; platform: "ios" | "android"; locator: string }) => {
const project = await resolveProject(selected);
- if ((await inspectProject(project)).runtimeMode !== "bundled") throw new ExpectedOperationError("invalid_input", "Branching a line is for Studio tests; edit a project test in its own file.");
+ if ((await inspectProject(project)).runtimeMode !== "bundled") throw new ExpectedOperationError("invalid_input", "Branching a line is for Testing Studio tests; edit a project test in its own file.");
if (!singleExpression(locator) || !locator.startsWith("screen.")) throw new ExpectedOperationError("invalid_input", "locator must be one screen.getBy… expression on a single line.");
const source = await readTestFile(project, relativePath);
const next = branchStoredStepLocator(source, line, platform, locator);
diff --git a/packages/core/test/mobile-dev-skill.test.ts b/packages/core/test/mobile-dev-skill.test.ts
index e405198b..7c31a915 100644
--- a/packages/core/test/mobile-dev-skill.test.ts
+++ b/packages/core/test/mobile-dev-skill.test.ts
@@ -16,13 +16,13 @@ test("the testing skill records, hands over, and never saves or runs", async ()
const skill = await readFile(new URL("../../skills/mobile-dev-testing/SKILL.md", import.meta.url), "utf8");
assert.match(skill, /iOS or Android app/);
- assert.match(skill, /Testing tab must be open/);
+ assert.match(skill, /Testing Studio tab must be open/);
assert.match(skill, /Never ask the user for a project, device or target up front/);
// A closed tab is the agent's to open, not the user's.
assert.match(skill, /mobile_open_simulator\(\{ workspaceTool: "testing", projectPath \}\)/);
assert.match(skill, /Always pass `projectPath`: your workspace root/, "the tab follows the chat's project");
assert.match(skill, /Do not ask the user to open it/);
- assert.doesNotMatch(skill, /tell the user to \*\*open Mobile Dev's Testing tab\*\*/);
+ assert.doesNotMatch(skill, /tell the user to \*\*open Mobile Dev's Testing Studio tab\*\*/);
// The loop, in the order the tools enforce it.
assert.match(skill, /mobile_testing_agent_begin.*mobile_testing_agent_screen.*mobile_testing_agent_step.*mobile_testing_agent_finish/s);
@@ -37,7 +37,7 @@ test("the testing skill records, hands over, and never saves or runs", async ()
assert.match(skill, /\*\*Never save\*\* a project's test/);
assert.match(skill, /\*\*Never run the test\*\* while recording/);
// And the handover, which is the whole deliverable: the user adjusts and saves.
- assert.match(skill, /in the Testing panel, unsaved/);
+ assert.match(skill, /in the Testing Studio panel, unsaved/);
});
test("the testing skill says where a flow ends, not only where it starts", async () => {
@@ -65,10 +65,10 @@ test("the testing skill ships from every plugin that has the panel", async () =>
assert.ok(claude.skills.includes("../../packages/skills/mobile-dev-testing"), "Claude Code");
});
-test("the testing skill teaches Studio mode: record saves, run, add the missing app, repair by locator only", async () => {
+test("the testing skill teaches Testing Studio mode: record saves, run, add the missing app, repair by locator only", async () => {
const skill = await readFile(new URL("../../skills/mobile-dev-testing/SKILL.md", import.meta.url), "utf8");
- assert.match(skill, /## Studio mode: record, run, repair/);
+ assert.match(skill, /## Testing Studio mode: record, run, repair/);
// The tab must be open, and the agent opens it itself rather than guessing a project.
assert.match(skill, /open it yourself with `mobile_open_simulator\(\{ workspaceTool: "testing", projectPath \}\)`/);
// Record now saves, and says where.
diff --git a/packages/core/test/plugin.test.ts b/packages/core/test/plugin.test.ts
index fa82e169..b0fc5e5a 100644
--- a/packages/core/test/plugin.test.ts
+++ b/packages/core/test/plugin.test.ts
@@ -42,7 +42,7 @@ test("opening tools accept optional intent and preserve it in their results", as
}
for (const name of ["mobile_open_simulator", "mobile_open_workspace"]) {
const testing = await client.callTool({ name, arguments: { workspaceTool: "testing" } });
- assert.equal(testing.isError, undefined, "the Testing tab is a valid thing to open on");
+ assert.equal(testing.isError, undefined, "the Testing Studio tab is a valid thing to open on");
assert.deepEqual(testing.structuredContent?.panelTarget, { workspaceTool: "testing" });
}
const appIntel = await client.callTool({ name: "mobile_open_app_intel", arguments: {} });
diff --git a/packages/core/test/testing-agent-panel.test.ts b/packages/core/test/testing-agent-panel.test.ts
index 7bfae8d2..9e6ccb61 100644
--- a/packages/core/test/testing-agent-panel.test.ts
+++ b/packages/core/test/testing-agent-panel.test.ts
@@ -12,7 +12,7 @@ function step(id: string, label: string) {
}
/**
- * The Testing panel over a host whose tool calls are answered from a script.
+ * The Testing Studio panel over a host whose tool calls are answered from a script.
*
* `agent` is the state the server would report, which the test moves between polls; everything
* else answers with the empty shape the panel copes with, so the test is about the agent recording
@@ -68,7 +68,7 @@ test("the panel reports its selection, and only when it changes", async t => {
assert.equal(context().length, before, "an unchanged selection is not reported again");
});
-test("a session the agent starts opens the Testing tab and adopts its steps live", async t => {
+test("a session the agent starts opens the Testing Studio tab and adopts its steps live", async t => {
const { panel, agent, tick, testRecorder } = await panelEnvironment(t);
let opened = 0;
panel.onAgentRecordingStarted(() => { opened += 1; });
@@ -212,7 +212,7 @@ test("the panel's own run is never taken over by the poll", async t => {
assert.equal(panel.getSnapshot().matrix, null);
});
-test("a recording the agent saved in Studio refreshes the test list instead of adopting a draft", async t => {
+test("a recording the agent saved in Testing Studio refreshes the test list instead of adopting a draft", async t => {
const { panel, agent, tick, calls, testRecorder } = await panelEnvironment(t);
panel.setAvailable(true);
await tick();
@@ -224,7 +224,7 @@ test("a recording the agent saved in Studio refreshes the test list instead of a
await (panel as any).readAgentState();
await tick();
assert.equal(panel.getSnapshot().agent.savedPath, "tests/t.e2e.ts");
- assert.equal(panel.getSnapshot().savedPath, "Studio/tests/t.e2e.ts");
+ assert.equal(panel.getSnapshot().savedPath, "Testing Studio/tests/t.e2e.ts");
assert.equal(panel.getSnapshot().draftId, "", "there is no draft: the test is saved");
assert.ok(calls.filter(entry => entry.name === "mobile_testing_tests").length > before, "the stored list is read again so the test appears");
assert.equal(testRecorder.getSnapshot().recordingDeviceId, "");
@@ -329,7 +329,7 @@ test("an agent's No project request beats the last-used project when the panel o
env.panel.setAvailable(true);
await new Promise(resolve => setTimeout(resolve, 200));
await settled(env.panel, "/studio");
- assert.equal(env.calls.some(entry => entry.name === "mobile_testing_choose_project"), false, "Studio is not a folder to record");
+ assert.equal(env.calls.some(entry => entry.name === "mobile_testing_choose_project"), false, "Testing Studio is not a folder to record");
});
test("an agent's No project request switches a panel already on another project, once", async t => {
diff --git a/packages/core/test/testing-agent.test.ts b/packages/core/test/testing-agent.test.ts
index e2880964..650491a6 100644
--- a/packages/core/test/testing-agent.test.ts
+++ b/packages/core/test/testing-agent.test.ts
@@ -76,7 +76,7 @@ test("a recording refuses to start when the panel has nothing selected", async (
const recordings = new TestingAgentRecordings(devices);
// No project and no device is not something to pick for the user: the project picker is an OS
// folder dialog, which must not open inside an agent's turn.
- await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /The Testing tab is not open\. If no Mobile Dev panel is showing in this chat, call mobile_open_simulator with workspaceTool "testing" once.*do not open another/);
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /The Testing Studio tab is not open\. If no Mobile Dev panel is showing in this chat, call mobile_open_simulator with workspaceTool "testing" once.*do not open another/);
recordings.setPanelProject("/project");
await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /Boot an iOS simulator or Android emulator and mirror it/);
assert.equal(recordings.state().status, "idle");
@@ -244,7 +244,7 @@ test("a selection the panel cannot act on clears the context rather than half-se
registerTestingAgentTools(server, devices, recordings);
recordings.setContext(CONTEXT);
recordings.clearContext();
- await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /Testing tab/);
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /Testing Studio tab/);
});
test("the five model tools are visible to the model and the panel's two are not", () => {
diff --git a/packages/core/test/testing-chat-project.test.ts b/packages/core/test/testing-chat-project.test.ts
index e69fcc52..5125edd8 100644
--- a/packages/core/test/testing-chat-project.test.ts
+++ b/packages/core/test/testing-chat-project.test.ts
@@ -33,7 +33,7 @@ test("a folder is a project only when it carries a project marker", async () =>
assert.equal(await isChatProject(empty), false, "a scratch folder is not a project");
assert.equal(await isChatProject(join(root, "missing")), false);
assert.equal(await isChatProject("relative/path"), false);
- assert.equal(await isChatProject(studioWorkspacePath()), false, "Studio's own workspace is No project");
+ assert.equal(await isChatProject(studioWorkspacePath()), false, "Testing Studio's own workspace is No project");
const expo = join(root, "expo"); await mkdir(expo);
await writeFile(join(expo, "package.json"), "{}");
@@ -56,7 +56,7 @@ test("an agent's project request is held for the panel until it reports that pro
const rec = recordings(clock);
assert.equal(rec.panelProjectRequest(), null, "nothing asked: the panel keeps its own selection");
rec.requestPanelProject();
- assert.deepEqual(rec.panelProjectRequest(), { id: 1, path: studioWorkspacePath() }, "no project asks for Studio");
+ assert.deepEqual(rec.panelProjectRequest(), { id: 1, path: studioWorkspacePath() }, "no project asks for Testing Studio");
rec.setPanelProject("/work/expoapp57");
assert.equal(rec.unmetProjectRequest(), studioWorkspacePath(), "the old project is not the requested one");
setTimeout(() => rec.setPanelProject(studioWorkspacePath()), 100);
@@ -92,7 +92,7 @@ async function openPlugin(t: test.TestContext, roots?: string[]) {
return { open, request, client };
}
-test("opening the Testing tab for a chat with no project asks for No project", async t => {
+test("opening the Testing Studio tab for a chat with no project asks for No project", async t => {
await scratch(async root => {
const folder = join(root, "Codex/2026-11-18/use"); await mkdir(folder, { recursive: true });
const { open, request } = await openPlugin(t);
@@ -105,7 +105,7 @@ test("opening the Testing tab for a chat with no project asks for No project", a
});
});
-test("opening the Testing tab for a chat with a project asks for that project", async t => {
+test("opening the Testing Studio tab for a chat with a project asks for that project", async t => {
await scratch(async root => {
const project = join(root, "my-app"); await mkdir(project);
await writeFile(join(project, "package.json"), "{}");
@@ -145,7 +145,7 @@ test("a repeat open tells the agent the panel is already there, because the host
assert.match(texts(await open({ projectPath: "" })), /already opened in this chat.*Do not open more/s);
// Once the tab heartbeats, the warning says it is live.
await client.callTool({ name: "mobile_testing_set_context", arguments: { projectPath: studioWorkspacePath(), deviceId: "", bundleId: "" } });
- assert.match(texts(await open({ projectPath: "" })), /already open in this chat and the Testing tab is reporting/);
+ assert.match(texts(await open({ projectPath: "" })), /already open in this chat and the Testing Studio tab is reporting/);
});
});
diff --git a/packages/core/test/testing-panel-ui.test.ts b/packages/core/test/testing-panel-ui.test.ts
index 8f5d0fdd..adc3b95d 100644
--- a/packages/core/test/testing-panel-ui.test.ts
+++ b/packages/core/test/testing-panel-ui.test.ts
@@ -189,9 +189,9 @@ test("a run marks the preview line by line, and marks nothing it was not told ab
const preview = () => (dom.window.document.querySelector("[data-testing-preview]") as HTMLElement).innerText
?? dom.window.document.querySelector("[data-testing-preview]")!.textContent!;
- assert.equal(dom.window.document.querySelector("[aria-label=Testing] dl"), null,
+ assert.equal(dom.window.document.querySelector("[aria-label='Testing Studio'] dl"), null,
"project, config, target, bundle and device metadata no longer duplicate the controls");
- const testing = dom.window.document.querySelector("[aria-label=Testing]");
+ const testing = dom.window.document.querySelector("[aria-label='Testing Studio']");
assert.ok(testing?.className.includes("cursor-pointer"), "testing panel buttons use a pointer cursor");
// The title and file name fields are folded into Test Description: they are touched once per
// recording, at the end, while the step list beside them is touched on every tap.
@@ -233,7 +233,7 @@ test("a run marks the preview line by line, and marks nothing it was not told ab
assert.match(workspace.textContent ?? "", /Preview.*Test Description.*Steps/s,
"the recorder is organized around preview, naming and steps");
await act(async () => { description.click(); });
- const header = dom.window.document.querySelector("[aria-label=Testing] > header")!;
+ const header = dom.window.document.querySelector("[aria-label='Testing Studio'] > header")!;
assert.ok(header.contains(dom.window.document.querySelector("[data-testing-controls]")),
"record and run controls share the project and launch bar");
@@ -569,6 +569,12 @@ test("the agentic branches cascade to the side, and record a sentence with its p
});
/** A `TestingPanel` stub for the view: enough snapshot for the controls, no server behind it. */
+/** Opens one E2E setup section by its title; every section starts collapsed. */
+async function openSection(act: (callback: () => Promise) => Promise, doc: Document, title: string) {
+ const toggle = [...doc.querySelectorAll('[data-slot="collapsible-trigger"]')].find(el => el.textContent?.startsWith(title) && el.getAttribute("data-state") !== "open") as HTMLElement | undefined;
+ if (toggle) await act(async () => { toggle.click(); });
+}
+
function panelStub(overrides: Record = {}) {
const listeners = new Set<() => void>();
const state: Record = {
@@ -764,7 +770,7 @@ test("the list keeps what is not stored above what the project holds, and asks b
testRecorder.clearSteps();
});
-test("bundled tests are labeled In Studio and configured projects show read-only setup", async t => {
+test("bundled tests are labeled In Testing Studio and configured projects show read-only setup", async t => {
const { module: { TestingView }, dom, onTeardown } = await renderEnvironment(t, {
exports: 'export { TestingView } from "./packages/ui/src/components/testing-view.tsx";', slug: "testing-setup-modes",
});
@@ -778,6 +784,8 @@ test("bundled tests are labeled In Studio and configured projects show read-only
} });
await act(async () => { root.render(createElement(TestingView, { panel: configured, deviceApps })); });
assert.match(dom.window.document.body.textContent ?? "", /E2E setup/);
+ await openSection(act, dom.window.document, "Project");
+ await openSection(act, dom.window.document, "Mobile apps");
assert.match(dom.window.document.body.textContent ?? "", /chatgpt · gpt-6-luna/);
assert.match(dom.window.document.body.textContent ?? "", /\.mcp\.json, \.cursor\/mcp\.json/);
assert.equal(dom.window.document.querySelectorAll("[data-testing-setup]").length, 1, "model and project setup share one toolbar entry");
@@ -789,7 +797,7 @@ test("bundled tests are labeled In Studio and configured projects show read-only
tests: [{ relativePath: "tests/studio.e2e.ts", name: "studio.e2e.ts", updatedAt: "2026-01-01T00:00:00.000Z", sizeBytes: 10 }] });
await act(async () => { root.render(createElement(TestingView, { panel: bundled, deviceApps })); });
await act(async () => { (dom.window.document.querySelector("[data-testing-drafts]") as HTMLElement).click(); });
- assert.match(dom.window.document.querySelector("[data-testing-group=stored]")?.textContent ?? "", /In Studio/);
+ assert.match(dom.window.document.querySelector("[data-testing-group=stored]")?.textContent ?? "", /In Testing Studio/);
await act(async () => { root.render(createElement("div")); });
await new Promise(resolve => dom.window.requestAnimationFrame(resolve));
onTeardown(async () => { await act(async () => { root.unmount(); }); });
@@ -808,6 +816,7 @@ test("with no project open the picker says so and setup offers no project files"
await act(async () => { root.render(createElement(TestingView, { panel, deviceApps })); });
const trigger = dom.window.document.querySelector("[aria-label='Testing project']") as HTMLElement;
assert.match(trigger.textContent ?? "", /No project/);
+ await openSection(act, dom.window.document, "Project");
assert.match(dom.window.document.body.textContent ?? "", /No project open/);
assert.doesNotMatch(dom.window.document.body.textContent ?? "", /Set up project/);
await act(async () => { trigger.click(); });
@@ -818,7 +827,7 @@ test("with no project open the picker says so and setup offers no project files"
onTeardown(async () => { await act(async () => { root.unmount(); }); });
});
-test("a stored Studio test shows its pinned app and offers to re-pin it to the app in front", async t => {
+test("a stored Testing Studio test shows its pinned app and offers to re-pin it to the app in front", async t => {
const { module: { TestingView }, dom, onTeardown } = await renderEnvironment(t, {
exports: 'export { TestingView } from "./packages/ui/src/components/testing-view.tsx";', slug: "testing-pinned-app",
});
@@ -882,8 +891,11 @@ test("async project data prefills model and every discovered setup target", asyn
const signIn = [...dom.window.document.querySelectorAll("button")].find(button => button.textContent?.includes("Sign in with")) as HTMLButtonElement;
await act(async () => { signIn.click(); await Promise.resolve(); });
assert.deepEqual(opened, ["https://auth.example.test/start"], "a user-started OAuth flow auto-opens its emitted URL");
+ await openSection(act, dom.window.document, "Project");
const setUp = [...dom.window.document.querySelectorAll("button")].find(button => button.textContent?.includes("Set up project")) as HTMLButtonElement;
await act(async () => { setUp.click(); });
+ await openSection(act, dom.window.document, "Mobile apps");
+ await openSection(act, dom.window.document, "Project");
const identifiers = [...dom.window.document.querySelectorAll('[aria-label$="app identifier"]')] as HTMLInputElement[];
assert.deepEqual(identifiers.map(input => input.value), ["com.anonymous.expoapp57", "com.anonymous.expoapp57"]);
assert.deepEqual([...dom.window.document.querySelectorAll('[aria-label^="Target "][aria-label$=" name"]')].map(input => (input as HTMLInputElement).value), ["ios", "android"]);
diff --git a/packages/core/test/testing-projects.test.ts b/packages/core/test/testing-projects.test.ts
index 1a72634d..2af859a5 100644
--- a/packages/core/test/testing-projects.test.ts
+++ b/packages/core/test/testing-projects.test.ts
@@ -178,7 +178,7 @@ test("a symlinked tests folder is refused rather than followed", async () => {
} finally { await rm(root, { recursive: true, force: true }); }
});
-test("a folder without project setup saves into Studio state without modifying the project", async () => {
+test("a folder without project setup saves into Testing Studio state without modifying the project", async () => {
const { root, path } = await project();
const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
try {
@@ -197,7 +197,7 @@ test("a folder without project setup saves into Studio state without modifying t
}
});
-test("the Studio workspace needs no project: it is created on demand, bundled, and not listed as a project", async () => {
+test("the Testing Studio workspace needs no project: it is created on demand, bundled, and not listed as a project", async () => {
const { root } = await project();
const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
try {
@@ -247,7 +247,7 @@ test("every write to a stored test or its pinned app moves the change revision t
}
});
-test("a Studio test is pinned to its app beside the source, listed, re-pinned and cleared on delete", async () => {
+test("a Testing Studio test is pinned to its app beside the source, listed, re-pinned and cleared on delete", async () => {
const { root } = await project();
const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
try {
@@ -278,7 +278,7 @@ test("a Studio test is pinned to its app beside the source, listed, re-pinned an
}
});
-test("bundled mode lists only private Studio tests and never leaks project tests", async () => {
+test("bundled mode lists only private Testing Studio tests and never leaks project tests", async () => {
const root = await mkdtemp(join(tmpdir(), "testing-bundled-list-"));
const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
try {
@@ -286,7 +286,7 @@ test("bundled mode lists only private Studio tests and never leaks project tests
const selected = join(root, "selected");
await mkdir(join(selected, "tests"), { recursive: true });
await writeFile(join(selected, "tests", "project-only.e2e.ts"), SOURCE);
- assert.deepEqual(await listTestFiles(selected), [], "project files are outside bundled Studio storage");
+ assert.deepEqual(await listTestFiles(selected), [], "project files are outside bundled Testing Studio storage");
await writeTestFile(selected, "tests/studio-only.e2e.ts", SOURCE);
assert.deepEqual((await listTestFiles(selected)).map(entry => entry.relativePath), ["tests/studio-only.e2e.ts"]);
diff --git a/packages/core/test/testing-run.test.ts b/packages/core/test/testing-run.test.ts
index 24e928ef..04ba217d 100644
--- a/packages/core/test/testing-run.test.ts
+++ b/packages/core/test/testing-run.test.ts
@@ -338,7 +338,7 @@ test("the selected target reaches the runner, so an Android recording does not r
assert.deepEqual(seen.args, ["run", FILE, "--reporter", "json", "--target", "android"]);
});
-test("bundled mode runs and cleans an isolated Studio workspace", async () => {
+test("bundled mode runs and cleans an isolated Testing Studio workspace", async () => {
const root = await project();
const runnerCwd = join(await mkdtemp(join(tmpdir(), "testing-run-cwd-")), "e2e-runner");
const seen: { command?: string; args?: readonly string[]; cwd?: string } = {};
diff --git a/packages/core/test/testing-studio-agent.test.ts b/packages/core/test/testing-studio-agent.test.ts
index 8b6d1119..ef471549 100644
--- a/packages/core/test/testing-studio-agent.test.ts
+++ b/packages/core/test/testing-studio-agent.test.ts
@@ -33,7 +33,7 @@ function fakeServer() {
return { server, tools, call };
}
-/** Runs `body` with Studio's storage in a temp folder, so nothing touches the user's own tests. */
+/** Runs `body` with Testing Studio's storage in a temp folder, so nothing touches the user's own tests. */
async function withStudio(body: (studio: string) => Promise) {
const root = await mkdtemp(join(tmpdir(), "studio-agent-"));
const previous = process.env.MOBILE_DEV_TESTING_DIRECTORY;
@@ -64,13 +64,13 @@ function setup(options: { ops?: DeviceOps; run?: (...args: any[]) => Promise {
+test("the tools an agent drives Testing Studio with are model-visible; writing and deleting files stay the panel's", () => {
const { tools } = setup();
for (const name of MODEL_TOOLS) assert.deepEqual(tools.get(`mobile_testing_${name}`)?.config._meta?.ui?.visibility, ["app", "model"], name);
for (const name of APP_ONLY) assert.deepEqual(tools.get(`mobile_testing_${name}`)?.config._meta?.ui?.visibility, ["app"], name);
});
-test("every model-visible tool refuses until the Testing tab has reported a project, then defaults to it", async () => {
+test("every model-visible tool refuses until the Testing Studio tab has reported a project, then defaults to it", async () => {
await withStudio(async studio => {
const { call, recordings } = setup({ ops: {} as never });
const inputs: Record> = {
@@ -82,7 +82,7 @@ test("every model-visible tool refuses until the Testing tab has reported a proj
for (const name of MODEL_TOOLS) {
const result = await call(`mobile_testing_${name}`, inputs[name]);
assert.equal(result.isError, true, name);
- assert.match(result.content[0].text, /Testing tab is not open/, name);
+ assert.match(result.content[0].text, /Testing Studio tab is not open/, name);
}
await writeTestFile(studio, "tests/a.e2e.ts", SOURCE);
recordings.setPanelProject(studio);
@@ -126,13 +126,13 @@ async function recordHome(recordings: TestingAgentRecordings, studio: string, ti
return recordings.finish({ note: "n" });
}
-test("finishing in Studio saves the test, pinned to the recorded platform and app, and returns its path", async () => {
+test("finishing in Testing Studio saves the test, pinned to the recorded platform and app, and returns its path", async () => {
await withStudio(async studio => {
const recordings = new TestingAgentRecordings(fakeTreeDevices(), new TestDraftStore(join(studio, "drafts")));
const result = await recordHome(recordings, studio);
assert.equal(result.saved, true);
assert.equal(result.relativePath, "tests/the-home-screen.e2e.ts");
- assert.equal(result.path, "Studio/tests/the-home-screen.e2e.ts");
+ assert.equal(result.path, "Testing Studio/tests/the-home-screen.e2e.ts");
assert.match(result.next, /mobile_testing_run_matrix/);
assert.equal(await readTestFile(studio, "tests/the-home-screen.e2e.ts"), result.source);
assert.deepEqual(await readTestTarget(studio, "tests/the-home-screen.e2e.ts"), { platform: "android", bundleId: "com.app.android" });
@@ -369,7 +369,7 @@ test("a tab that stops reporting is closed: open, then stale, then refused, and
clock += 2_000;
const stale = await call("mobile_testing_tests");
assert.equal(stale.isError, true, "stale");
- assert.match(stale.content[0].text, /Testing tab is not open.*mobile_open_simulator/);
+ assert.match(stale.content[0].text, /Testing Studio tab is not open.*mobile_open_simulator/);
assert.equal(recordings.panelContext(), undefined, "the device selection goes with it");
await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), /call mobile_open_simulator with workspaceTool "testing" once to open it, then begin again/, "agent_begin refuses too");
@@ -415,7 +415,7 @@ function autoRecordings(studio: string, ops: DeviceOps) {
return new TestingAgentRecordings(fakeTreeDevices(), new TestDraftStore(join(studio, "drafts")), { ops });
}
-test("Studio begin needs only a booted device and a foreground app, and saves the test pinned to it", async () => {
+test("Testing Studio begin needs only a booted device and a foreground app, and saves the test pinned to it", async () => {
await withStudio(async studio => {
const recordings = autoRecordings(studio, AUTO_OPS("com.example.notes"));
recordings.setPanelProject(studio);
@@ -430,19 +430,19 @@ test("Studio begin needs only a booted device and a foreground app, and saves th
});
});
-test("Studio begin ignores the home screen and says only the app is missing", async () => {
+test("Testing Studio begin ignores the home screen and says only the app is missing", async () => {
await withStudio(async studio => {
const recordings = autoRecordings(studio, AUTO_OPS("com.apple.springboard"));
recordings.setPanelProject(studio);
await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), (error: Error) => {
assert.match(error.message, /^Cannot start recording yet\. Open the app to record in the foreground/);
- assert.doesNotMatch(error.message, /Boot|Testing tab|project/);
+ assert.doesNotMatch(error.message, /Boot|Testing Studio tab|project/);
return true;
});
});
});
-test("with nothing booted begin asks to boot a device and, in Studio, to open the app", async () => {
+test("with nothing booted begin asks to boot a device and, in Testing Studio, to open the app", async () => {
await withStudio(async studio => {
const recordings = autoRecordings(studio, AUTO_OPS(null, []));
recordings.setPanelProject(studio);
@@ -462,7 +462,7 @@ async function projectWith(targets: string[]) {
const dir = await mkdtemp(join(tmpdir(), "e2e-project-"));
const { writeFile, mkdir } = await import("node:fs/promises");
await writeFile(join(dir, "e2e.config.ts"), `export default { targets: [\n${targets.join(",\n")}\n] };\n`);
- // What makes it a project rather than Studio: a project-local e2e CLI and its package version.
+ // What makes it a project rather than Testing Studio: a project-local e2e CLI and its package version.
await mkdir(join(dir, "node_modules", ".bin"), { recursive: true });
await mkdir(join(dir, "node_modules", "e2e"), { recursive: true });
await writeFile(join(dir, "node_modules", ".bin", "e2e"), "");
@@ -499,10 +499,10 @@ test("ambiguous project mode asks which target, naming them", async () => {
});
});
-test("a closed Testing tab is the only thing begin reports", async () => {
+test("a closed Testing Studio tab is the only thing begin reports", async () => {
await withStudio(async studio => {
const recordings = autoRecordings(studio, AUTO_OPS(null, []));
- await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), (error: Error) => /^The Testing tab is not open\..*do not open another/.test(error.message));
+ await assert.rejects(() => recordings.begin({ title: "t", goal: "g" }), (error: Error) => /^The Testing Studio tab is not open\..*do not open another/.test(error.message));
});
});
diff --git a/packages/mcp-app/src/components/workspace.tsx b/packages/mcp-app/src/components/workspace.tsx
index 4a4a3287..8b66c21c 100644
--- a/packages/mcp-app/src/components/workspace.tsx
+++ b/packages/mcp-app/src/components/workspace.tsx
@@ -31,7 +31,7 @@ const tools = {
"app-intel": { id: "tool-app-intel", label: "App Intel", icon: NetworkIcon },
tracesift: { id: "tool-tracesift", label: "TraceSift", icon: ChartNoAxesCombinedIcon },
"app-flow": { id: "tool-app-flow", label: "App Flow", icon: GitForkIcon },
- testing: { id: "tool-testing", label: "Testing", icon: FlaskConicalIcon },
+ testing: { id: "tool-testing", label: "Testing Studio", icon: FlaskConicalIcon },
};
type Tool = keyof typeof tools;
const isTool = (value: string): value is Tool => value in tools;
@@ -63,7 +63,7 @@ export function Workspace({ panels, recordingController, banner, displayModeCont
onLayout("none");
panels.hide();
}, [recordingState.recording?.id]);
- // An agent recording opens the Testing tab for the user: they asked their agent for a test, and
+ // An agent recording opens the Testing Studio tab for the user: they asked their agent for a test, and
// the steps appearing one at a time are the whole point. Which tool is on screen is this
// component's own state, so the panel asks rather than reaches.
useEffect(() => testing.onAgentRecordingStarted(() => {
@@ -101,12 +101,12 @@ export function Workspace({ panels, recordingController, banner, displayModeCont
}, [logState.open, logState.paused, performanceState.monitoring, performanceState.fpsMonitoring]);
const testingOpen = tool === "testing" && open === true;
/**
- * The Testing panel is read as three panes side by side — mirror, preview, steps — so it asks
+ * The Testing Studio panel is read as three panes side by side — mirror, preview, steps — so it asks
* for a horizontal workspace of its own rather than inheriting `split`.
*
* `split` is `wide && fullscreen`, and outside the fullscreen workspace it is false: the group
* was then vertical, the mirror kept the 60% default meant for a tool stacked under it, and the
- * Testing panel's own two panes were left with 40% of the height between them. Recording is done
+ * Testing Studio panel's own two panes were left with 40% of the height between them. Recording is done
* by tapping the mirror and read back beside it, which only works as a row — so wherever there
* is width for a row, that is what this panel gets.
*/
@@ -149,7 +149,7 @@ export function Workspace({ panels, recordingController, banner, displayModeCont
const panelIds = Object.keys(current);
if (panelIds.length > 0) {
workspacePending = false;
- // The Testing panel is read as three panes — mirror, preview, steps — and the preview
+ // The Testing Studio panel is read as three panes — mirror, preview, steps — and the preview
// and the steps split the tools pane 60/40 of their own accord. A quarter of the
// workspace for the mirror is what makes those 45% and 30%: the mirror is tapped, while
// the two beside it are read, and reading a generated file needs the room.
@@ -157,7 +157,7 @@ export function Workspace({ panels, recordingController, banner, displayModeCont
workspace.setLayout({ "tools-resizable": toolsShare, "simulators-resizable": 100 - toolsShare });
// No visible platform is the panel being collapsed, not a share of 0. A share is the
// group's last *requested* layout, which it re-applies whenever a panel's constraints
- // change — and the Testing panel changes them as it opens. A 0 requested while nothing
+ // change — and the Testing Studio panel changes them as it opens. A 0 requested while nothing
// was bootable therefore outlived the device: discovery selected a simulator, the
// platform selector read "iOS", and the mirror stayed shut until the user toggled the
// platform off and on again. Collapsing says the same thing in the group's own terms,
@@ -174,7 +174,7 @@ export function Workspace({ panels, recordingController, banner, displayModeCont
observer.observe(document.getElementById("workspace-panels")!);
applyLayout();
// And again on the next frame, because the group re-derives its own layout from the panels'
- // defaults when their constraints change — which is what opening the Testing panel does, since
+ // defaults when their constraints change — which is what opening the Testing Studio panel does, since
// its mirror and its tools declare sizes of their own. Asking during the commit is asking
// before that, so the answer was thrown away; the frame after it is when it sticks.
const frame = requestAnimationFrame(() => { workspacePending = true; simulatorsPending = layout !== "none"; applyLayout(); });
@@ -190,7 +190,7 @@ export function Workspace({ panels, recordingController, banner, displayModeCont
const bottomToolbar = !fullscreen && layout !== "none";
const menuSide = bottomToolbar ? "top" : "bottom";
const ToolIcon = tools[tool].icon;
- // The Testing panel records by tapping the mirror and reads the test it emits beside it, so the
+ // The Testing Studio panel records by tapping the mirror and reads the test it emits beside it, so the
// mirror leads and the preview follows it — the reading order of the thing being done. Every
// other tool is a readout the simulator is secondary to, and keeps the simulator on the right.
// Only side by side: stacked, "left" is the top panel, which the simulator already is.
diff --git a/packages/shared/src/panel-target.ts b/packages/shared/src/panel-target.ts
index 51a298e2..1ee27f99 100644
--- a/packages/shared/src/panel-target.ts
+++ b/packages/shared/src/panel-target.ts
@@ -4,10 +4,10 @@ import type { SimulatorDevice } from "./protocol.ts";
const platform = z.enum(["ios", "android"]).optional().describe("The task's established platform. Omit when undecided.");
const kind = z.enum(["simulator", "emulator", "physical"]).optional().describe("The requested device kind. Omit when undecided.");
export const deviceIdSchema = z.string().min(1).max(256).regex(/^[A-Za-z0-9_.:\[\]%-]+$/).describe("An exact device ID from device discovery. Omit to select a matching device automatically.");
-const workspaceTool = z.enum(["logs", "performance", "storage", "app-intel", "tracesift", "testing"]).optional().describe("A workspace tool to open. Use testing to open the Testing tab, whether the panel is closed or already open. Omit for the device view.");
+const workspaceTool = z.enum(["logs", "performance", "storage", "app-intel", "tracesift", "testing"]).optional().describe("A workspace tool to open. Use testing to open the Testing Studio tab, whether the panel is closed or already open. Omit for the device view.");
const appIntelScreen = z.string().min(1).max(512).optional().describe("An App Intelligence screen ID to focus when workspaceTool is app-intel, from mobile_app_intel's search or screen result. Omit to open on whatever screen the panel last showed.");
-const projectPath = z.string().max(4096).optional().describe("With workspaceTool testing: the absolute path of the chat's workspace root (its working directory), so the Testing tab follows the chat. A folder that is not a project selects No project. Pass an empty string when the chat has no project. Omit only when you cannot tell.");
+const projectPath = z.string().max(4096).optional().describe("With workspaceTool testing: the absolute path of the chat's workspace root (its working directory), so the Testing Studio tab follows the chat. A folder that is not a project selects No project. Pass an empty string when the chat has no project. Omit only when you cannot tell.");
export const panelTargetSchema = z.object({ platform, kind, deviceId: deviceIdSchema.optional(), workspaceTool, appIntelScreen, projectPath }).strict().superRefine((target, context) => {
if (target.platform === "ios" && target.kind === "emulator" || target.platform === "android" && target.kind === "simulator") {
@@ -16,7 +16,7 @@ export const panelTargetSchema = z.object({ platform, kind, deviceId: deviceIdSc
});
/**
- * Whether the Testing panel can record against a device: a booted iOS simulator or a booted
+ * Whether the Testing Studio panel can record against a device: a booted iOS simulator or a booted
* Android emulator. Anything physical is out, because agent-device's session on a physical
* device is not the one the mirror holds.
*/
@@ -44,5 +44,5 @@ export function panelTargetPlatform(target: PanelTarget): "ios" | "android" | un
*/
export const PANEL_PAGE_META = "mobile-dev/panel";
-/** How often the open Testing tab re-sends its selection, so the server can tell a closed tab from an idle one. */
+/** How often the open Testing Studio tab re-sends its selection, so the server can tell a closed tab from an idle one. */
export const PANEL_HEARTBEAT_MS = 5_000;
diff --git a/packages/shared/src/test-recording.ts b/packages/shared/src/test-recording.ts
index 597f9b37..65ecece4 100644
--- a/packages/shared/src/test-recording.ts
+++ b/packages/shared/src/test-recording.ts
@@ -961,8 +961,8 @@ export function emitE2eTestLines(steps: readonly RecordedStep[], options: { titl
{ text: `import { expect } from "e2e";` },
{ text: `` },
{ text: agentic
- ? `// Recorded from the Testing panel. Pinned locators where an element was named, and agent steps where it was described.`
- : `// Recorded from the Testing panel. Every step is a pinned locator, driven by no agent.` },
+ ? `// Recorded from the Testing Studio panel. Pinned locators where an element was named, and agent steps where it was described.`
+ : `// Recorded from the Testing Studio panel. Every step is a pinned locator, driven by no agent.` },
{ text: `test(${quote(options.title)}, async ({ ${agentic ? "agent, app, screen" : "app, screen"} }) => {` },
// The runner reports `app.open` as a step like any other, so it counts as a call.
{ text: ` await app.open();`, call: true },
diff --git a/packages/skills/mobile-dev-testing/SKILL.md b/packages/skills/mobile-dev-testing/SKILL.md
index 014a29ef..0dd9bb16 100644
--- a/packages/skills/mobile-dev-testing/SKILL.md
+++ b/packages/skills/mobile-dev-testing/SKILL.md
@@ -1,6 +1,6 @@
---
name: mobile-dev-testing
-description: Use when the user asks to record, write or capture an end-to-end test for a screen or a flow of their iOS or Android app, with Mobile Dev's Testing panel. Drives the simulator or emulator through Mobile Dev's recorder one step at a time, pinning each step to a locator the e2e runner can resolve, and leaves the flow in the panel for the user to adjust, save and run. In No project (Studio) mode it also saves, runs on one or several devices, iOS and Android side by side, and repairs a failing line's locator for one platform. Skip when the user wants a test written straight into a file, or when there is no Mobile Dev panel.
+description: Use when the user asks to record, write or capture an end-to-end test for a screen or a flow of their iOS or Android app, with Mobile Dev's Testing Studio panel. Drives the simulator or emulator through Mobile Dev's recorder one step at a time, pinning each step to a locator the e2e runner can resolve, and leaves the flow in the panel for the user to adjust, save and run. In No project (Testing Studio) mode it also saves, runs on one or several devices, iOS and Android side by side, and repairs a failing line's locator for one platform. Skip when the user wants a test written straight into a file, or when there is no Mobile Dev panel.
---
# Record an e2e test with Mobile Dev
@@ -11,13 +11,13 @@ appear in Mobile Dev's **Testing** tab as you record them, and when you stop, th
there unsaved for the user to adjust.
In a **project**, you record; the user saves and runs. Those two are theirs, and the tools to do
-them are not yours to call. In **No project (Studio) mode** the flow is yours end to end: see
-[Studio mode](#studio-mode-record-run-repair) below.
+them are not yours to call. In **No project (Testing Studio) mode** the flow is yours end to end: see
+[Testing Studio mode](#studio-mode-record-run-repair) below.
## Before you start
-The **Testing tab must be open**; it is how Mobile Dev knows the user is looking. You open it
-yourself: whenever `begin` or a run tool says the Testing tab is not open, call
+The **Testing Studio tab must be open**; it is how Mobile Dev knows the user is looking. You open it
+yourself: whenever `begin` or a run tool says the Testing Studio tab is not open, call
`mobile_open_simulator({ workspaceTool: "testing", projectPath })` (it also switches an open view to
that tab) and then call the tool again. Do not ask the user to open it; the call waits for the tab to
report in. **Open it once per chat.** The host draws a new Mobile Dev panel for every
@@ -33,7 +33,7 @@ Past that,
user in a line:
- **Device**: the one the mirror shows, else the only booted simulator or emulator.
-- **App**: in **No project (Studio) mode**, the app in the foreground (home screens and launchers
+- **App**: in **No project (Testing Studio) mode**, the app in the foreground (home screens and launchers
do not count); finishing saves the test pinned to it. In a **project**, the config target the
foreground app matches, else the project's only target for that platform.
@@ -59,7 +59,7 @@ it, so a flow recorded from a cold home screen is a flow the user will have to f
screen, so the refs from the last read go with it; a stale `ref` is refused rather than acted
on. An assertion changes nothing, so several in a row need only one read.
5. `mobile_testing_agent_finish({ note })` when the flow is complete, and tell the user the flow
- is waiting in the Testing panel.
+ is waiting in the Testing Studio panel.
Use `mobile_testing_agent_abort({ reason })` if you cannot finish — a screen you cannot reach, an
app that crashed. Whatever you recorded stays in the panel for the user.
@@ -128,11 +128,11 @@ asserting text you have not seen.
- **Never save** a project's test. There is no tool for it in your hands, and finishing is the
handover: the steps are dirty in the panel and the user presses Save when they are happy with
- them. (Studio mode's `finish` saves for you; that is the one exception.)
+ them. (Testing Studio mode's `finish` saves for you; that is the one exception.)
- **Never run the test** while recording. There is no file to run, and a run resets the app and
takes the device session the recording is being read through.
When the user asks for a saved test to run on several devices, that is `mobile_testing_run_matrix`,
- and it works in both modes: a Studio test runs on each device with the bundled runner, and a project
+ and it works in both modes: a Testing Studio test runs on each device with the bundled runner, and a project
with its own `e2e.config.ts` runs the config's target for each device's platform (a device missing
the app gets it copied from another booted device that has it, and the target's engine must be a direct
`mobile(...)` call). It is a run, so
@@ -144,13 +144,13 @@ asserting text you have not seen.
## When you are done
-Tell the user what you recorded, in their terms, and that it is **in the Testing panel, unsaved**.
+Tell the user what you recorded, in their terms, and that it is **in the Testing Studio panel, unsaved**.
Say which parts fell back to a sentence, if any, and why. Do not paste the emitted file as the
deliverable — the panel is showing it, live, next to the steps.
-## Studio mode: record, run, repair
+## Testing Studio mode: record, run, repair
-No project open — the Testing tab says Studio — means tests live in Mobile Dev's own storage, each
+No project open — the Testing Studio tab says Testing Studio — means tests live in Mobile Dev's own storage, each
pinned to an app. The tab must be open: every tool below reads the tab's selection and refuses
when it has none. Then, if you have not opened the panel yet this chat, open it yourself with `mobile_open_simulator({ workspaceTool: "testing", projectPath })` and
call the tool again; do not ask the user, and do not open a second panel. `projectPath`
@@ -158,7 +158,7 @@ is optional on all of them; it defaults to the tab's project.
### Record, which saves
-*"Use the opened iOS app and record a test."* Run the loop above. In Studio,
+*"Use the opened iOS app and record a test."* Run the loop above. In Testing Studio,
`mobile_testing_agent_finish` **writes the test**, pinned to the platform and bundle id it was
recorded on, and returns its `relativePath` (e.g. `tests/the-explore-screen.e2e.ts`). Tell the
user the path. Nothing in the test file names a platform until you branch a line.
@@ -172,7 +172,7 @@ user the path. Nothing in the test file names a platform until you branch a line
defaults to the apps the test is pinned to.
- **Devices that are off are booted by the matrix**, and an app missing from a device is copied
from another device in the run that has it. Do not boot or install first.
-- The runs show in the Testing tab as live lanes, and the tab is locked while they go.
+- The runs show in the Testing Studio tab as live lanes, and the tab is locked while they go.
### A platform has no app yet
diff --git a/packages/ui/src/components/cascading-menu.tsx b/packages/ui/src/components/cascading-menu.tsx
index b13edc23..10670bfa 100644
--- a/packages/ui/src/components/cascading-menu.tsx
+++ b/packages/ui/src/components/cascading-menu.tsx
@@ -4,7 +4,7 @@ import { MARGIN, placeBelow, placeBeside } from "../popover-placement";
import type { Box, Placement } from "../popover-placement";
/**
- * The cascading half of the Testing panel's menus: a branch opens *beside* the row it hangs off,
+ * The cascading half of the Testing Studio panel's menus: a branch opens *beside* the row it hangs off,
* with the menu it came from still on screen.
*
* A branch that replaced what it was opened from read as navigation rather than as a menu — the
diff --git a/packages/ui/src/components/test-recorder-overlay.tsx b/packages/ui/src/components/test-recorder-overlay.tsx
index 53c0df38..e421079e 100644
--- a/packages/ui/src/components/test-recorder-overlay.tsx
+++ b/packages/ui/src/components/test-recorder-overlay.tsx
@@ -163,7 +163,7 @@ function CommandMenu({ commands, width, row, offerRow, onClose }: {
}
/**
- * The outline over the mirror while the Testing panel records: the element a tap would name, the
+ * The outline over the mirror while the Testing Studio panel records: the element a tap would name, the
* step it would add, and — on a right-click — the menu of every step that element supports.
*
* It borrows the annotation store's viewport — the canvas rectangle inside the stage, which the
diff --git a/packages/ui/src/components/testing-note.tsx b/packages/ui/src/components/testing-note.tsx
index 0b04ee1e..830350fe 100644
--- a/packages/ui/src/components/testing-note.tsx
+++ b/packages/ui/src/components/testing-note.tsx
@@ -2,7 +2,7 @@ import type { ReactNode } from "react";
import { InfoIcon, TriangleAlertIcon } from "lucide-react";
/**
- * A short note in the Testing panel: "info" explains how something works, "warning" says why
+ * A short note in the Testing Studio panel: "info" explains how something works, "warning" says why
* something cannot run as it is. Both are boxed with an icon so they do not read as body text, and
* the one thing to do about it, if there is one, sits inside the note as its `action`.
*/
diff --git a/packages/ui/src/components/testing-setup.tsx b/packages/ui/src/components/testing-setup.tsx
index 10906351..16c55815 100644
--- a/packages/ui/src/components/testing-setup.tsx
+++ b/packages/ui/src/components/testing-setup.tsx
@@ -16,8 +16,8 @@ type SetupPlanView = { id: string; actions: { action: string; path: string; deta
type SetupTarget = { name: string; platform: "ios" | "android"; bundleId: string };
const RUNTIME_HELP = {
- bundled: "Bundled runtime: Studio runs tests with the e2e runtime that ships with Mobile Dev. Nothing is written to your project; tests and config stay in Mobile Dev's private state.",
- project: "Project runtime: Studio runs tests with the e2e packages installed in your project, using its own e2e config file.",
+ bundled: "Bundled runtime: Testing Studio runs tests with the e2e runtime that ships with Mobile Dev. Nothing is written to your project; tests and config stay in Mobile Dev's private state.",
+ project: "Project runtime: Testing Studio runs tests with the e2e packages installed in your project, using its own e2e config file.",
} as const;
function useOperation(panel: TestingPanel, initial: TestingSetupOperation | null, onDone?: (operation: TestingSetupOperation) => void) {
@@ -35,7 +35,7 @@ function useOperation(panel: TestingPanel, initial: TestingSetupOperation | null
}
/** A collapsible, titled group inside the setup popover; every section shares this rhythm. */
-function Section({ title, hint, action, defaultOpen = true, forceOpen = false, children }: { title: string; hint?: string; action?: ReactNode; defaultOpen?: boolean; forceOpen?: boolean; children: ReactNode }) {
+function Section({ title, hint, action, defaultOpen = false, forceOpen = false, children }: { title: string; hint?: string; action?: ReactNode; defaultOpen?: boolean; forceOpen?: boolean; children: ReactNode }) {
const [open, setOpen] = useState(defaultOpen || forceOpen);
// A request from outside (a run that needs this section) opens it; the user can still collapse it.
useEffect(() => { if (forceOpen) setOpen(true); }, [forceOpen]);
@@ -113,7 +113,7 @@ function PlanPreview({ plan, projectPath, busy, onEdit, onApply }: { plan: Setup
}
/**
- * The single entry for everything e2e: which runtime Studio uses, the agent-step model, the mobile
+ * The single entry for everything e2e: which runtime Testing Studio uses, the agent-step model, the mobile
* targets, and the optional write of a project-local setup (the GUI equivalent of e2e init).
* Both runtimes open on a compact summary; the editable setup form only opens on request.
*/
@@ -228,14 +228,14 @@ export function TestingSetup({ panel }: { panel: TestingPanel }) {
{needsModel &&
An agent step needs a model. Choose one to continue.
{saved && Saved}
- void saveModel()} title="Use this model for agent steps in Studio runs. Nothing is written to the project.">{saving ? : }Use model
+ void saveModel()} title="Use this model for agent steps in Testing Studio runs. Nothing is written to the project.">{saving ? : }Use model
{panel.noProject ? "No Studio tests yet." : "No tests in this project's tests/ folder yet."}
}
+ {state.tests.length === 0 &&
{panel.noProject ? "No Testing Studio tests yet." : "No tests in this project's tests/ folder yet."}
}
;
@@ -277,14 +277,14 @@ export function TestingView({ panel, deviceApps }: { panel: TestingPanel; device
const deviceId = device?.udid ?? "";
const platform = device ? recordablePlatform(device) : "ios";
// Why the recorder cannot start yet, in the order the user has to fix them.
- const blocker = !state.projectPath ? "Preparing Studio…"
+ const blocker = !state.projectPath ? "Preparing Testing Studio…"
: state.loadingProject ? ""
- : state.targets.length === 0 ? (panel.noProject ? "Open the app you want to record in the mirror. Studio records against the app in the foreground." : "No mobile app identifier was found. Open the app in the mirror, or use E2E setup to enter one.")
+ : state.targets.length === 0 ? (panel.noProject ? "Open the app you want to record in the mirror. Testing Studio records against the app in the foreground." : "No mobile app identifier was found. Open the app in the mirror, or use E2E setup to enter one.")
: !target?.bundleId ? `Target "${target?.name}" has no app identifier. Enter one in E2E setup.`
: !booted ? "Boot an iOS simulator or Android emulator to record against it."
: !isRecordableDevice(device) ? "Recording works on an iOS simulator or an Android emulator, not a physical device."
: mismatch;
- return
+ return
{state.targets.length > 1 &&
{state.error &&
- Testing
+ Testing Studio{state.error} panel.dismissError()}>Dismiss}
- {state.projectWarning && state.runtimeMode !== "bundled" && Testing{state.projectWarning}}
+ {state.projectWarning && state.runtimeMode !== "bundled" && Testing Studio{state.projectWarning}}
{state.selectedTestPath && panel.storedRunHint && !state.agent?.active && void panel.repinStoredTest()}>
Add {platformLabel(panel.foregroundTarget!.platform)} app : undefined}>{panel.storedRunHint}}
- {blocker && !state.agent?.active && !(state.selectedTestPath && panel.storedRunHint) && {blocker}}
+ {blocker && !state.agent?.active && !(state.selectedTestPath && panel.storedRunHint) && {blocker}}
@@ -360,7 +360,7 @@ function AgentRecordingBanner({ panel }: { panel: TestingPanel }) {
return
{agent.status === "aborted" ? "The agent stopped recording" : "The agent finished recording"}
{` ${agent.steps} step${agent.steps === 1 ? "" : "s"}`}{agent.note ? ` — ${agent.note}` : ""}.
- {agent.savedPath ? ` Saved in Studio as ${agent.savedPath}.` : " Nothing has been saved or run: adjust the steps below, then press Save."}
+ {agent.savedPath ? ` Saved in Testing Studio as ${agent.savedPath}.` : " Nothing has been saved or run: adjust the steps below, then press Save."}
;
}
@@ -712,10 +712,10 @@ function SourceStepMenu({ source, step, index, mode, onEdit, editable }: {
/** A project file's awaited calls can be edited in a temporary working copy. */
/**
- * The apps a Studio test runs against, one per platform, with a way to take the app in front: on
+ * The apps a Testing Studio test runs against, one per platform, with a way to take the app in front: on
* the recorded platform it replaces that app, on the other it adds one so the test runs on both.
*/
-/** One app a Studio test runs: its platform as a tag, then its id, cut short with the whole id on hover. */
+/** One app a Testing Studio test runs: its platform as a tag, then its id, cut short with the whole id on hover. */
function AppBadge({ platform, bundleId, title, ...attributes }: { platform: "ios" | "android"; bundleId: string; title: string } & Record<`data-${string}`, string | undefined>) {
return {platformLabel(platform)}
@@ -753,7 +753,7 @@ function RunFailureReason({ run }: { run: { state: string; error?: string } | nu
}
/**
- * After a Studio test fails on the platform it was not recorded on: offers to pick the failed
+ * After a Testing Studio test fails on the platform it was not recorded on: offers to pick the failed
* line's element on this platform, which keeps the recorded locator for the other one behind a
* `platform` branch. While picking, says what to do on the mirror.
*/
diff --git a/packages/ui/src/popover-placement.ts b/packages/ui/src/popover-placement.ts
index ee6cb326..f862eb08 100644
--- a/packages/ui/src/popover-placement.ts
+++ b/packages/ui/src/popover-placement.ts
@@ -1,7 +1,7 @@
/**
* Where a popover goes, in the window's own coordinates.
*
- * The Testing panel's element menu used to be positioned inside the stage — the box the mirror
+ * The Testing Studio panel's element menu used to be positioned inside the stage — the box the mirror
* sits in — which clips what it contains and is often shorter than the menu itself, so a menu on
* a bottom tab was cut off rather than moved. Placement is against the window instead, and the
* caller draws the popover in a portal so nothing between it and the window can clip it.
diff --git a/packages/ui/src/simulator-panel.ts b/packages/ui/src/simulator-panel.ts
index fa4158ee..ebf8474b 100644
--- a/packages/ui/src/simulator-panel.ts
+++ b/packages/ui/src/simulator-panel.ts
@@ -286,9 +286,9 @@ export function createSimulatorPanel(
} finally { recordUiTiming("ui.annotations.inspection", performance.now() - startedAt); }
};
/**
- * The Testing panel records from the device this panel shows, and this is how it reads it: not
+ * The Testing Studio panel records from the device this panel shows, and this is how it reads it: not
* the inspection path the annotation overlay uses, but the e2e runner's own element tree, so a
- * recorded selector resolves to the same element when the test runs. The Testing panel installs
+ * recorded selector resolves to the same element when the test runs. The Testing Studio panel installs
* that source — it knows the project and the target — and this supplies the device and the
* screen. Only iOS simulators and Android emulators are wired up; a physical device has no tree here at all.
*/
diff --git a/packages/ui/src/test-recorder.ts b/packages/ui/src/test-recorder.ts
index 411b99e2..52c7c7f4 100644
--- a/packages/ui/src/test-recorder.ts
+++ b/packages/ui/src/test-recorder.ts
@@ -39,7 +39,7 @@ export type RecorderReader = {
/**
* Reads the runner's element tree for one device, and owns the session that read needs.
*
- * The Testing panel installs this, because it is the panel that knows which e2e project and which
+ * The Testing Studio panel installs this, because it is the panel that knows which e2e project and which
* target the recording is for; the simulator panel knows the device and the screen. The recorder
* is the one object both already share, so it is where the two halves meet.
*/
@@ -291,7 +291,7 @@ export class TestRecorder {
subscribe = (listener: () => void) => { this.listeners.add(listener); return () => { this.listeners.delete(listener); }; };
getSnapshot = () => this.snapshot;
- /** The Testing panel supplies the tree source; see `RecorderTreeSource`. */
+ /** The Testing Studio panel supplies the tree source; see `RecorderTreeSource`. */
useTreeSource(source?: RecorderTreeSource) {
if (this.treeSource === source) return;
this.treeSource?.release();
diff --git a/packages/ui/src/testing-matrix.ts b/packages/ui/src/testing-matrix.ts
index 4a4c6a47..9fa10ad1 100644
--- a/packages/ui/src/testing-matrix.ts
+++ b/packages/ui/src/testing-matrix.ts
@@ -1,5 +1,5 @@
/**
- * The Testing panel's view of a matrix run: what the server reports for each device, which devices
+ * The Testing Studio panel's view of a matrix run: what the server reports for each device, which devices
* the user chose, and the small pure helpers the rows are drawn from. The server owns the run
* (`packages/core/src/testing-matrix.ts`); this only reads it.
*/
diff --git a/packages/ui/src/testing-panel.ts b/packages/ui/src/testing-panel.ts
index f778cc31..1977efc7 100644
--- a/packages/ui/src/testing-panel.ts
+++ b/packages/ui/src/testing-panel.ts
@@ -20,7 +20,7 @@ import type { MatrixDeviceOption, MatrixLane, MatrixView } from "./testing-matri
* project already holds. A saved recording moves from one to the other, which is the whole reason
* this exists — the draft is deleted on save, so before this the test left the list entirely.
*/
-export type StoredTestSummary = { relativePath: string; name: string; updatedAt: string; sizeBytes: number; /** The app a Studio test is pinned to, and any app added for the other platform. */ target?: { platform: "ios" | "android"; bundleId: string; apps?: { ios?: string; android?: string } } };
+export type StoredTestSummary = { relativePath: string; name: string; updatedAt: string; sizeBytes: number; /** The app a Testing Studio test is pinned to, and any app added for the other platform. */ target?: { platform: "ios" | "android"; bundleId: string; apps?: { ios?: string; android?: string } } };
/**
* An agent recording, as the server reports it.
@@ -38,7 +38,7 @@ export type TestingAgentView = {
note: string;
/** The unsaved recording a finished session was kept as; "" while it is still recording. */
draftId: string;
- /** The Studio test a finished session was saved as, relative to Studio; "" when it was kept as a draft. */
+ /** The Testing Studio test a finished session was saved as, relative to Testing Studio; "" when it was kept as a draft. */
savedPath: string;
};
@@ -69,7 +69,7 @@ function writeProjectState(change: StoredProjectState) {
const AGENT_POLL_ACTIVE_MS = 400;
/**
* And a slow tick otherwise, so a recording the agent starts is noticed even when the user is
- * looking at another tool. It is what opens the Testing tab for them.
+ * looking at another tool. It is what opens the Testing Studio tab for them.
*/
const AGENT_POLL_IDLE_MS = 2_500;
@@ -98,7 +98,7 @@ export type TestingSnapshot = {
available: boolean;
projectPath: string;
projects: TestingProjectOption[];
- /** The private workspace Studio records against when no project is open; "" until the server says. */
+ /** The private workspace Testing Studio records against when no project is open; "" until the server says. */
studioPath: string;
targets: TestingTargetOption[];
/** The target the panel records against; "" until a project with targets is loaded. */
@@ -213,7 +213,7 @@ function parseTargets(data: Record): TestingTargetOption[] {
}
/**
- * The Testing panel: pick an e2e project, launch its app on the mirrored device, and (once the
+ * The Testing Studio panel: pick an e2e project, launch its app on the mirrored device, and (once the
* recorder lands) turn taps on the mirror into a deterministic test.
*
* This is the walking skeleton — project selection and launch only. Tap interception, selector
@@ -269,7 +269,7 @@ export class TestingPanel {
private draftWrite?: Promise;
/** Set while `dispose` makes its last keep, so the guards do not refuse the flush. */
private flushing = false;
- /** Set when a session goes active, for the host chrome to show the Testing tab. */
+ /** Set when a session goes active, for the host chrome to show the Testing Studio tab. */
private onAgentRecording?: () => void;
private heartbeatTimer?: ReturnType;
@@ -308,7 +308,7 @@ export class TestingPanel {
}
/**
- * The host chrome's way of being told to show the Testing tab.
+ * The host chrome's way of being told to show the Testing Studio tab.
*
* Which tool is on screen is the host's own state — the workspace component holds it — so the
* panel asks rather than reaches. Opening the tab is the point of an agent recording: the user
@@ -397,7 +397,7 @@ export class TestingPanel {
// still theirs — nothing is ever inferred from the server's working directory.
void this.restoreProject();
// And the poll runs from here rather than from `show`, so a recording the agent starts while
- // the user is in another tool is what opens the Testing tab for them.
+ // the user is in another tool is what opens the Testing Studio tab for them.
this.pollAgent();
void this.refreshDrafts();
void this.refreshTests();
@@ -420,7 +420,7 @@ export class TestingPanel {
if (!device || !target?.platform) return "";
const mirrored = recordablePlatform(device);
if (target.platform === mirrored) return "";
- // Studio's target follows the app in front, which is unknown for a moment after the mirror changes:
+ // Testing Studio's target follows the app in front, which is unknown for a moment after the mirror changes:
// `selectDevice` clears it and `refreshStudioTargets` re-reads the target once it is found. Until
// then the target is still the other mirror's, and warning about it only flashes. Say nothing until
// the new device has answered and its target is in.
@@ -431,7 +431,7 @@ export class TestingPanel {
}
const shown = mirrored === "ios" ? "an iOS simulator" : "an Android emulator";
const other = target.platform === "ios" ? "an iOS simulator" : "an Android emulator";
- // Studio's targets are the app in front, so its only target names are internal: say what to do on the device instead.
+ // Testing Studio's targets are the app in front, so its only target names are internal: say what to do on the device instead.
if (this.noProject) return `The mirror shows ${shown}, but the app was picked up on ${platformLabel(target.platform)}. Open the app on this device to record here, or switch the mirror to ${other}.`;
return `The "${target.name}" target runs on ${platformLabel(target.platform)}, but the mirror shows ${shown}. Choose ${mirrored === "ios" ? "an iOS" : "an Android"} target, or switch the mirror to ${other}.`;
}
@@ -472,9 +472,9 @@ export class TestingPanel {
await this.refreshProjects();
// An agent that opened the panel for its chat has already said which project it wants.
if (await this.applyServerProjectRequest()) return;
- // No project is a state of its own: with nothing recorded against yet, Studio opens on its
+ // No project is a state of its own: with nothing recorded against yet, Testing Studio opens on its
// private workspace so recording never waits for a folder to be chosen.
- // The one the user was last in, whether that was Studio or a folder; else the newest folder.
+ // The one the user was last in, whether that was Testing Studio or a folder; else the newest folder.
const last = readProjectState().project;
const known = last && (last === this.snapshot.studioPath || this.snapshot.projects.some(entry => entry.path === last)) ? last : "";
const latest = known || this.snapshot.projects[0]?.path || this.snapshot.studioPath;
@@ -523,10 +523,10 @@ export class TestingPanel {
this.update({ projects: [project, ...this.snapshot.projects.filter(entry => entry.path !== project.path)] });
}
- /** Whether Studio is on its private workspace rather than a project the user opened. */
+ /** Whether Testing Studio is on its private workspace rather than a project the user opened. */
get noProject(): boolean { return Boolean(this.snapshot.studioPath) && this.snapshot.projectPath === this.snapshot.studioPath; }
- /** Leaves the open project and records in Studio's own workspace. */
+ /** Leaves the open project and records in Testing Studio's own workspace. */
async useNoProject() {
await this.refreshProjects();
if (this.snapshot.studioPath) await this.selectProject(this.snapshot.studioPath);
@@ -570,7 +570,7 @@ export class TestingPanel {
}
/**
- * Studio derives its only target from the app in front, so when another app comes to the front
+ * Testing Studio derives its only target from the app in front, so when another app comes to the front
* the target is re-read, in place: unlike `selectProject` it keeps drafts, tests and selection.
*/
private async refreshStudioTargets() {
@@ -853,7 +853,7 @@ export class TestingPanel {
}
/**
- * The line a re-record would change: the selected Studio test's first failed line, when the last
+ * The line a re-record would change: the selected Testing Studio test's first failed line, when the last
* run failed on the other platform than the one it was recorded on and the mirror shows that one.
* Zero when there is nothing to offer.
*/
@@ -1445,10 +1445,10 @@ export class TestingPanel {
// a second copy of the same steps a moment later.
this.draftRevision = testRecorder.getSnapshot().revision;
if (savedPath) {
- // Studio: finishing wrote the test, so there is no draft to adopt. The steps are in the
+ // Testing Studio: finishing wrote the test, so there is no draft to adopt. The steps are in the
// stored list now, and the recorder's copy is marked saved so autosave does not keep it again.
this.draftFlowId = "";
- this.update({ savedRevision: testRecorder.getSnapshot().revision, savedPath: `Studio/${savedPath}` });
+ this.update({ savedRevision: testRecorder.getSnapshot().revision, savedPath: `Testing Studio/${savedPath}` });
testRecorder.stop();
void this.refreshTests();
void this.refreshDrafts();
@@ -1464,7 +1464,7 @@ export class TestingPanel {
async stopAgent() {
if (this.snapshot.agent?.active !== true) return;
try {
- await this.call("mobile_testing_agent_abort", { reason: "The user stopped the recording from the Testing panel." }, 10_000);
+ await this.call("mobile_testing_agent_abort", { reason: "The user stopped the recording from the Testing Studio panel." }, 10_000);
} catch (error) {
this.update({ error: error instanceof Error ? error.message : String(error) });
return;
@@ -1492,41 +1492,41 @@ export class TestingPanel {
&& !this.storedRunHint);
}
- /** The app a selected Studio test is pinned to; undefined for project tests and unpinned tests. */
+ /** The app a selected Testing Studio test is pinned to; undefined for project tests and unpinned tests. */
get storedTarget(): NonNullable | undefined {
if (this.snapshot.runtimeMode !== "bundled") return undefined;
return this.snapshot.tests.find(test => test.relativePath === this.snapshot.selectedTestPath)?.target;
}
- /** Every app id the selected Studio test has, per platform: the recorded one and any added one. */
+ /** Every app id the selected Testing Studio test has, per platform: the recorded one and any added one. */
get storedApps(): { ios?: string; android?: string } {
const stored = this.storedTarget;
return stored ? { ...stored.apps, [stored.platform]: stored.bundleId } : {};
}
- /** The selected Studio test's app on one platform, if it has one there. */
+ /** The selected Testing Studio test's app on one platform, if it has one there. */
storedAppOn(platform: "ios" | "android"): { platform: "ios" | "android"; bundleId: string } | undefined {
const bundleId = this.storedApps[platform];
return bundleId ? { platform, bundleId } : undefined;
}
- /** The platform of the mirrored device, when it is one Studio can record and run on. */
+ /** The platform of the mirrored device, when it is one Testing Studio can record and run on. */
get mirroredPlatform(): "ios" | "android" | undefined {
const { device } = this.deviceApps.getSnapshot();
return device && isRecordableDevice(device) ? recordablePlatform(device) : undefined;
}
- /** The app in front on the mirrored device, as a Studio target. */
+ /** The app in front on the mirrored device, as a Testing Studio target. */
get foregroundTarget(): NonNullable | undefined {
const { device, foregroundApp } = this.deviceApps.getSnapshot();
return device && isRecordableDevice(device) && foregroundApp?.bundleId ? { platform: recordablePlatform(device), bundleId: foregroundApp.bundleId } : undefined;
}
- /** Why Run is unavailable for a selected Studio test, or "": it needs a pinned app or one in front. */
+ /** Why Run is unavailable for a selected Testing Studio test, or "": it needs a pinned app or one in front. */
get storedRunHint(): string {
if (this.snapshot.runtimeMode !== "bundled" || !this.snapshot.selectedTestPath) return "";
const pinned = this.storedTarget;
- if (!pinned) return this.foregroundTarget ? "" : "This test has no app yet. Open the app in the mirror to run it; Studio will pin it.";
+ if (!pinned) return this.foregroundTarget ? "" : "This test has no app yet. Open the app in the mirror to run it; Testing Studio will pin it.";
const mirrored = this.mirroredPlatform;
if (mirrored && !this.storedAppOn(mirrored)) {
const recorded = platformLabel(pinned.platform), other = platformLabel(mirrored);
@@ -1547,16 +1547,16 @@ export class TestingPanel {
return this.snapshot.runtimeMode === "bundled" && Boolean(pinned && front) && front!.platform !== pinned!.platform && !this.storedAppOn(front!.platform) && !this.snapshot.running;
}
- /** The platform and bundle id sent with a save, so a Studio test is pinned to the app it was recorded against. */
+ /** The platform and bundle id sent with a save, so a Testing Studio test is pinned to the app it was recorded against. */
private pinArguments() {
- // Studio's `targets` can lag the mirror, so the app actually in front wins.
+ // Testing Studio's `targets` can lag the mirror, so the app actually in front wins.
const target = this.snapshot.runtimeMode === "bundled" ? this.foregroundTarget ?? this.target : this.target;
return this.snapshot.runtimeMode === "bundled" && (target?.platform === "ios" || target?.platform === "android") && target.bundleId
? { platform: target.platform, bundleId: target.bundleId } : {};
}
/**
- * Pins the selected Studio test to the app in front. On the recorded platform it replaces that
+ * Pins the selected Testing Studio test to the app in front. On the recorded platform it replaces that
* app; on the other platform it adds the app there, so the test runs on both.
*/
async repinStoredTest() {
@@ -1599,7 +1599,7 @@ export class TestingPanel {
const untilSource = untilLine === undefined ? source : storedTestUntilSource(source, untilLine);
if (untilSource === undefined) return;
if (!this.hasBundledModel(untilSource, { kind: "stored", ...(untilLine === undefined ? {} : { untilLine }) })) return;
- // A Studio test runs against the app it is pinned to, never whichever app is in front. A test
+ // A Testing Studio test runs against the app it is pinned to, never whichever app is in front. A test
// with no app yet takes the one in front and keeps it, so later runs are pinned.
// A test with an app on both platforms runs the one for the mirrored device's platform.
const stored = this.storedTarget;
@@ -1767,7 +1767,7 @@ export class TestingPanel {
}
/**
- * The one platform a pinned Studio test can run on: it was recorded against one app on one
+ * The one platform a pinned Testing Studio test can run on: it was recorded against one app on one
* platform and has no app added for the other. Undefined when any platform may run.
*/
get matrixPlatform(): "ios" | "android" | undefined {
@@ -1806,7 +1806,7 @@ export class TestingPanel {
/** The app a run would drive, per platform: the open test's own app first, then the project's targets. */
matrixApps(): { ios?: string; android?: string } {
- // A pinned Studio test runs only the apps it has; the project's targets are not its apps.
+ // A pinned Testing Studio test runs only the apps it has; the project's targets are not its apps.
if (this.snapshot.runtimeMode === "bundled" && this.storedTarget) return this.storedApps;
const apps: { ios?: string; android?: string } = {};
// The selected target first, so its app wins its platform; the server picks the same target.
diff --git a/packages/ui/test/test-recorder.test.ts b/packages/ui/test/test-recorder.test.ts
index 4e31ff12..222d4f63 100644
--- a/packages/ui/test/test-recorder.test.ts
+++ b/packages/ui/test/test-recorder.test.ts
@@ -274,7 +274,7 @@ test("recording again after a save starts a new flow rather than extending the s
recorder.stop();
assert.equal(recorder.getSnapshot().steps.length, 1);
- // What the Testing panel passes when the steps on screen are already in a file.
+ // What the Testing Studio panel passes when the steps on screen are already in a file.
recorder.start(UDID, "ios");
assert.deepEqual(recorder.getSnapshot().steps, []);
diff --git a/packages/ui/test/testing-agent-run-render.test.ts b/packages/ui/test/testing-agent-run-render.test.ts
index 7998b46a..c0dc59e0 100644
--- a/packages/ui/test/testing-agent-run-render.test.ts
+++ b/packages/ui/test/testing-agent-run-render.test.ts
@@ -84,7 +84,7 @@ test("the panel adopts an agent run through its own polling and keeps rendering"
device: { udid: "u", name: "Pixel", state: "Booted", platform: "android", kind: "emulator" },
front: { bundleId: "com.example.android", pid: 1 },
responses: {
- mobile_testing_projects: { projects: [{ path: "/studio", name: "Studio" }], studioPath: "/studio" },
+ mobile_testing_projects: { projects: [{ path: "/studio", name: "Testing Studio" }], studioPath: "/studio" },
mobile_testing_project_config: { runtimeMode: "bundled", targets: [], setupState: "available" },
mobile_testing_tests: { tests: [{ relativePath: "flow.e2e.ts", name: "flow", updatedAt: new Date().toISOString(), sizeBytes: 10, target: { platform: "ios", bundleId: "com.example", apps: { android: "com.example.android" } } }] },
mobile_testing_read_file: { source, originalHash: "h" },
diff --git a/packages/ui/test/testing-panel.test.ts b/packages/ui/test/testing-panel.test.ts
index 21284552..b0cb0779 100644
--- a/packages/ui/test/testing-panel.test.ts
+++ b/packages/ui/test/testing-panel.test.ts
@@ -311,8 +311,8 @@ test("a booted Android emulator is recordable and a target of the wrong platform
assert.equal(panel.targetMismatch, "");
});
-test("Studio does not flash a mirror mismatch while the switched device's app is still unknown", () => {
- // Switching the mirror clears the foreground app and re-reads Studio's target once it is found.
+test("Testing Studio does not flash a mirror mismatch while the switched device's app is still unknown", () => {
+ // Switching the mirror clears the foreground app and re-reads Testing Studio's target once it is found.
// In between, the target is still the other platform's: warning then makes the message flicker.
const emulator = { udid: "emulator-5554", name: "Pixel", state: "Booted", runtime: "", platform: "android", kind: "emulator" };
let snapshot: Record = { device: emulator, apps: [], foregroundApp: null, ready: false };
@@ -331,7 +331,7 @@ test("Studio does not flash a mirror mismatch while the switched device's app is
panel.dispose();
});
-test("a Studio test with no app pins the one in front on its first run, then runs against the pin", async () => {
+test("a Testing Studio test with no app pins the one in front on its first run, then runs against the pin", async () => {
const calls: { name: string; arguments: Record }[] = [];
const source = 'test("stored", async ({ app }) => {\n await app.open();\n});\n';
const panel = new TestingPanel(host({ mobile_testing_run_test: { status: "passed", exitCode: 0, steps: [] } }, calls), frontApps);
@@ -349,7 +349,7 @@ test("a Studio test with no app pins the one in front on its first run, then run
panel.dispose();
});
-test("a Studio save pins the app in front, not a stale target from an earlier app", async () => {
+test("a Testing Studio save pins the app in front, not a stale target from an earlier app", async () => {
const calls: { name: string; arguments: Record }[] = [];
const panel = new TestingPanel(host({ mobile_testing_write_file: { written: true, existed: false, path: `${PROJECT}/tests/flow.e2e.ts` } }, calls), frontApps);
panel.setAvailable(true);
@@ -363,10 +363,10 @@ test("a Studio save pins the app in front, not a stale target from an earlier ap
panel.dispose();
});
-test("a Studio save shows its pin at once, even when the next listing has not caught up", async () => {
+test("a Testing Studio save shows its pin at once, even when the next listing has not caught up", async () => {
const calls: { name: string; arguments: Record }[] = [];
const listed = { relativePath: "tests/flow.e2e.ts", name: "flow.e2e.ts", updatedAt: "", sizeBytes: 1 };
- const panel = new TestingPanel(host({ mobile_testing_write_file: { written: true, existed: false, path: "Studio/tests/flow.e2e.ts" }, mobile_testing_tests: { tests: [listed] } }, calls), frontApps);
+ const panel = new TestingPanel(host({ mobile_testing_write_file: { written: true, existed: false, path: "Testing Studio/tests/flow.e2e.ts" }, mobile_testing_tests: { tests: [listed] } }, calls), frontApps);
const update = (panel as unknown as { update(fields: Record): void }).update.bind(panel);
panel.setAvailable(true);
update({ projectPath: PROJECT, fileName: "flow", runtimeMode: "bundled", tests: [listed] });
@@ -383,7 +383,7 @@ test("a Studio save shows its pin at once, even when the next listing has not ca
panel.dispose();
});
-test("a Studio test pinned by its first run shows the pin while the run is still going", async () => {
+test("a Testing Studio test pinned by its first run shows the pin while the run is still going", async () => {
const source = 'test("stored", async ({ app }) => {\n await app.open();\n});\n';
let duringRun: unknown;
let panel: TestingPanel;
@@ -401,7 +401,7 @@ test("a Studio test pinned by its first run shows the pin while the run is still
panel.dispose();
});
-test("a pinned Studio test can run when its app is installed but not running", () => {
+test("a pinned Testing Studio test can run when its app is installed but not running", () => {
const running = { subscribe: () => () => undefined, getSnapshot: () => ({ device: { udid: "udid", name: "iPhone", state: "Booted", platform: "ios", kind: "simulator" }, apps: [{ bundleId: "com.other.app", pid: 2 }], foregroundApp: { bundleId: "com.other.app", pid: 2 }, ready: true }) } as unknown as DeviceAppsStore;
const panel = new TestingPanel(host({}, []), running);
panel.setAvailable(true);
@@ -411,7 +411,7 @@ test("a pinned Studio test can run when its app is installed but not running", (
panel.dispose();
});
-test("a Studio test pinned to iOS only offers and runs on iOS devices", () => {
+test("a Testing Studio test pinned to iOS only offers and runs on iOS devices", () => {
const panel = new TestingPanel(host({}, []), frontApps);
panel.setAvailable(true);
(panel as unknown as { update(fields: Record): void }).update({
@@ -431,7 +431,7 @@ test("a Studio test pinned to iOS only offers and runs on iOS devices", () => {
const androidFront = { subscribe: () => () => undefined, getSnapshot: () => ({ device: { udid: "emulator-5554", name: "Pixel", state: "Booted", runtime: "", platform: "android", kind: "emulator" }, apps: [], foregroundApp: { bundleId: "com.example.android", pid: 3 }, ready: true }) } as unknown as DeviceAppsStore;
const iosOnly = { relativePath: "tests/stored.e2e.ts", name: "stored.e2e.ts", updatedAt: "", sizeBytes: 1, target: { platform: "ios", bundleId: "com.pinned.app" } };
-test("an iOS-only Studio test on an Android mirror says so and adds the Android app in front", async () => {
+test("an iOS-only Testing Studio test on an Android mirror says so and adds the Android app in front", async () => {
const calls: { name: string; arguments: Record }[] = [];
const panel = new TestingPanel(host({ mobile_testing_set_target: { pinned: true } }, calls), androidFront);
panel.setAvailable(true);
@@ -445,7 +445,7 @@ test("an iOS-only Studio test on an Android mirror says so and adds the Android
panel.dispose();
});
-test("a Studio test with apps on both platforms runs the mirrored platform's app and offers both in the matrix", async () => {
+test("a Testing Studio test with apps on both platforms runs the mirrored platform's app and offers both in the matrix", async () => {
const calls: { name: string; arguments: Record }[] = [];
const source = 'test("stored", async ({ app }) => {\n await app.open();\n});\n';
const panel = new TestingPanel(host({ mobile_testing_run_test: { status: "passed", exitCode: 0, steps: [] } }, calls), androidFront);
@@ -506,7 +506,7 @@ test("re-recording a line that failed on an Android lane brings the Android mirr
} finally { panel.dispose(); }
});
-test("opening an app on the mirror keeps the open Studio test selected", async () => {
+test("opening an app on the mirror keeps the open Testing Studio test selected", async () => {
const listeners = new Set<() => void>();
let snapshot: Record = { device: { udid: "emulator-5554", name: "Pixel", state: "Booted", runtime: "", platform: "android", kind: "emulator" }, apps: [], foregroundApp: null, ready: true };
const apps = { subscribe: (listener: () => void) => { listeners.add(listener); return () => listeners.delete(listener); }, getSnapshot: () => snapshot } as unknown as DeviceAppsStore;
@@ -523,7 +523,7 @@ test("opening an app on the mirror keeps the open Studio test selected", async (
} finally { panel.dispose(); }
});
-test("Run is unavailable for a Studio test with neither a pinned app nor one in front", () => {
+test("Run is unavailable for a Testing Studio test with neither a pinned app nor one in front", () => {
const panel = new TestingPanel(host({}, []), deviceApps);
panel.setAvailable(true);
(panel as unknown as { update(fields: Record): void }).update({ projectPath: PROJECT, runtimeMode: "bundled", selectedTestPath: "tests/stored.e2e.ts", selectedTestSource: "x" });
diff --git a/website/astro.config.mjs b/website/astro.config.mjs
index 80d5f4de..afa49e91 100644
--- a/website/astro.config.mjs
+++ b/website/astro.config.mjs
@@ -25,7 +25,7 @@ const sidebar = [
{ label: 'App control', slug: 'docs/app-control' },
{ label: 'App Intelligence', slug: 'docs/app-intelligence' },
{ label: 'App Flow', slug: 'docs/app-flow' },
- { label: 'Testing', slug: 'docs/testing' },
+ { label: 'Testing Studio', slug: 'docs/testing' },
{ label: 'Logs', slug: 'docs/logs' },
{ label: 'Performance', slug: 'docs/performance' },
{ label: 'Profiles', slug: 'docs/profiles' },
diff --git a/website/src/content/docs/docs/getting-started.md b/website/src/content/docs/docs/getting-started.md
index de83bbbc..39f32ef8 100644
--- a/website/src/content/docs/docs/getting-started.md
+++ b/website/src/content/docs/docs/getting-started.md
@@ -114,7 +114,7 @@ Follow your client's configuration format. Device panels and interactive recordi
1. Ask **“Build and run my app in the simulator beside this chat.”** You can name iOS, Android, a simulator model, or a connected device.
2. Choose or reuse a device. Selecting a stopped simulator or AVD boots it.
-3. Watch the app beside the conversation. Use **Select** to annotate an element, or open **App Intelligence**, **Testing**, **Logs**, **Performance**, **Storage**, or **TraceSift**.
+3. Watch the app beside the conversation. Use **Select** to annotate an element, or open **App Intelligence**, **Testing Studio**, **Logs**, **Performance**, **Storage**, or **TraceSift**.
Your app's own build tools compile, install, and launch it. Mobile Dev does not install Xcode runtimes or replace your project's build system.
diff --git a/website/src/content/docs/docs/introduction.md b/website/src/content/docs/docs/introduction.md
index 19b59031..f031abbd 100644
--- a/website/src/content/docs/docs/introduction.md
+++ b/website/src/content/docs/docs/introduction.md
@@ -23,7 +23,7 @@ The agent opens Mobile Dev, selects a suitable installed device, and uses the pr
| Install or relaunch an app, open a deep link, change permissions, or test another language | [App control](/docs/app-control) |
| Trace screens through their source files and packages without running the app | [App Intelligence](/docs/app-intelligence) |
| Map an app's screens and navigation, capture each screen, and record a path to one | [App Flow](/docs/app-flow) |
-| Record, edit, and run deterministic e2e tests from a simulator or emulator | [Testing](/docs/testing) |
+| Record, edit, and run deterministic e2e tests from a simulator or emulator | [Testing Studio](/docs/testing) |
| Read native and Metro messages together and send a log to your agent | [Logs](/docs/logs) |
| Record CPU, memory, and supported device Display FPS; select and compare ranges | [Performance](/docs/performance) |
| Explore a CPU or React profile and investigate a measured finding | [Profiles](/docs/profiles) |
diff --git a/website/src/content/docs/docs/privacy.md b/website/src/content/docs/docs/privacy.md
index 0033d0d9..111d7267 100644
--- a/website/src/content/docs/docs/privacy.md
+++ b/website/src/content/docs/docs/privacy.md
@@ -42,7 +42,7 @@ Depending on the tools you use, Mobile Dev processes:
- App Intelligence project paths, screen names and routes, project-relative source
and asset paths, package names, static import relationships, and analysis
diagnostics when you generate or query a source graph.
-- Testing project paths and configuration, element trees, recorded steps, generated
+- Testing Studio project paths and configuration, element trees, recorded steps, generated
test source, runner output, and locally kept unsaved recordings when you record,
edit, or run an e2e test.
- App storage keys, values, database rows, and file metadata when you inspect
@@ -186,7 +186,7 @@ and [OpenAI's privacy policy](https://openai.com/policies/privacy-policy/).
| Mixpanel product analytics | Up to 24 months, then deleted. |
| Local live logs | Held in bounded memory buffers. A server log session expires after five minutes without reads or keep-alives; closing the session stops collection. Copies already attached to the host follow the host's retention. |
| Saved App Intelligence graphs and project history | Stored under `~/Library/Application Support/mobile-dev/app-intelligence` until you clear a graph or remove the files. Clearing a graph keeps the project in the recent-project list. |
-| Testing project history and unsaved recordings | Stored under `~/Library/Application Support/mobile-dev/testing` until you delete a recording or remove the files. Saving a recording into the project removes the local draft it replaced; the draft store keeps at most 30 recordings. Tests saved into the project's `tests/` folder follow your repository's retention. |
+| Testing Studio project history and unsaved recordings | Stored under `~/Library/Application Support/mobile-dev/testing` until you delete a recording or remove the files. Saving a recording into the project removes the local draft it replaced; the draft store keeps at most 30 recordings. Tests saved into the project's `tests/` folder follow your repository's retention. |
| Saved performance recordings | Stored under `~/Library/Application Support/mobile-dev/recordings` until you remove them; the recording store has no automatic age-based expiry. |
| TraceSift integration results/references and the chosen project folder | Stored under `~/.tracesift/integrations/mobile-dev` by default, or the corresponding `TRACE_SIFT_HOME` directory, until removed. Original profiles and the TraceSift service's own data are separate. |
| Installation ID | Stored at `~/Library/Application Support/mobile-dev/telemetry/anonymous-user-id` until you remove it. Process-session IDs last for the process; copies in sent reports follow Sentry retention. |
diff --git a/website/src/content/docs/docs/testing.md b/website/src/content/docs/docs/testing.md
index ad8f7cc1..3f1f9e5a 100644
--- a/website/src/content/docs/docs/testing.md
+++ b/website/src/content/docs/docs/testing.md
@@ -1,26 +1,39 @@
---
-title: Testing
-description: Record, edit, and run deterministic e2e tests from an iOS simulator or Android emulator beside your conversation.
+title: Testing Studio
+description: Record, edit, and run deterministic e2e tests from an iOS simulator or Android emulator beside your conversation, on one device or several at once.
---
-Open **Testing** to turn interactions with a running app into an editable e2e test. The mirror, generated TypeScript, and ordered step list share one workspace, so you can drive the app and review the test at the same time.
+Open **Testing Studio** to turn interactions with a running app into an editable e2e test. The mirror, generated TypeScript, and ordered step list share one workspace, so you can drive the app and review the test at the same time.
-Testing currently supports iOS simulators and Android emulators with an existing e2e project. Physical devices and Maestro output are not supported. Mobile Dev uses the project's own e2e CLI and `@e2e-dev/mobile` installation; it does not install or replace the project's test runner.
+Testing Studio supports iOS simulators and Android emulators. Physical devices and Maestro output are not supported.
-## Prepare a project and device
+## No project, or your own project
-Before recording:
+You don't need an e2e project to start. Testing Studio works in two modes, and the **E2E setup** button in the toolbar shows which one is active.
-1. Install the project's dependencies and configure an `e2e.config.ts`, `.mts`, `.js`, or `.mjs` file.
-2. Boot an iOS simulator or Android emulator and select it in Mobile Dev.
-3. Open **Testing** and choose the project folder. Mobile Dev remembers recent choices, but never infers a project from the server's working directory.
-4. Choose a target whose platform matches the mirrored device, then select **Launch app**.
+| Mode | When | What runs the test | Where tests are saved |
+|---|---|---|---|
+| **No project** | Nothing is open, or the folder has no usable `e2e.config.ts` | Mobile Dev's bundled e2e runtime | Mobile Dev's private storage, listed under **In Testing Studio** |
+| **Project** | A folder with an `e2e.config.ts`, a mobile target with a bundle ID, and the project's own `e2e` CLI installed | The project's own e2e CLI and `@e2e-dev/mobile` | The project's `tests/` directory |
-The target needs a bundle ID in the e2e config so Mobile Dev can attach the recorder to the same app the test will open. If the selected target and device use different platforms, choose a matching target before recording.
+In **No project** mode the test runs against the app in front of the mirror, and each saved test remembers that app, so later runs open the same one. Nothing is written to any of your folders.
+
+In **Project** mode Mobile Dev never installs or replaces your test runner, and a run never downloads a CLI with `npx`.
+
+The **E2E setup** popover lists the project, mobile apps, devices and agent model. Its sections start collapsed; open the one you need. **Set up project** walks you through creating a config in a folder that has none, and **Update setup** changes an existing one.
+
+## Prepare a device
+
+1. Boot an iOS simulator or Android emulator and select it in Mobile Dev.
+2. Open **Testing Studio**. Choose a project folder from the picker, or stay on **No project**.
+3. In a project, choose a target whose platform matches the mirrored device.
+4. Select **Launch app**.
+
+**Launch app** opens an app that is already installed; it doesn't build one. If the app is missing, Testing Studio says so and names the build to run, for example `npx expo run:android` for an Expo app.
## Record a test
-Select **Record**. The mirror briefly shows that the recorder is preparing while it reads the element tree used by the project's own mobile test engine.
+Select **Record**. The mirror briefly shows that the recorder is preparing while it reads the element tree used by the mobile test engine.
While recording:
@@ -46,25 +59,44 @@ Hovering or focusing a step highlights the lines it generated. The source previe
## Save and run
-Open **Test Description** to set the test title and file name. **Save** writes the test below the selected project's `tests/` directory. Mobile Dev refuses paths outside that directory and asks before replacing an existing file.
+Open **Test Description** to set the test title and file name. **Save** writes the test to the project's `tests/` directory, or to Mobile Dev's storage in **No project** mode. Mobile Dev refuses paths outside that directory and asks before replacing an existing file.
+
+**Run test** releases the recorder's device session and starts the runner. The preview marks each step as it starts and finishes, then shows the verdict and duration.
-**Run test** saves pending recording changes, releases the recorder's device session, and starts the project's local e2e CLI. The preview marks each reported step as it starts and finishes, then shows the runner's verdict and duration. A run never downloads a CLI with `npx`.
+Saved tests are listed under **In the project** or **In Testing Studio**. Open one to preview its source, edit a temporary working copy, save or undo those edits, run the full file, or play to one step. Saving refuses to overwrite a file that changed on disk after you opened it.
-Tests already in the project appear under **In the project**. Open one to preview its source, edit a temporary working copy, save or undo those edits, run the full file, or play to one step. Saving refuses to overwrite a file that changed on disk after you opened it.
+## Run on several devices
+
+Open **E2E setup → Devices** to pick where a test runs. The list shows every iOS simulator and Android emulator, whether it is booted, and whether it has the app.
+
+- Tick two or more devices and **Run test** becomes **Run on N devices**. Each device runs the same test in its own lane, with its own steps, verdict and **Cancel**.
+- Tick one device that isn't the mirrored one and the test runs there (**Run on iPhone Air**).
+- **Run up to N at once** sets how many devices work at the same time, from 1 to 8. The rest wait in a queue.
+- A device that is off is booted first.
+- A device without the app gets it copied from another booted device of the same platform that has it, even one you didn't tick.
+- iOS and Android devices can run in the same batch. In a project, each device runs the config's target for its platform.
+
+Click a lane to see that device's steps on the preview. A failure on one device doesn't stop the others. Each `agent.*` step calls the model once per device.
+
+Running a project's test on several devices requires each mobile target's engine to be written as a `mobile({ ... })` call directly in `e2e.config.ts`. Mobile Dev runs each device with a temporary copy of the config pinned to that device, and removes the copy when the run ends.
## Unsaved recordings
-Recordings that have not been written into the project appear under **Not stored**. Mobile Dev keeps them in its own application-support directory, scoped to the selected project, so switching tools or chats does not discard the flow. Saving moves the flow into the project's test list. Deleting an unsaved recording or a project test asks for confirmation because neither action can be undone in the panel.
+Recordings that have not been saved appear under **Not stored**. Mobile Dev keeps them in its own application-support directory, scoped to the selected project, so switching tools or chats does not discard the flow. Saving moves the flow into the test list. Deleting an unsaved recording or a saved test asks for confirmation because neither action can be undone in the panel.
+
+## Ask your agent
+
+Keep **Testing Studio** open, then ask your coding agent, for example:
-## Ask your agent to record
+> Use the opened iOS app and record a test for searching the city list.
-You can ask your coding agent to record a screen or flow, for example:
+> Run that test on iOS and Android side by side.
-> Use Mobile Dev to record an e2e test for searching the city list.
+The agent records against the app in the mirror, adding one step at a time while you watch. Manual input is locked during that session so two drivers can't act on the same screen.
-Choose the project, device, and target first. The agent opens Testing, reads the same runner-projected element tree, and adds one step at a time while the mirror shows the app changing. Manual input is locked during that session so two drivers cannot act on the same screen.
+In **No project** mode the agent saves the finished test and can run it on several devices. If a platform has no app yet, the agent asks you to open it, picks it up, and runs on both. If a step fails on one device because a locator changed, the agent can replace that locator and run again; it never weakens or removes an assertion.
-When the agent finishes, its steps stay as an unsaved recording. The agent does not save or run the test; review the flow, adjust it, and choose when it should enter the repository.
+In a project, the recording stays unsaved for you to review, adjust and save.
## Data and telemetry
diff --git a/website/src/pages/index.astro b/website/src/pages/index.astro
index ede63e85..ae84c7a1 100644
--- a/website/src/pages/index.astro
+++ b/website/src/pages/index.astro
@@ -10,7 +10,7 @@ const tools = [
{ name: 'Performance', href: docs.performance },
{ name: 'Storage', href: docs.storage },
{ name: 'App Intelligence', href: docs.appIntelligence },
- { name: 'Testing', href: docs.testing },
+ { name: 'Testing Studio', href: docs.testing },
];
---
From 50ac9c71eed6d77882e9e8445ac0c520fece12b8 Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Fri, 20 Nov 2026 16:10:18 +0500
Subject: [PATCH 22/23] fix: bugs
---
packages/core/src/device-apps/apps.ts | 16 +++++++-
packages/core/src/plugin.ts | 8 +++-
packages/core/src/testing-tools.ts | 18 +++++++--
packages/core/test/cpu-sessions.test.ts | 5 +++
.../test/testing-foreground-target.test.ts | 35 ++++++++++++++++
packages/ui/src/testing-panel.ts | 40 ++++++++++++++-----
packages/ui/test/testing-panel.test.ts | 23 +++++++++++
7 files changed, 127 insertions(+), 18 deletions(-)
create mode 100644 packages/core/test/testing-foreground-target.test.ts
diff --git a/packages/core/src/device-apps/apps.ts b/packages/core/src/device-apps/apps.ts
index 8698d983..19ba7fea 100644
--- a/packages/core/src/device-apps/apps.ts
+++ b/packages/core/src/device-apps/apps.ts
@@ -66,11 +66,12 @@ export async function runningPhysicalApps(deviceId: string, signal?: AbortSignal
return parsePhysicalApps(results[0].stdout, results[1].stdout);
}
-export function parseRunningApps(output: string): DeviceApp[] {
+/** The running simulator apps in `launchctl list` output. Apple's own apps are left out unless `includeSystem`. */
+export function parseRunningApps(output: string, includeSystem = false): DeviceApp[] {
const apps: DeviceApp[] = [];
for (const line of output.split("\n")) {
const match = /^\s*(\d+)\s+-?\d+\s+UIKitApplication:([^\[\s]+)\[/.exec(line);
- if (match === null || match[2].startsWith("com.apple.")) continue;
+ if (match === null || (!includeSystem && match[2].startsWith("com.apple."))) continue;
const pid = Number(match[1]);
if (Number.isSafeInteger(pid) && pid > 0) apps.push({ bundleId: match[2], pid });
}
@@ -83,6 +84,17 @@ export async function runningSimulatorApps(deviceId: string, signal?: AbortSigna
return parseRunningApps(result.stdout);
}
+/**
+ * The bundle id of the simulator app running as `pid`, Apple's own apps included. The app lists above
+ * leave those out because nothing can monitor them, but Testing Studio records against whatever app
+ * is in front, Fitness or Settings as much as the user's own.
+ */
+export async function simulatorBundleForPid(deviceId: string, pid: number, signal?: AbortSignal): Promise {
+ if (process.platform !== "darwin") return undefined;
+ const result = await runDiscoveryCommand("ios_simulator_apps", "xcrun", ["simctl", "spawn", deviceId, "launchctl", "list"], { encoding: "utf8", timeout: 5000, maxBuffer: 1024 * 1024, signal });
+ return parseRunningApps(result.stdout, true).find(app => app.pid === pid)?.bundleId;
+}
+
export function parseAndroidApps(packages: string, processes: string): DeviceApp[] {
const installed = new Set();
for (const line of packages.split("\n")) {
diff --git a/packages/core/src/plugin.ts b/packages/core/src/plugin.ts
index a8e77f8c..b1aed8a5 100644
--- a/packages/core/src/plugin.ts
+++ b/packages/core/src/plugin.ts
@@ -35,6 +35,7 @@ import { CpuSessions, createCpuSessions } from "./cpu/sessions.ts";
import { registerCpuTools } from "./cpu/tools.ts";
import { deviceAppSources, readDeviceApps } from "./device-apps/sources.ts";
import { unknownSimulatorForeground } from "./device-apps/foreground.ts";
+import { simulatorBundleForPid } from "./device-apps/apps.ts";
import { PerformanceRecordings } from "./performance-recordings.ts";
import { registerRecordingTools } from "./recording-tools.ts";
import { RECORDING_URI } from "@mobile-dev/shared/recordings.ts";
@@ -130,7 +131,12 @@ export async function createPlugin(html: string | (() => Promise), o
// One recordings object too: it holds the panel's context, which the model-visible run tools check.
const testingOps = systemDeviceOps({
simulators, android, drivers,
- foreground: async (platform, deviceId) => (await readDeviceApps(deviceId, undefined, platform, platform === "ios" ? "simulator" : undefined, { ...deviceAppSources, simulator: simulatorForeground })).foregroundApp?.bundleId ?? null,
+ foreground: async (platform, deviceId) => {
+ const front = (await readDeviceApps(deviceId, undefined, platform, platform === "ios" ? "simulator" : undefined, { ...deviceAppSources, simulator: simulatorForeground })).foregroundApp;
+ // An Apple app in front has no bundle id in the monitoring list; Testing Studio records it all the same.
+ if (front?.bundleId || !front?.pid || platform !== "ios") return front?.bundleId ?? null;
+ return await simulatorBundleForPid(deviceId, front.pid).catch(() => undefined) ?? null;
+ },
});
const testingRecordings = new TestingAgentRecordings(testingDevices, testDrafts, { ops: testingOps });
const testingProjects = new TestingProjectChoices(TESTING_DIRECTORY);
diff --git a/packages/core/src/testing-tools.ts b/packages/core/src/testing-tools.ts
index 2b0cdaf6..66f11059 100644
--- a/packages/core/src/testing-tools.ts
+++ b/packages/core/src/testing-tools.ts
@@ -22,6 +22,7 @@ import type { LaneExecutor, MatrixDevice, MatrixRun } from "./testing-matrix.ts"
import { LAUNCHER_APP, createLaneExecutor } from "./testing-prepare.ts";
import type { DeviceOps } from "./testing-prepare.ts";
import { deviceIdSchema } from "@mobile-dev/shared/panel-target.ts";
+import { simulatorBundleForPid } from "./device-apps/apps.ts";
import type { BundledModelProvider } from "./testing-run.ts";
import { answerTestingSetup, applyTestingSetup, cancelTestingSetup, inspectTestingSetup, planTestingSetup, readTestingModelPreference, saveTestingModelPreference, SETUP_PROVIDERS, startTestingLogin, testingSetupProgress } from "./testing-setup.ts";
import type { SetupOptions } from "./testing-setup.ts";
@@ -98,7 +99,7 @@ export function projectLaneTargets(targets: readonly { name: string; platform?:
/** The Testing Studio panel's project selection, and the device tree its recorder names selectors from. */
/** Returns the shutdown the plugin has to run: the recorder's device session, handed back. */
-export function registerTestingTools(server: McpServer, projects: TestingProjectChoices, devices = new TestingDevices(), drafts = new TestDraftStore(), matrix: { ops?: DeviceOps; registry?: MatrixRegistry; run?: typeof runRecordedTest; panel?: PanelContext; pollMs?: number; failureReadMs?: number } = {}): () => Promise {
+export function registerTestingTools(server: McpServer, projects: TestingProjectChoices, devices = new TestingDevices(), drafts = new TestDraftStore(), matrix: { ops?: DeviceOps; registry?: MatrixRegistry; run?: typeof runRecordedTest; panel?: PanelContext; pollMs?: number; failureReadMs?: number; foregroundBundle?: (deviceId: string, pid: number) => Promise } = {}): () => Promise {
/**
* Every run, as a matrix of lanes; a single run is a matrix of one.
*
@@ -306,11 +307,20 @@ export function registerTestingTools(server: McpServer, projects: TestingProject
registerAppTool(server, "mobile_testing_project_config", {
title: "Read a testing project's config",
description: "Read the targets of a project's e2e config: the target names, their platforms, and the bundle ids to launch.",
- inputSchema: { projectPath, foregroundPlatform: z.enum(["ios", "android"]).optional(), foregroundBundleId: z.string().min(1).max(512).optional() },
+ inputSchema: {
+ projectPath, foregroundPlatform: z.enum(["ios", "android"]).optional(), foregroundBundleId: z.string().min(1).max(512).optional(),
+ foregroundDeviceId: deviceIdSchema.optional().describe("With foregroundPid, for an iOS simulator app the device's app list leaves out (Apple's own apps)."),
+ foregroundPid: z.number().int().positive().optional(),
+ },
annotations: read,
_meta: appVisibility,
- }, safe(async ({ projectPath: selected, foregroundPlatform, foregroundBundleId }: { projectPath: string; foregroundPlatform?: "ios" | "android"; foregroundBundleId?: string }) => {
- const project = await inspectProject(selected, foregroundPlatform && foregroundBundleId ? { platform: foregroundPlatform, bundleId: foregroundBundleId } : undefined);
+ }, safe(async ({ projectPath: selected, foregroundPlatform, foregroundBundleId, foregroundDeviceId, foregroundPid }: { projectPath: string; foregroundPlatform?: "ios" | "android"; foregroundBundleId?: string; foregroundDeviceId?: string; foregroundPid?: number }) => {
+ // The panel's device list names only apps that can be monitored, so an Apple app in front (Fitness,
+ // Settings) arrives as a pid alone. The home screen is never an app to record.
+ const resolved = foregroundBundleId ?? (foregroundPlatform === "ios" && foregroundDeviceId && foregroundPid
+ ? await (matrix.foregroundBundle ?? simulatorBundleForPid)(foregroundDeviceId, foregroundPid).catch(() => undefined) : undefined);
+ const bundleId = resolved && !LAUNCHER_APP.test(resolved) ? resolved : undefined;
+ const project = await inspectProject(selected, foregroundPlatform && bundleId ? { platform: foregroundPlatform, bundleId } : undefined);
return dataResult({ ...project, setup: await inspectTestingSetup(project.path, project.configPath || undefined), modelPreference: await readTestingModelPreference(), providers: SETUP_PROVIDERS });
}));
diff --git a/packages/core/test/cpu-sessions.test.ts b/packages/core/test/cpu-sessions.test.ts
index 0454a34c..ff7b9fc4 100644
--- a/packages/core/test/cpu-sessions.test.ts
+++ b/packages/core/test/cpu-sessions.test.ts
@@ -16,6 +16,11 @@ test("running app discovery excludes system services, exited apps, and malformed
assert.deepEqual(apps, [{ bundleId: "com.example.app", pid: 123 }]);
});
+test("Apple's own apps are listed only when asked for, so Testing Studio can name one in front", () => {
+ const output = "PID\tStatus\tLabel\n123\t0\tUIKitApplication:com.example.app[1]\n456\t0\tUIKitApplication:com.apple.Fitness[1]";
+ assert.deepEqual(parseRunningApps(output, true), [{ bundleId: "com.example.app", pid: 123 }, { bundleId: "com.apple.Fitness", pid: 456 }]);
+});
+
test("CPU batches retain 150 seconds, report only new samples, and release waiting reads on close", async () => {
const buffer = new CpuBuffer("physical-footprint");
for (let time = 0; time <= 200; time++) buffer.push({ time, interval: 1, cpuPercent: time, memoryBytes: 104857600, threads: [] });
diff --git a/packages/core/test/testing-foreground-target.test.ts b/packages/core/test/testing-foreground-target.test.ts
new file mode 100644
index 00000000..8324b7b7
--- /dev/null
+++ b/packages/core/test/testing-foreground-target.test.ts
@@ -0,0 +1,35 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { mkdtemp } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { Client } from "@modelcontextprotocol/sdk/client/index.js";
+import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
+import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
+import { registerTestingTools } from "../src/testing-tools.ts";
+import { TestingProjectChoices } from "../src/testing-projects.ts";
+import { TestingDevices } from "../src/testing-device.ts";
+
+async function connect(root: string, apps: Record) {
+ const server = new McpServer({ name: "t", version: "1" });
+ const looked: number[] = [];
+ registerTestingTools(server, new TestingProjectChoices(join(root, "state")), new TestingDevices(), undefined, {
+ foregroundBundle: async (_deviceId, pid) => { looked.push(pid); return apps[pid]; },
+ });
+ const client = new Client({ name: "c", version: "1" });
+ const [a, b] = InMemoryTransport.createLinkedPair();
+ await Promise.all([server.connect(a), client.connect(b)]);
+ return { client, looked };
+}
+
+const targets = async (client: Client, args: Record) =>
+ ((await client.callTool({ name: "mobile_testing_project_config", arguments: args })).structuredContent as { targets: { bundleId: string }[] }).targets.map(target => target.bundleId);
+
+test("an Apple app in front, known only by its pid, becomes the No project target", async () => {
+ const root = await mkdtemp(join(tmpdir(), "foreground-target-"));
+ const { client, looked } = await connect(root, { 9: "com.apple.Fitness", 1: "com.apple.springboard" });
+ assert.deepEqual(await targets(client, { projectPath: root, foregroundPlatform: "ios", foregroundDeviceId: "SIM-1", foregroundPid: 9 }), ["com.apple.Fitness"]);
+ assert.deepEqual(await targets(client, { projectPath: root, foregroundPlatform: "ios", foregroundDeviceId: "SIM-1", foregroundPid: 1 }), [], "the home screen is never a target");
+ assert.deepEqual(await targets(client, { projectPath: root, foregroundPlatform: "ios", foregroundBundleId: "com.example.app" }), ["com.example.app"]);
+ assert.deepEqual(looked, [9, 1], "a named bundle id needs no lookup");
+});
diff --git a/packages/ui/src/testing-panel.ts b/packages/ui/src/testing-panel.ts
index 1977efc7..a82dd1ab 100644
--- a/packages/ui/src/testing-panel.ts
+++ b/packages/ui/src/testing-panel.ts
@@ -296,10 +296,14 @@ export class TestingPanel {
// so the selection is reported whenever either half moves.
this.stopWatchingDevices = deviceApps.subscribe(() => {
void this.reportContext();
- const front = deviceApps.getSnapshot().foregroundApp?.bundleId;
- if (this.snapshot.projectPath && this.snapshot.runtimeMode === "bundled" && front) {
+ const { foregroundApp } = deviceApps.getSnapshot();
+ const front = foregroundApp?.bundleId;
+ if (this.snapshot.projectPath && this.snapshot.runtimeMode === "bundled") {
// Only the targets: reloading the whole project here would close the test the user has open.
- if (this.snapshot.targets.every(entry => entry.bundleId !== front)) void this.refreshStudioTargets();
+ if (front && this.snapshot.targets.every(entry => entry.bundleId !== front)) void this.refreshStudioTargets();
+ // An app the device list cannot name (Apple's own, or the home screen) is still the app in
+ // front: keeping the last app's target would have Record open that one instead.
+ else if (!front && foregroundApp?.pid && this.noProject && this.studioForegroundKey !== `pid:${foregroundApp.pid}`) void this.refreshStudioTargets();
}
});
// Every change to what would be written bumps the recorder's revision, which is exactly the
@@ -577,20 +581,29 @@ export class TestingPanel {
const { projectPath } = this.snapshot;
const { device, foregroundApp } = this.deviceApps.getSnapshot();
const foregroundBundleId = foregroundApp?.bundleId ?? undefined;
- if (!projectPath || !device || !isRecordableDevice(device) || !foregroundBundleId || this.refreshingTargets === foregroundBundleId) return;
- this.refreshingTargets = foregroundBundleId;
+ const pid = foregroundBundleId ? undefined : foregroundApp?.pid ?? undefined;
+ const key = foregroundBundleId ?? (pid ? `pid:${pid}` : "");
+ if (!projectPath || !device || !isRecordableDevice(device) || !key || this.refreshingTargets === key) return;
+ this.refreshingTargets = key;
+ this.studioForegroundKey = key;
const revision = this.loadRevision;
try {
- const response = await this.call("mobile_testing_project_config", { projectPath, foregroundPlatform: recordablePlatform(device), foregroundBundleId });
+ const platform = recordablePlatform(device);
+ const response = await this.call("mobile_testing_project_config", { projectPath, foregroundPlatform: platform,
+ ...(foregroundBundleId ? { foregroundBundleId } : { foregroundDeviceId: device.udid, foregroundPid: pid }) });
if (revision !== this.loadRevision || this.snapshot.runtimeMode !== "bundled") return;
- const targets = parseTargets(object(response.structuredContent) ?? {});
- const preferred = targets.find(entry => entry.platform === recordablePlatform(device)) ?? targets[0];
- this.update({ targets, targetName: preferred?.name ?? "" });
+ const data = object(response.structuredContent) ?? {};
+ const targets = parseTargets(data);
+ const preferred = targets.find(entry => entry.platform === platform) ?? targets[0];
+ const source = text(data.targetSource);
+ this.update({ targets, targetName: preferred?.name ?? "", ...(["expo-cli", "static-expo", "foreground", "none"].includes(source) ? { targetSource: source as TestingSnapshot["targetSource"] } : {}) });
} catch { /* the next foreground change retries */ } finally {
- if (this.refreshingTargets === foregroundBundleId) this.refreshingTargets = "";
+ if (this.refreshingTargets === key) this.refreshingTargets = "";
}
}
private refreshingTargets = "";
+ /** The foreground the Testing Studio targets were last read for, so an unnamed app is read once, not on every device update. */
+ private studioForegroundKey = "";
/** Loads one project's e2e config into the panel. */
async selectProject(projectPath: string) {
@@ -1519,7 +1532,12 @@ export class TestingPanel {
/** The app in front on the mirrored device, as a Testing Studio target. */
get foregroundTarget(): NonNullable | undefined {
const { device, foregroundApp } = this.deviceApps.getSnapshot();
- return device && isRecordableDevice(device) && foregroundApp?.bundleId ? { platform: recordablePlatform(device), bundleId: foregroundApp.bundleId } : undefined;
+ if (!device || !isRecordableDevice(device)) return undefined;
+ const platform = recordablePlatform(device);
+ if (foregroundApp?.bundleId) return { platform, bundleId: foregroundApp.bundleId };
+ // An Apple app in front reaches the panel as a pid alone; the server named it when it read the targets.
+ const read = this.noProject && foregroundApp?.pid && this.studioForegroundKey === `pid:${foregroundApp.pid}` && this.snapshot.targetSource === "foreground" ? this.target : undefined;
+ return read?.bundleId && read.platform === platform ? { platform, bundleId: read.bundleId } : undefined;
}
/** Why Run is unavailable for a selected Testing Studio test, or "": it needs a pinned app or one in front. */
diff --git a/packages/ui/test/testing-panel.test.ts b/packages/ui/test/testing-panel.test.ts
index b0cb0779..28b862b1 100644
--- a/packages/ui/test/testing-panel.test.ts
+++ b/packages/ui/test/testing-panel.test.ts
@@ -538,3 +538,26 @@ test("a launch of a missing app says to build and install it, and other launch e
assert.match(launchErrorMessage("com.app is not installed or could not open.", "com.app", "ios"), /this simulator.*npx expo run:ios/);
assert.equal(launchErrorMessage("The device is busy.", "com.app", "ios"), "The device is busy.");
});
+
+test("an Apple app in front replaces the last app's target in No project mode instead of keeping it", async () => {
+ const listeners = new Set<() => void>();
+ let snapshot: Record = { device: { udid: "sim", name: "iPhone", state: "Booted", runtime: "", platform: "ios", kind: "simulator" }, apps: [], foregroundApp: { bundleId: "com.bare.rn", pid: 2 }, ready: true };
+ const apps = { subscribe: (listener: () => void) => { listeners.add(listener); return () => listeners.delete(listener); }, getSnapshot: () => snapshot } as unknown as DeviceAppsStore;
+ const calls: { name: string; arguments: Record }[] = [];
+ const panel = new TestingPanel(host({ mobile_testing_project_config: { runtimeMode: "bundled", targetSource: "foreground", targets: [{ name: "ios", platform: "ios", bundleId: "com.apple.Fitness" }] } }, calls), apps);
+ panel.setAvailable(true);
+ (panel as unknown as { update(fields: Record): void }).update({ projectPath: PROJECT, studioPath: PROJECT, runtimeMode: "bundled", targetSource: "foreground", targets: [{ name: "ios", platform: "ios", bundleId: "com.bare.rn" }] });
+ // The device list names only apps it can monitor, so Fitness arrives as a pid alone.
+ snapshot = { ...snapshot, foregroundApp: { bundleId: null, pid: 9 } };
+ for (const listener of listeners) listener();
+ await new Promise(resolve => setTimeout(resolve, 0));
+ try {
+ const read = calls.find(call => call.name === "mobile_testing_project_config");
+ assert.deepEqual(read?.arguments, { projectPath: PROJECT, foregroundPlatform: "ios", foregroundDeviceId: "sim", foregroundPid: 9 });
+ assert.equal(panel.target?.bundleId, "com.apple.Fitness", "Record attaches to the app in front, not the Bare RN app");
+ assert.deepEqual(panel.foregroundTarget, { platform: "ios", bundleId: "com.apple.Fitness" });
+ for (const listener of listeners) listener();
+ await new Promise(resolve => setTimeout(resolve, 0));
+ assert.equal(calls.filter(call => call.name === "mobile_testing_project_config").length, 1, "the same unnamed app is read once");
+ } finally { panel.dispose(); }
+});
From ec622b1fc10f73eb0d19ab8d0cd0c34bab9fe46f Mon Sep 17 00:00:00 2001
From: Hur Ali
Date: Fri, 20 Nov 2026 16:52:51 +0500
Subject: [PATCH 23/23] fix: code reviews
---
packages/core/src/testing-matrix.ts | 2 +-
packages/core/test/testing-matrix.test.ts | 20 ++++++
packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt | 72 +++++++++++++++++++
packages/shared/src/stored-test-steps.ts | 13 ++--
.../shared/test/stored-test-steps.test.ts | 14 ++++
packages/ui/src/testing-matrix.ts | 3 +-
packages/ui/src/testing-panel.ts | 7 +-
packages/ui/test/testing-matrix.test.ts | 3 +-
.../test/testing-panel-project-state.test.ts | 13 +++-
tooling/test/e2e-runtime-package.test.ts | 3 +-
tooling/vendor-e2e.mjs | 2 +-
11 files changed, 137 insertions(+), 15 deletions(-)
diff --git a/packages/core/src/testing-matrix.ts b/packages/core/src/testing-matrix.ts
index feb515ac..4b663d89 100644
--- a/packages/core/src/testing-matrix.ts
+++ b/packages/core/src/testing-matrix.ts
@@ -132,7 +132,7 @@ export class MatrixRegistry {
if (deviceId !== undefined && lane.deviceId !== deviceId && lane.resolvedDeviceId !== deviceId) continue;
entry.aborts.get(lane.runId)?.abort();
// A lane that has not started yields at once; an active one is marked when its process ends.
- if (lane.state === "queued") { lane.state = "cancelled"; lane.finishedAt = Date.now(); }
+ if (lane.state === "queued" && lane.startedAt === undefined) { lane.state = "cancelled"; lane.finishedAt = Date.now(); }
cancelled.push(lane);
}
return cancelled;
diff --git a/packages/core/test/testing-matrix.test.ts b/packages/core/test/testing-matrix.test.ts
index 0936796f..f5b35bbd 100644
--- a/packages/core/test/testing-matrix.test.ts
+++ b/packages/core/test/testing-matrix.test.ts
@@ -123,6 +123,26 @@ test("cancelling every lane of a matrix", async () => {
assert.equal(registry.busy, false);
});
+test("cancelling during preparation waits for the active lane to observe the abort", async () => {
+ const preparing = Promise.withResolvers();
+ const registry = new MatrixRegistry();
+ const executor: LaneExecutor = {
+ prepare: async (_lane, _lanes, signal) => {
+ signal.addEventListener("abort", () => preparing.reject(new ExpectedOperationError("cancelled", "cancelled")), { once: true });
+ await preparing.promise;
+ return "dev-0";
+ },
+ run: async () => ({ status: "passed", exitCode: 0, steps: [] }),
+ };
+ const { run, done } = startMatrix(registry, { testPath: "t", devices: devices(1) }, executor);
+ assert.ok(run.lanes[0]!.startedAt, "the lane is active even before preparation reports a phase");
+ assert.equal(run.lanes[0]!.state, "queued");
+ registry.cancel(run.matrixId, "dev-0");
+ assert.equal(run.lanes[0]!.state, "queued", "an active preparation does not appear free before it stops");
+ await done;
+ assert.equal(run.lanes[0]!.state, "cancelled");
+});
+
test("the registry finds runs, reports busy devices and drops old finished ones", async () => {
const registry = new MatrixRegistry(2);
const instant: LaneExecutor = { prepare: async lane => lane.deviceId, run: async () => ({ status: "passed", exitCode: 0, steps: [] }) };
diff --git a/packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt b/packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt
index 0b899cbc..e84bdcee 100644
--- a/packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt
+++ b/packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt
@@ -34,6 +34,24 @@ limitations under the License.
====================
+@ai-sdk/gateway/node_modules/@ai-sdk/provider 4.0.36 (LICENSE)
+
+Copyright 2023 Vercel, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+====================
+
@ai-sdk/google 4.0.77 (LICENSE)
Copyright 2023 Vercel, Inc.
@@ -88,6 +106,24 @@ limitations under the License.
====================
+@ai-sdk/openai/node_modules/@ai-sdk/provider 4.0.36 (LICENSE)
+
+Copyright 2023 Vercel, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+====================
+
@ai-sdk/provider 4.0.17 (LICENSE)
Copyright 2023 Vercel, Inc.
@@ -1658,6 +1694,24 @@ limitations under the License.
====================
+ai/node_modules/@ai-sdk/provider 4.0.36 (LICENSE)
+
+Copyright 2023 Vercel, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+====================
+
assertion-error 2.0.1 (LICENSE)
MIT License
@@ -1982,6 +2036,24 @@ This product includes software developed at TesterArmy, Inc.
====================
+e2e/node_modules/@ai-sdk/provider 4.0.37 (LICENSE)
+
+Copyright 2023 Vercel, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+====================
+
eslint-visitor-keys 5.0.1 (LICENSE)
Apache License
diff --git a/packages/shared/src/stored-test-steps.ts b/packages/shared/src/stored-test-steps.ts
index ea9e62b6..cd7ca4ba 100644
--- a/packages/shared/src/stored-test-steps.ts
+++ b/packages/shared/src/stored-test-steps.ts
@@ -125,6 +125,8 @@ export function branchStoredStepLocator(source: string, line: number, platform:
const step = storedTestSteps(source).find(entry => entry.line === line);
const current = step && stepLocator(step.label);
if (!step || !current || !locator.startsWith("screen.")) return source;
+ const withFixture = withPlatformFixture(source);
+ if (withFixture === undefined) return source;
// An action's branch is wrapped in parentheses so `.tap()` applies to it; read it without them.
const existing = (/^\(.*\)$/.test(current) ? current.slice(1, -1) : current).match(BRANCH);
// An action needs the branch parenthesised for `.tap()` to apply to its result; an argument does not.
@@ -135,19 +137,22 @@ export function branchStoredStepLocator(source: string, line: number, platform:
: existing[1] === platform ? `platform === "${platform}" ? ${locator} : ${existing[3]}`
: `platform === "${existing[1]}" ? ${existing[2]} : ${locator}`;
const replacement = isAction ? `(${branch})` : branch;
- const changed = editLine(source, line, (lines, index) => {
+ const changed = editLine(withFixture, line, (lines, index) => {
const text = lines[index]!;
const at = text.indexOf(current);
if (at >= 0) lines[index] = text.slice(0, at) + replacement + text.slice(at + current.length);
});
- return changed === source ? source : withPlatformFixture(changed);
+ return changed === withFixture ? source : changed;
}
/** Adds `platform` to the test callback's destructured fixtures when it is not there yet. */
-function withPlatformFixture(source: string): string {
- return source.replace(/(\btest\s*\([^,]+,\s*async\s*\(\s*\{)([^}]*)(\}\s*\)\s*=>)/, (whole, open: string, fixtures: string, close: string) => {
+function withPlatformFixture(source: string): string | undefined {
+ let found = false;
+ const changed = source.replace(/(\btest\s*\(\s*(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`)\s*,\s*async\s*\(\s*\{)([^}]*)(\}\s*\)\s*=>)/, (whole, open: string, fixtures: string, close: string) => {
+ found = true;
if (/\bplatform\b/.test(fixtures)) return whole;
const names = fixtures.trim().replace(/,$/, "");
return `${open} ${names ? `${names}, ` : ""}platform ${close}`;
});
+ return found ? changed : undefined;
}
diff --git a/packages/shared/test/stored-test-steps.test.ts b/packages/shared/test/stored-test-steps.test.ts
index ae419755..02e01f09 100644
--- a/packages/shared/test/stored-test-steps.test.ts
+++ b/packages/shared/test/stored-test-steps.test.ts
@@ -64,3 +64,17 @@ test("flow", async ({ app, screen }) => {
assert.equal(branchStoredStepLocator(source, 5, "android", 'screen.getByText("Home")'), source);
assert.equal(branchStoredStepLocator(source, 6, "android", "tapAt({ x: 1, y: 2 })"), source);
});
+
+test("a locator branch handles commas in quoted titles and requires a platform fixture", () => {
+ const source = `import { test } from "@e2e-dev/mobile";
+test("sign in, then search", async ({ app, screen }) => {
+ await app.open();
+ await screen.getByText("Search").tap();
+});`;
+ const changed = branchStoredStepLocator(source, 4, "android", 'screen.getByTestId("search")');
+ assert.match(changed, /test\("sign in, then search", async \(\{ app, screen, platform \}\) =>/);
+ assert.match(changed, /await \(platform === "android" \? screen\.getByTestId\("search"\) : screen\.getByText\("Search"\)\)\.tap\(\);/);
+
+ const unrecognized = source.replace('test("sign in, then search",', "test(flowName,");
+ assert.equal(branchStoredStepLocator(unrecognized, 4, "android", 'screen.getByTestId("search")'), unrecognized);
+});
diff --git a/packages/ui/src/testing-matrix.ts b/packages/ui/src/testing-matrix.ts
index 9fa10ad1..d5d12cad 100644
--- a/packages/ui/src/testing-matrix.ts
+++ b/packages/ui/src/testing-matrix.ts
@@ -14,7 +14,7 @@ export type LaneProgress = { stepIndex: number; phase: "start" | "end"; status?:
export type LaneResult = { status: string; steps: { line: number; status: string; error?: string }[]; error?: string; output?: string; durationMs?: number };
export type MatrixLane = {
runId: string; deviceId: string; deviceName: string; platform: MatrixPlatform; state: LaneState;
- progress: LaneProgress[]; result?: LaneResult; error?: string; startedAt?: number; finishedAt?: number;
+ resolvedDeviceId?: string; progress: LaneProgress[]; result?: LaneResult; error?: string; startedAt?: number; finishedAt?: number;
};
export type MatrixView = { matrixId: string; /** The test the lanes run, relative to the project. */ testPath?: string; lanes: MatrixLane[]; limit: number; startedAt: number; finishedAt?: number };
@@ -76,6 +76,7 @@ export function parseMatrix(value: unknown): MatrixView | null {
lanes.push({
runId: str(lane.runId), deviceId: str(lane.deviceId), deviceName: str(lane.deviceName) || str(lane.deviceId), platform: lane.platform,
state: str(lane.state) as LaneState,
+ ...(str(lane.resolvedDeviceId) ? { resolvedDeviceId: str(lane.resolvedDeviceId) } : {}),
progress: (Array.isArray(lane.progress) ? lane.progress : []).map(record).filter((entry): entry is Record => entry !== null
&& typeof entry.stepIndex === "number" && (entry.phase === "start" || entry.phase === "end"))
.map(entry => ({ stepIndex: entry.stepIndex as number, phase: entry.phase as "start" | "end", ...(str(entry.status) ? { status: str(entry.status) } : {}), ...(str(entry.error) ? { error: str(entry.error) } : {}) })),
diff --git a/packages/ui/src/testing-panel.ts b/packages/ui/src/testing-panel.ts
index a82dd1ab..1733c79e 100644
--- a/packages/ui/src/testing-panel.ts
+++ b/packages/ui/src/testing-panel.ts
@@ -915,8 +915,9 @@ export class TestingPanel {
// A single-mirror layout first switches to the lane's platform, since a hidden mirror cannot
// show a device. Only on the click itself, so a platform the user switches back to stays.
this.onLaneSelected?.(lane.platform);
- if (this.deviceApps.getSnapshot().device?.udid === lane.deviceId) return;
- if (this.mirrorDevice?.(lane.platform, lane.deviceId)) countUiEvent("ui.testing.lane_mirror");
+ const deviceId = lane.resolvedDeviceId ?? lane.deviceId;
+ if (this.deviceApps.getSnapshot().device?.udid === deviceId) return;
+ if (this.mirrorDevice?.(lane.platform, deviceId)) countUiEvent("ui.testing.lane_mirror");
}
private onLaneSelected?: (platform: "ios" | "android") => void;
@@ -1842,7 +1843,7 @@ export class TestingPanel {
/** Whether a lane of the run on screen still holds this device. */
matrixBusy(deviceId: string): boolean {
- return this.snapshot.matrix?.lanes.some(lane => !isTerminalLane(lane.state) && lane.deviceId === deviceId) ?? false;
+ return this.snapshot.matrix?.lanes.some(lane => !isTerminalLane(lane.state) && (lane.deviceId === deviceId || lane.resolvedDeviceId === deviceId)) ?? false;
}
setMatrixSelection(ids: string[]) {
diff --git a/packages/ui/test/testing-matrix.test.ts b/packages/ui/test/testing-matrix.test.ts
index 6f70314c..7c8063f9 100644
--- a/packages/ui/test/testing-matrix.test.ts
+++ b/packages/ui/test/testing-matrix.test.ts
@@ -33,12 +33,13 @@ test("the limit is kept between 1 and 8", () => { assert.deepEqual([clampLimit(0
test("the server's lanes are read defensively", () => {
const parsed = parseMatrix({ matrixId: "m", limit: 2, startedAt: 5, lanes: [
- { runId: "a", deviceId: "A", deviceName: "iPhone 17", platform: "ios", state: "running", progress: [{ stepIndex: 0, phase: "start" }, { nope: 1 }] },
+ { runId: "a", deviceId: "avd:Pixel", resolvedDeviceId: "emulator-5554", deviceName: "Pixel", platform: "android", state: "running", progress: [{ stepIndex: 0, phase: "start" }, { nope: 1 }] },
{ runId: "b", deviceId: "B", platform: "android", state: "passed", progress: [], result: { status: "passed", steps: [{ line: 4, status: "passed" }, { line: 0, status: "x" }], durationMs: 12 } },
{ runId: "c", platform: "windows", state: "running" }, { runId: "d", platform: "ios", state: "weird" },
] });
assert.equal(parsed?.lanes.length, 2);
assert.equal(parsed?.lanes[0]?.progress.length, 1);
+ assert.equal(parsed?.lanes[0]?.resolvedDeviceId, "emulator-5554");
assert.deepEqual(parsed?.lanes[1]?.result?.steps, [{ line: 4, status: "passed" }]);
assert.equal(parseMatrix({ lanes: [] }), null);
});
diff --git a/packages/ui/test/testing-panel-project-state.test.ts b/packages/ui/test/testing-panel-project-state.test.ts
index 219633db..422e0f24 100644
--- a/packages/ui/test/testing-panel-project-state.test.ts
+++ b/packages/ui/test/testing-panel-project-state.test.ts
@@ -76,7 +76,11 @@ test("clicking a lane switches the layout and mirror to it, and a poll does not"
storage();
const panel = new TestingPanel(host([]), deviceApps, { heartbeatMs: 1e9 });
t.after(() => panel.dispose?.());
- const lane = (platform: "ios" | "android", state: string) => ({ runId: `r-${platform}`, deviceId: `d-${platform}`, deviceName: platform, platform, state, progress: [] });
+ const lane = (platform: "ios" | "android", state: string) => ({
+ runId: `r-${platform}`, deviceId: platform === "android" ? "avd:Pixel" : "d-ios",
+ ...(platform === "android" ? { resolvedDeviceId: "emulator-5554" } : {}),
+ deviceName: platform, platform, state, progress: [],
+ });
const internals = panel as unknown as { update(fields: Record): void; readMatrix(id: string): Promise };
internals.update({ matrix: { matrixId: "m", limit: 3, startedAt: 1, lanes: [lane("ios", "passed"), lane("android", "failed")] }, selectedLane: "r-ios" });
const picked: string[] = [], focused: string[] = [];
@@ -84,9 +88,12 @@ test("clicking a lane switches the layout and mirror to it, and a poll does not"
panel.setMirrorDevice((platform, deviceId) => { focused.push(`${platform}:${deviceId}`); return true; });
panel.openLane("r-android");
assert.deepEqual(picked, ["android"]);
- assert.deepEqual(focused, ["android:d-android"]);
+ assert.deepEqual(focused, ["android:emulator-5554"], "the running emulator serial is mirrored instead of its requested AVD id");
+ internals.update({ matrix: { matrixId: "m", limit: 3, startedAt: 1, lanes: [lane("ios", "passed"), lane("android", "running")] } });
+ assert.equal(panel.matrixBusy("avd:Pixel"), true, "the requested checklist id stays busy");
+ assert.equal(panel.matrixBusy("emulator-5554"), true, "the resolved running id is busy too");
panel.openLane("r-ios");
- assert.deepEqual(focused, ["android:d-android", "ios:d-ios"]);
+ assert.deepEqual(focused, ["android:emulator-5554", "ios:d-ios"]);
// The panel's own refresh of the run re-selects the lane quietly: it must not move the mirror.
const before = focused.length;
await internals.readMatrix("m").catch(() => undefined);
diff --git a/tooling/test/e2e-runtime-package.test.ts b/tooling/test/e2e-runtime-package.test.ts
index d3b18e1b..c01b569f 100644
--- a/tooling/test/e2e-runtime-package.test.ts
+++ b/tooling/test/e2e-runtime-package.test.ts
@@ -22,6 +22,7 @@ test("the release metadata pins every bundled e2e runtime dependency", async ()
test("the bundled e2e runtime ships notices and is not panel-only", async () => {
const notices = await readFile("packages/runtimes/e2e/THIRD_PARTY_NOTICES.txt", "utf8");
assert.ok(notices.length > 10_000);
- assert.match(notices, /e2e 0\.17\.0/);
+ assert.match(notices, /e2e 0\.23\.1/);
+ assert.match(notices, /@ai-sdk\/gateway\/node_modules\/@ai-sdk\/provider 4\.0\.36/);
assert.equal(PANEL_PARTS.includes("e2e"), false);
});
diff --git a/tooling/vendor-e2e.mjs b/tooling/vendor-e2e.mjs
index 5feb382d..ca5d37cf 100644
--- a/tooling/vendor-e2e.mjs
+++ b/tooling/vendor-e2e.mjs
@@ -14,7 +14,7 @@ for (const [key, metadata] of Object.entries(packages)) {
const name = key.slice("node_modules/".length);
// Nested transitive packages are represented by another /node_modules/ segment. Their license
// is still included, but the lock entry's path is the unambiguous package label.
- if (!name || name.includes("/node_modules/")) continue;
+ if (!name) continue;
const directory = join(runtime, key);
const files = await readdir(directory).catch(() => []);
for (const file of files.filter(name => /^(LICENSE|LICENCE|COPYING|NOTICE)(\.|$)/i.test(name))) {