docs(core): drive a Mac app with @e2e-dev/core and desktop() (GTM-1179)
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
docs/core.mdx:170adds the section after "Drive an app on a device". Its example isdocs/examples/core/desktop.ts, registered inscripts/check-docs-examples.ts:34, so it typechecks against the built packages and the page copy can't drift. ANotelinks to/desktop#set-upfor macOS 13+ and the two permissions instead of repeating them.docs/core.mdx:195saysapp.open()launches in the background unlesslaunch({ headed: true }), and that an app with no background window needsheaded: trueordesktop({ physicalInput: true }). The engine's own error names--headed, a CLI flag a Core script doesn't have.docs/reference/core.mdx:headed(line 71) brings a desktop app to the front.INVALID_CONFIG(line 86) namesdesktop()'s refusals fromvalidateAppinpackages/desktop/src/engine.ts:98.- The
apptable (line 91) addsdesktop()tobundleId,appPath(.apponly), andlaunchArguments.permissionsnow readsweb(),mobile(), sincedesktop()refuses it. - The Session table (line 174) gains the
desktoprow.
- The description and lede of both pages,
packages/core/README.md, and the@e2e-dev/corerow of the rootREADME.mdsay "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). Randocs/examples/core/desktop.tswith onlyappPathpointed at the testbed, from a scratch project that links@e2e-dev/coreand@e2e-dev/desktopand noe2e:
[ '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 readSigned in as ada on Team, remembered (password: 7 characters).screen.tree()held no password, the screenshot painted the field black, a missing button threwLOCATOR_NOT_FOUND, and no app process was left afterawait usingclosed the host. headed: withheaded: falsethe frontmost app stayed Chrome, withheaded: trueit wasSignInForm.- Did not run: an app that opens no window in the background (the claim comes from
packages/desktop/src/launch-wait.ts:94anddocs/desktop.mdx), and a cleannpm installfrom the registry. The scratch project's symlinked packages could still reach the workspacee2e, though@e2e-dev/desktop/engineimports none of it. - Rendered with e2e-site
mainagainst this branch'sdocs/(E2E_DOCS_DIR=... pnpm dev). The section is new, so there is no before.
/docs/core, new section | /docs/reference/core, 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/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.
Summary by CodeRabbit
- New Features
- Added support for driving Mac apps, including launching by bundle ID or
.apppath and interacting with windows and controls. - Added a desktop automation example.
- Added support for driving Mac apps, including launching by bundle ID or
- Documentation
- Updated installation guidance and reference details for Mac app automation, including platform, permission, and launch requirements.