fix(mobile): refuse launch options installApp drops, deprecate foreground openApp launch arguments
What and why
A user wanted e2e to launch their iOS app with custom process arguments and tried passing them to device.installApp. The launch path already works end to end: app.launchArguments reaches the process on app.open(), app.restart(), app.clearState(), and device.openApp(app, { relaunch: true, launchArguments }) (simulator: simctl launch <udid> <bundle> args..., CoreDevice phone: devicectl ... -- args). The gap was silent drops:
device.installApp(path, { launchArguments })ignored the option. It now fails withINVALID_ARGUMENTand names where the option goes.launchArguments/launchArgspoint toapp.launchArguments,permissionstoapp.permissions,relaunchtoapp.open(). A non-string first argument and any other unknown option fail too.device.openApp(app, { launchArguments })withoutrelaunchleft a running app with its old arguments. This form is now deprecated. It still sends the arguments and prints aDeprecationWarning(E2E_MOBILE_OPEN_APP_ARGUMENTS) once per worker, following the CONTRIBUTING stability policy. An empty list doesn't warn.device.openApprejects unknown options (Detox'slaunchArgsnameslaunchArguments) and non-arraylaunchArguments(a string used to be spread into characters).
The checks live in packages/mobile/src/device-options.ts and only the device fixture runs them. The agent's open_app tool and restart/reset build their own options and skip them. Each API has one hints map in front of rejectUnknownOptions. I didn't extend core's rejectUnknownOptions with hints: using a new e2e/engine parameter would raise @e2e-dev/mobile's e2e peer floor. The launchArguments array check stays separate from core's config check (config/app.ts) for the same reason: that helper isn't exported.
No install-time arguments were added. e2e and agent-device set no process environment variables. The docs say so and link to app.environment's config entry.
Also fixed: the installApp step label printed [object Object] when a test passed an object first.
Docs: docs/mobile.mdx shows the install-then-app.open() flow with appPath + launchArguments. docs/reference/mobile.mdx documents the deprecation and the new INVALID_ARGUMENT cases and keeps the JSDoc copies in sync. docs/reference/config.mdx#environment gets the process-env note, and the skill reference gets one line.
Issue
No public issue. User report.
Verified
Ran it locally: yes. iOS 26.5 simulator, Settings app, built packages, launch args read from ps via the simctl spawn launchctl list pid.
- Before the change:
-E2EProbe from-configwas in the process args afterapp.open(),app.restart(), and a no-argsopenApp({ relaunch: true }).-E2EProbe per-launchwas there afteropenApp({ relaunch: true, launchArguments }). A foreground-onlyopenApp({ launchArguments: ['-E2EProbe', 'fg'] })keptfrom-configwith no error. - After the change:
- The happy path is unchanged.
- Foreground
launchArgumentspasses and prints[E2E_MOBILE_OPEN_APP_ARGUMENTS] DeprecationWarning: device.openApp({ launchArguments }) without relaunch: true is deprecated .... installApp('./x.app', { permissions })fails withINVALID_ARGUMENT: device.installApp options has no key "permissions"; an install launches nothing: set the target's app.permissions, or call device.openApp(app, { relaunch: true, permissions }).installApp({ launchArguments })fails withdevice.installApp takes the build's path first, then { app, reinstall }, and its trace step readsdevice.installApp appPath.
pnpm checkpasses.@e2e-dev/mobileunit tests pass (504).- Not run on a physical iPhone. agent-device refuses launch arguments on XCTest-only (non-CoreDevice) iPhones, as
docs/mobile.mdxalready says.
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.