feat(eas): @e2e-dev/eas, EAS Simulators for the mobile engine

Merged
OK
2mo ago
+1417-22

What and why

  • New package @e2e-dev/eas: easSimulators(), a DeviceProvider that runs mobile targets on EAS Simulators. One hosted iOS simulator or Android emulator per worker slot, driven through the agent-device daemon EAS runs beside it. It follows the per-service layout of @e2e-dev/kernel (#659).
  • It talks to Expo's GraphQL API with fetch, the same API eas simulator:* uses, so there is no SDK to install and @e2e-dev/mobile is the only peer. EXPO_TOKEN is read from the run's environment.
  • buildId or applicationArchiveUrl has EAS install the app. Without either, device.installApp() uploads a local build through the daemon.
  • Session lifecycle. The provider:
    • names and tags each session with the run, target, and slot;
    • pins the daemon to the agent-device version the engine pins, where EAS would otherwise run the latest;
    • defaults maxIdleTimeMinutes to 10 as the backstop for a dead run;
    • stops a session that errors, is cancelled, or is still booting after 15 minutes;
    • cancels the queued job of any session it stops (EAS otherwise starts that job later and it holds the concurrency slot);
    • fails fast when a session is still queued while another session of the run idles toward EAS's idle stop.
  • @e2e-dev/mobile changes, needed for video on hosted daemons:
    • videoTouches: false records without agent-device's touch indicator. On EAS iOS, drawing the indicator took about 2 minutes per recording and failed anyway, so every recorded attempt timed out.
    • Video now records with device scope. The app scope refused to start with no app open, which happens after closeApp() or before a fixture installs the build. When a stop reports that it ended the record-only session, the engine treats the session as closed.
    • DeviceRequest.agentDeviceVersion passes the engine's pinned agent-device to providers.
import { mobile } from '@e2e-dev/mobile';
import { easSimulators } from '@e2e-dev/eas';

mobile({
  platform: 'ios',
  app: 'com.example.app',
  device: easSimulators({ projectId: '<expo project id>', buildId: process.env.EAS_BUILD_ID }),
  videoTouches: false,
});
sequenceDiagram
  participant R as runner (prepare)
  participant P as easSimulators
  participant E as api.expo.dev
  participant W as worker
  R->>P: acquire(slot)
  P->>E: createDeviceRunSession (agent-device, buildId, packageVersion)
  loop every 5s
    P->>E: byId: status, turtleJobRun, remoteConfig
  end
  P-->>R: lease { daemon: url + token }
  W->>E: agent-device RPC through the session daemon
  R->>P: release
  P->>E: ensureDeviceRunSessionStopped (+ cancelJobRun if still queued)

Verified

Ran it locally: yes. I ran the mobile benchmark against live EAS Simulators: benchmark builds from EAS (iOS simulator build and APK), the built CLI, 1 worker, --video=on.

Android, full deterministic suite, all passing with video:

ℹ leasing 1 android device(s) from eas-simulators
 ✓ mobile engine for target "eas-android" prepared 150.88s
 ✓ |eas-android| tests/controls.e2e.ts (25 tests | 1 skipped) 341.96s
 ✓ |eas-android| tests/device-fixture.e2e.ts (8 tests) 158.56s
 ✓ |eas-android| tests/device.e2e.ts (4 tests) 77.81s
 ✓ |eas-android| tests/flows-lists.e2e.ts (7 tests) 282.59s
 ✓ |eas-android| tests/flows.e2e.ts (7 tests) 107.99s
 ✓ |eas-android| tests/login-form.e2e.ts (3 tests) 56.70s
 ✓ |eas-android| tests/smoke.e2e.ts (1 test) 13.68s
 Test Files  7 passed (7)
      Tests  54 passed | 1 skipped (55)

iOS, full suite: 49 passed, 3 failed, 1 skipped, with 52 videos. None of the failures come from the provider:

  • clipboard: fails locally under Xcode 27 too;
  • the WebView coupon text is missing from the accessibility tree on EAS;
  • the bottom-tabs button is reported as covered on EAS.

The last two reproduce on every EAS run and pass on CI's local iOS 26.5 simulators with the same build; they are reported to Expo.

Upload path: the same .app through appPath + device.installApp(), with no buildId. Recording starts before the app is installed, which only works with device scope:

ℹ a booted ios device: dev.e2e.benchmark awaits the suite's device.installApp()
 ✓ mobile engine for target "eas-ios" prepared 186.72s
 ✓ |eas-ios| tests/device.e2e.ts (4 tests) 159.46s
 ✓ |eas-ios| tests/smoke.e2e.ts (1 test) 38.48s
      Tests  1 failed | 7 passed (8)

The 1 failure was agent-device's "could not present the accessibility snapshot ... The app is fine. Rerun". The session reported packageVersion: 0.21.16, so the pin is honored.

Failure paths:

  • 7 and then 4 workers on a 1-concurrency account: 1 session ran and the rest queued. The run failed with still queued while a session of this run has been ready for 10 minutes ..., and every session was stopped with its queued jobs CANCELED.
  • Ctrl-C while leasing stops both the queued session and the ready one.
  • A bad or missing EXPO_TOKEN fails the lease with EAS: The bearer token is invalid. / EXPO_TOKEN is not set.

iOS recording (login form, sign in and out):

ios

Android recording (login form):

android

https://github.com/user-attachments/assets/6ba282d0-836e-4e8e-bdf9-37f48c4d905f

https://github.com/user-attachments/assets/350d3c79-2203-489e-aa15-af7998fa2409


Devin Review