feat(config): accept an object for launch args
What and why
Part of #1855, the app: { launchArguments: { AppleLocale: 'fr_FR' } } row.
app.launchArgumentsnow supports{ name: value }as well as the list of strings. Detox and Maestro suites have a map to port, andAppleLanguages: ['fr']is easier to write than'-AppleLanguages', '(fr)'.- A value is a string, number, boolean, or list of strings. Core checks the shape at config load:
packages/core/src/config/app.ts. mobile()writes each entry for its platform inpackages/mobile/src/launch-arguments.ts:-name valueon iOS, and on Android anam startextra of the value's type (--ez,--ei,--ef,--es,--esa), so the app reads it with the matchingIntentgetter. An object with one of Apple's keys on an Android target fails at config load.device.openApp(app, { launchArguments })takes the same object form and checks it the way config load does, withINVALID_ARGUMENT. The shape check ischeckLaunchArguments, exported from@e2e-dev/core/engine.- Android cannot carry every list:
am start --esasplits on each comma, keeps the backslash before an escaped one, and reads an empty value as one empty item. An object's list on Android is refused when it is empty or an item is empty, holds a comma, or ends in a backslash. An iOS string value goes out as a plist string, so'(draft)'reaches the app as text, not an array. Core refuses a number beyond 2^53 and a NUL character. - The list still goes to the launch command as it did, with three changes, each a loud failure: the config error for a non-string list item has new text, a list item with a NUL character now fails at config load, and a list passed to
device.openAppis now shape-checked. - The engine contract stays backward compatible.
EngineAppInfo.launchArgumentsis stillreadonly string[], so an engine that spreads it keeps working, including published@e2e-dev/mobile0.12.8, whose peer ranges admit this core. The object goes to a new field,EngineAppInfo.launchArgumentValues, only for an engine that declareslaunchArgumentValues: true(defineEngine, the engine manifest, and its schema). Any other engine getsINVALID_CONFIGat config load and never sees the object.mobile()anddesktop()opt in.
IOS changes:
// before and still valid
launchArguments: ['-AppleLanguages', '(fr)', '-AppleLocale', 'fr_FR'],
// new
launchArguments: { AppleLanguages: ['fr'], AppleLocale: 'fr_FR' },
Android changes:
// before and still valid
launchArguments: ['--ez', 'e2e', 'true'],
// new
launchArguments: { e2e: true },
^ this change wasn't asked for in this proposed API but I thought it'd be a good quality of life improvement for the Android side. Let me know if it should be taken out 👍
Issue
feature: https://github.com/e2e-inc/e2e/issues/1855 device and app app: { launchArguments: { AppleLocale: 'fr_FR' } }
Verified
Ran it locally: yes
-
Re-run after the engine contract review, Node 24.19.0, at
7f4a2f21(5a7b87a1after it changes only docs and the changeset;docs:checkandcheck:changeset-bumpsgreen there):-
pnpm checkgreen.pnpm testgreen (8558 tests across 22 vitest runs, none failed). -
The reviewer's case against the packed
@e2e-dev/coreande2ein a scratch project:Engine List { AppleLocale: 'fr_FR', AppleLanguages: ['fr'] }custom engine whose initspreadsapp.launchArgumentse2e runpasses,initgets["-AppleLocale","fr_FR","-AppleLanguages","(fr)"]INVALID_CONFIGat config load, exit 2,initnever runspublished @e2e-dev/mobile@0.12.8e2e listloadsINVALID_CONFIGat config load, exit 2tscaccepts the unchanged[...(info.app.launchArguments ?? [])]against the new declaration. -
New tests:
engine-protocol.test.ts"hands an engine that predates the object form a list it can spread, and refuses an object at config load" and "carries the object form to an engine that declares launchArgumentValues" (over the loopback protocol). The mobile and desktop engine tests assert the opt-in; removing eitherlaunchArgumentValues: truefails them.
-
-
On devices, with a hand-run check that lived in the mobile benchmark while this was developed and is no longer in the PR (CI never ran it, and
dumpsysshows only(has extras)on Android): an iPhone simulator (iOS 26.5) and a Pixel 7 emulator, Release builds, the object and the list forms producing the same launch. The simulator process ran ase2eBenchmark -AppleLanguages (fr) -AppleLocale fr_FR; the emulator's launch intent carried the extras. The Android half ran again after0aae6136with--ez. -
The full gate on the final tree, rebased on main:
pnpm checkgreen, translation check included (thedocs/jaanddocs/zhpages carry the changed code blocks and the new heading, their prose untouched);pnpm testunder Node 24 green across every package (thee2epackage alone: 4870 passed, 11 skipped). -
Re-run after the last review, Node 24.19.0. The benchmarks and device runs below ran at
209b49faplus the last two commits' changes, before the rebase on main. After the rebase,pnpm checkandpnpm testran again at3822804f, both green (8479 tests across 22 vitest runs):-
Before the rebase:
pnpm checkgreen.pnpm testgreen (8062 tests across 22 vitest runs).pnpm test:testbed600 passed, 1 skipped.pnpm test:web-benchmark95 passed. -
CI=1 pnpm --filter @e2e-dev/web-benchmark run test:agent --strict-cache: 26 passed, 8 failed. Same 8 fail on the merge base6fdb1c27: 5 steps have no recording and call the model (no key on this machine), 3 planted-bug judgments the same way. -
pnpm test:mobile-benchmark, Release builds of the app: iPhone 17 Pro simulator (iOS 26.5) 61 passed, 1 skipped. Pixel 7 emulator (Android 36,google_apis_playstore) 59 passed, 1 failed, 1 skipped. The failure isdevice.e2e.ts"a denied prompt recovers once the permission is granted outside" (alert dismiss did not dismiss the visible alert). No launch arguments in it, and it flakes the same on the merge base with the same APK and emulator (2 of 4 runs fail there, 2 of 3 here). -
A launch with an object from the config and from
device.openApp({ relaunch: true, launchArguments })on both devices. iOS process (ps):config: -AppleLanguages (fr) -AppleLocale fr_FR -flag NO -on YES -retries 3 -negative "-1" -spaced "a b" -paren "(draft)" -cdn "//cdn" -blank "" -tags ("", a, "x,y", "//cdn.example/assets") openApp: -note "-1" -count 7Android
am start(agent-device'sadbcalls, recorded through a wrapper):config: --ez on true --ei retries 3 --ei max 2147483647 --el big 2147483648 --ef ratio 1.5 --es spaced 'a b' --es paren '(draft)' --es empty '' --esa tags 'a,b c' openApp: --es note -1 --ei count 7
-
-
unit tests:
$ pnpm --filter @e2e-dev/mobile exec vitest run tests/unit/launch-arguments.test.ts
âś“ launchArgumentList > passes a list through as given and sends nothing for none
âś“ launchArgumentList > spells an object as iOS process arguments
âś“ launchArgumentList > quotes a string NSUserDefaults would otherwise read as a plist, as a value and as a list item
âś“ launchArgumentList > spells an object as am start extras of each value's type
âś“ assertLaunchArgumentsFor > refuses Apple's arguments in an object on Android, and nothing else
âś“ assertLaunchArgumentsFor > refuses a list am start would read back changed on Android, and takes any list on iOS
âś“ assertLaunchArgumentsFor > fails a launch a test asked for with INVALID_ARGUMENT
âś“ launchArgumentsForOpen > checks the declared shape and the platform rules, and leaves out an undefined value
Tests 8 passed (8)
$ pnpm --filter @e2e-dev/mobile exec vitest run tests/unit/engine.test.ts -t "launch"
âś“ manifest > refuses an iOS launch argument in an object on an Android target, and passes a list through
âś“ device fixture > spells a launch-argument object for the platform on every fresh launch of the pinned app, and sends nothing for an empty object
âś“ device fixture > launches any app with its own arguments, a list or an object spelled for the platform, and permissions set on that app by name
âś“ device fixture > refuses openApp launch arguments of the wrong shape, or ones Android cannot carry, before any device command
$ pnpm --filter e2e exec vitest run tests/unit/config.test.ts -t "launch arguments"
âś“ resolveConfig > takes launch arguments as an object of name to string, number, boolean, or list of strings, and leaves out an undefined value
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 the valid fixture (launchArgumentValuesis a plain boolean, so the invalid fixture needs no change). - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/core,@e2e-dev/mobile, and@e2e-dev/desktop.@e2e-dev/webhas no change: it never receives launch arguments.