docs(core): drive a Mac app with @e2e-dev/core and desktop() (GTM-1179)

Merged
KA
1h ago
+70-23

What

The @e2e-dev/core guide has a "Drive a desktop app" section: launch(desktop(), { app: { appPath } }) from @e2e-dev/desktop/engine, a session with a desktop fixture, and what to do for an app that opens no window in the background. The @e2e-dev/core reference now lists desktop() wherever it listed only web() and mobile().

Why

@e2e-dev/desktop/engine exists so a @e2e-dev/core program can drive a Mac app, but the Core guide only showed a browser and a device, and the reference said bundleId, appPath, and the session fixtures were for mobile() and web() only. A reader had no way to find out it works.

How it works

  1. docs/core.mdx:170 adds the section after "Drive an app on a device". Its example is docs/examples/core/desktop.ts, registered in scripts/check-docs-examples.ts:34, so it typechecks against the built packages and the page copy can't drift. A Note links to /desktop#set-up for macOS 13+ and the two permissions instead of repeating them.
  2. docs/core.mdx:195 says app.open() launches in the background unless launch({ headed: true }), and that an app with no background window needs headed: true or desktop({ physicalInput: true }). The engine's own error names --headed, a CLI flag a Core script doesn't have.
  3. docs/reference/core.mdx:
    • headed (line 71) brings a desktop app to the front.
    • INVALID_CONFIG (line 86) names desktop()'s refusals from validateApp in packages/desktop/src/engine.ts:98.
    • The app table (line 91) adds desktop() to bundleId, appPath (.app only), and launchArguments. permissions now reads web(), mobile(), since desktop() refuses it.
    • The Session table (line 174) gains the desktop row.
  4. The description and lede of both pages, packages/core/README.md, and the @e2e-dev/core row of the root README.md say "or a Mac app".

The page title stays "Browser and device automation": renaming it moves the sidebar label and the page's search title for one engine.

Verified

Ran it locally: yes

  • Built @e2e-dev/core, @e2e-dev/desktop, its native driver, and the desktop testbed app (apps/desktop-testbed/build/SignInForm.app). Ran docs/examples/core/desktop.ts with only appPath pointed at the testbed, from a scratch project that links @e2e-dev/core and @e2e-dev/desktop and no e2e:
[ 'Sign In' ]
  • A longer script on the same host: filled the form with a launch({ secrets }) password, checked the box, picked the plan, signed in. The status read Signed in as ada on Team, remembered (password: 7 characters). screen.tree() held no password, the screenshot painted the field black, a missing button threw LOCATOR_NOT_FOUND, and no app process was left after await using closed the host.
  • headed: with headed: false the frontmost app stayed Chrome, with headed: true it was SignInForm.
  • Did not run: an app that opens no window in the background (the claim comes from packages/desktop/src/launch-wait.ts:94 and docs/desktop.mdx), and a clean npm install from the registry. The scratch project's symlinked packages could still reach the workspace e2e, though @e2e-dev/desktop/engine imports none of it.
  • Rendered with e2e-site main against this branch's docs/ (E2E_DOCS_DIR=... pnpm dev). The section is new, so there is no before.
/docs/core, new section/docs/reference/core, app table
core sectionreference app table

Checklist

  • Changeset added (pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.
  • Breaking change: title carries !, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).
  • Docs updated in the same PR: the docs/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it.
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures.
  • Engine contract change (e2e/engine): changesets for e2e, @e2e-dev/web, and @e2e-dev/mobile.

Summary by CodeRabbit

  • New Features
    • Added support for driving Mac apps, including launching by bundle ID or .app path and interacting with windows and controls.
    • Added a desktop automation example.
  • Documentation
    • Updated installation guidance and reference details for Mac app automation, including platform, permission, and launch requirements.