feat(e2e): add a desktop engine to e2e init

Merged
OK
3d ago
+160-38

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

  1. The preset is one entry in getEnginePresets() (packages/e2e/src/cli/init/engines.ts:144). The --engine flag, 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.
  2. The build records the desktop version for the dependency range (packages/e2e/scripts/write-sibling-versions.ts:20).
  3. NO_JOB in packages/e2e/src/cli/init/ci.ts:242 was a set holding 'electron'. It is now a map from platform to what running it in CI takes and the docs path, with macos added. ciJobs keeps both out of the web job, and withoutJobNotices (ci.ts:253) builds the warning per platform, where init.ts had the Electron sentence inline.
  4. init.ts no longer checks engine ids. Whether to offer a pipeline is hasJob(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 the Next: line is a preset field, pointAtApp (init.ts:877).
  5. A preset can name the one host OS it runs on (host, engines.ts:26). Init warns when it differs from os.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.ts and tests/desktop.e2e.ts, and a workflow that runs e2e run --target web only.

init with the desktop engine

  • 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/desktop is not published yet, so the ^0.0.1 range init writes resolves only after the desktop release. The native driver came from a sibling checkout at the same crates/ commit, as this machine has no Rust toolchain.
  • The example asserts the 7 key, which reads the same in every system language. Checked by launching Calculator with AppleLanguages set to fr and ja: the 7 assertion passed in both, where an assertion on All Clear failed.

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.