feat(cli): select web and mobile together in e2e init
e2e init asked for one engine, so a project testing a web app and a mobile app had to hand-edit the config. The engine question is now a multiselect.
- The prompt lists Web (preselected) and Mobile (iOS/Android). Submitting with nothing selected replaces the old None option: clack's multiselect can't keep None exclusive.
--enginetakes a comma-separated or repeated list, like--skills:--engine web,mobile.--engine mobileand--engine nonework as before;nonewith an engine is a usage error (packages/e2e/src/cli/init/flags.ts).- One engine writes exactly what it wrote before. Both write a target each and
workers: 1(the mobile setting, which now also covers the web target). - With both, the examples go in
tests/web.e2e.tsandtests/mobile.e2e.ts, each test withrequires: ['browser']orrequires: ['device']. Without it, each test would also run on the other target and fail withUNSUPPORTED_CAPABILITY.docs/reference/mobile.mdxalready recommendsrequires: ['device']for mixed suites. - Presets now hold a target entry and settings instead of a finished
targetsblock, andcreateScaffoldcomposes them (packages/e2e/src/cli/init/scaffold.ts). The engine-less config moved there from the preset list, since it's no longer a prompt choice. - A re-run on a project with an existing config adds no
tests/example.e2e.tswhen the per-engine examples are there, soinitstays idempotent. - Telemetry's
enginereportsweb,mobile, in preset order whatever the toggle order.
// e2e.config.ts from --engine web,mobile on macOS
export default {
targets: [
{
engine: web(),
app: {
url: process.env.APP_URL ?? 'http://localhost:3000',
// Or let the runner start the dev server:
// command: { executable: 'npm', args: ['run', 'dev'] },
},
},
// Replace Settings with your app's bundle id.
{ name: 'ios', engine: mobile({ platform: 'ios' }), app: { bundleId: 'Settings' } },
],
workers: 1,
} satisfies E2EConfig;
Verified
Ran it locally: yes, with the built CLI on scratch projects (verify surface: a scratch project for init).
The prompt in a real pseudo-terminal, after toggling Mobile with Space and pressing Enter:
◆ Which engines? Select none for HTTP tests or your own engine.
│ ◼ Web (Playwright)
│ ◼ Mobile (iOS/Android) (agent-device)
...
◇ Which engines? Select none for HTTP tests or your own engine.
│ Web, Mobile (iOS/Android)
│
◆ Which model gateway for agent steps? Adds AI SDK v7.
e2e init --yes --engine web,mobile, then e2e list with the workspace packages linked: each example runs on its own target only.
tests/mobile.e2e.ts › Settings opens [web] (skipped: engine lacks required capabilities: device)
tests/web.e2e.ts › app opens [web]
tests/mobile.e2e.ts › Settings opens [ios]
tests/web.e2e.ts › app opens [ios] (skipped: engine lacks required capabilities: browser)
A second e2e init --yes on that project prints Nothing to create; project already initialized and leaves tests/ with the two files.
The new integration test in packages/e2e/tests/integration/cli-init.test.ts runs e2e run --target web on the generated project against a local page: the web example passes.
Not run: the mobile example on a simulator or emulator. The single-engine mobile scaffold is unchanged, and the combined one is the same target entry inside a list.