fix(mobile): refuse launch options installApp drops, deprecate foreground openApp launch arguments

Draft
OK
10d ago
+237-19

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 with INVALID_ARGUMENT and names where the option goes. launchArguments/launchArgs point to app.launchArguments, permissions to app.permissions, relaunch to app.open(). A non-string first argument and any other unknown option fail too.
  • device.openApp(app, { launchArguments }) without relaunch left a running app with its old arguments. This form is now deprecated. It still sends the arguments and prints a DeprecationWarning (E2E_MOBILE_OPEN_APP_ARGUMENTS) once per worker, following the CONTRIBUTING stability policy. An empty list doesn't warn.
  • device.openApp rejects unknown options (Detox's launchArgs names launchArguments) and non-array launchArguments (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-config was in the process args after app.open(), app.restart(), and a no-args openApp({ relaunch: true }). -E2EProbe per-launch was there after openApp({ relaunch: true, launchArguments }). A foreground-only openApp({ launchArguments: ['-E2EProbe', 'fg'] }) kept from-config with no error.
  • After the change:
    • The happy path is unchanged.
    • Foreground launchArguments passes and prints [E2E_MOBILE_OPEN_APP_ARGUMENTS] DeprecationWarning: device.openApp({ launchArguments }) without relaunch: true is deprecated ....
    • installApp('./x.app', { permissions }) fails with INVALID_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 with device.installApp takes the build's path first, then { app, reinstall }, and its trace step reads device.installApp appPath.
  • pnpm check passes. @e2e-dev/mobile unit tests pass (504).
  • Not run on a physical iPhone. agent-device refuses launch arguments on XCTest-only (non-CoreDevice) iPhones, as docs/mobile.mdx already 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/**/*.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.