feat(eas): install the target's local build on Expo simulators

Merged
OK
7d ago
+168-90

What

expoSimulators() installs a local build itself. With no buildId or applicationArchiveUrl, the target's app.appPath is uploaded to each simulator and installed before the first test, as revyl(), limrun() and e2b() already do.

{
  name: 'android-eas',
  engine: mobile({ platform: 'android', device: expoSimulators() }),
  app: { appPath: './build/app-release.apk' },
}

@e2e-dev/mobile/lease exports installLeasedApp(request, lease) for any device provider whose devices start without the build.

Why

Expo Simulators was the one hosted provider where a local build needed a suite fixture calling device.installApp(). The same config on Revyl, Limrun or E2B installs the build in the provider (#1947 for Revyl). A suite that moves between them should not need a different fixture.

How it works

  1. installLeasedApp() (packages/mobile/src/lease/index.ts:159) is #1947's private install helper, exported and widened: it takes a DeviceLease, connects to lease.daemon when the lease names one and to the lease's stateDir otherwise, selects lease.device or lease.deviceId, and returns the lease with installedApp. Without an appPath it returns the lease as it is. agentDeviceLeases({ installAppPath }) calls it.
  2. expoSimulators().acquire (packages/eas/src/provider.ts:203) returns installLeasedApp(request, lease) once the session is ready. The engine then opens the app in warm-up and installs nothing itself.
  3. A failed install goes through the same abandon() as a session that never became ready (packages/eas/src/provider.ts:179): it drops the session's idle deadline and stored client, stops the session, and throws simulator session <id> did not install the target's app.appPath: <reason>.
  4. deviceSelection and DeviceSelection move from pool.ts to bindings.ts, so the lease entry reuses the engine's selection rule without loading the device pool.
  5. installedIdentity() takes the fix to name in its no-identity error. A provider install names app.bundleId only; device.installApp() keeps installApp's app option, which the lease path does not have (review thread on #1947).
  6. @e2e-dev/eas now needs @e2e-dev/mobile >=0.12.9, the release that carries the helper. The guard for a mobile that passes no projectRoot is older than that floor and is removed.

Dropped: making device.installApp() skip a build the provider installed. The lease's installedApp goes stale after an upgrade test installs an older build, or when a replaced worker starts on a device a test uninstalled from, so the skip could leave the wrong build on the device. device.installApp() installs as before, and the docs tell EAS users to remove the fixture. A sound skip needs the device's own build identity and is a separate change.

Not in this PR: e2b() and limrun() keep their own copies of the install. Moving them to installLeasedApp() raises their mobile peer floor, so it is a follow-up.

Verified

Ran it locally: yes, on a live Expo Simulators Android session at this head.

  • Scratch project with expoSimulators({ projectId }), app: { appPath: '<mobile-benchmark app-release.apk>' }, no bundleId, no install fixture. e2e run: the warm-up opened the app the provider installed, the test saw device.isAppInstalled('dev.e2e.benchmark') and the home screen, and the session was released.
ℹ leasing 1 android device(s) from expo-simulators
ℹ expo-simulators: leased 01a20edb-26b7-74ca-b8cb-2967a891fc8a
ℹ a booted android device: boot 0.4s, open dev.e2e.benchmark 1.4s
 ✓ mobile engine for target "android-eas" prepared 125.54s
   ✓ |android-eas| tests/install.e2e.ts > the provider installed the local build 3.49s
ℹ expo-simulators: released 1 device(s)
  • Mutants in installLeasedApp(): an empty daemon URL in place of the lease's, and platform alone in place of the device selection, each fail the new lease test.
  • Not run: iOS on Expo Simulators (a local Xcode 27 build crashes at launch there), and the install-failure path against a live session, which the unit test covers.
  • No benchmark: the engine's action path is unchanged.