feat(e2e): add a desktop engine to e2e init
What
e2e init has a desktop engine for native macOS apps: npx e2e init --engine desktop, or "Desktop (macOS)" at the prompt.
// Replace com.apple.calculator with your app's bundle id, or set appPath to a built .app.
{ name: 'macos', engine: desktop(), app: { bundleId: 'com.apple.calculator' } },
It also writes a Calculator example test and the @e2e-dev/desktop dependency. A CI pipeline written by init has no job for the macOS target, and init says so. Off macOS, init warns that the target does not run on that machine.
Why
Init offered web, mobile, and Electron only, so a desktop user had to write the config and first test by hand. Init is the onboarding path for the desktop launch.
How it works
- The preset is one entry in
getEnginePresets()(packages/e2e/src/cli/init/engines.ts:144). The--engineflag, the prompt, the scaffold, and the example files all derive from that list. The target opens Calculator the way the mobile preset opens Settings, so the example passes before the user points it at their own app. - The build records the desktop version for the dependency range (
packages/e2e/scripts/write-sibling-versions.ts:20). NO_JOBinpackages/e2e/src/cli/init/ci.ts:242was a set holding'electron'. It is now a map from platform to what running it in CI takes and the docs path, withmacosadded.ciJobskeeps both out of the web job, andwithoutJobNotices(ci.ts:253) builds the warning per platform, whereinit.tshad the Electron sentence inline.init.tsno longer checks engine ids. Whether to offer a pipeline ishasJob(preset.platform)(init.ts:469). The fallback for a config that does not load reads the no-job engine packages from the presets (noJobEngines,init.ts:862). The "point the target at your app" step of theNext:line is a preset field,pointAtApp(init.ts:877).- A preset can name the one host OS it runs on (
host,engines.ts:26). Init warns when it differs fromos.platform()(init.ts:341) and still writes the target, since a config with a desktop target loads on any OS.
Decision: no macOS job in the pipeline. The engine needs the Accessibility permission for the CI agent, and I have not confirmed a hosted runner has it, so init names the requirement and links /desktop#set-up.
Docs: reference/cli.mdx (flag values, prompt, created files, pipeline rules), desktop.mdx (one line on init), telemetry.mdx (engine ids). No facts were cut.
Verified
Ran it locally: yes
- Scratch projects under
/tmp, built CLI from this branch:init --yes --engine web,desktop --gateway none --skills none --mcp none --ci github-actions. It wrote both targets,tests/web.e2e.tsandtests/desktop.e2e.ts, and a workflow that runse2e run --target webonly.
- The scaffold from
init --yes --engine desktop, run with the checkout's desktop engine on macOS 27 against the real Calculator:
ℹ macos worker 0: desktop driver checkout build on macOS
✓ |macos| tests/example.e2e.ts > Calculator opens 595ms
Test Files 1 passed (1)
Tests 1 passed (1)
- Not run: an install of the scaffold from npm.
@e2e-dev/desktopis not published yet, so the^0.0.1range init writes resolves only after the desktop release. The native driver came from a sibling checkout at the samecrates/commit, as this machine has no Rust toolchain. - The example asserts the
7key, which reads the same in every system language. Checked by launching Calculator withAppleLanguagesset tofrandja: the7assertion passed in both, where an assertion onAll Clearfailed.
Summary by CodeRabbit
-
New Features
- Added desktop (macOS) as an initialization option, with a generated Calculator target and example test.
- Setup now warns when an engine is unsupported on the current operating system and provides guidance for app targets.
-
Documentation
- Updated setup and CLI guides with desktop initialization details and macOS runner requirements.
- Clarified that generated CI pipelines omit macOS targets, and desktop-only projects do not receive a pipeline.