Skip to main content
e2e is an open-source runner for end-to-end tests. A test can use scripted steps, agent steps where a model works toward a goal, or both. The @e2e-dev/e2b package runs the app under test in E2B sandboxes:
  • e2b() gives each test worker an Android 16 sandbox from the android-16 template, with your .apk installed.
  • e2bBrowsers() gives each test worker a Chromium sandbox.
Your tests stay the same as on a local device or browser, and the runner deletes the sandboxes when the run ends.

Install

e2e needs Node.js 22 (22.22.3 or later) or Node.js 24.8.0 or later. Install the runner, the E2B package, and the engine for your target: @e2e-dev/mobile for Android, @e2e-dev/web for the browser.
Set E2B_API_KEY (get one) in the environment that starts e2e.

Run Android tests

You do not need the Android SDK, an emulator, or adb on your machine. Set the device of the mobile engine to e2b() and point appPath at your .apk.
e2e.config.ts
Write a test.
tests/login.e2e.ts
Run it.
Each worker gets its own Android sandbox, ready with your app installed in about 15 to 45 seconds. workers is the upper limit: a run with one test file uses one worker.

Run web tests

The browser provider needs a sandbox template with Chromium. Build it one time for each E2B team, from the Playwright image. Use the image tag of the Playwright version that your @e2e-dev/web uses.
build-template.ts
Set the browser of the web engine to e2bBrowsers().
e2e.config.ts
Run it.
The browser runs in E2B’s cloud, so app.url must be reachable from the internet. A server on localhost on your machine is not.

Add agent steps

An agent step gives a model a goal instead of a script. The model works on the app in the sandbox, and a scripted assertion can check the result. Install the AI SDK and a model provider, and set the provider’s API key.
Add agents to your config. Keep your targets.
e2e.config.ts
Use the agent fixture in a test. This test needs a web target with url: 'https://en.wikipedia.org'.
tests/search.e2e.ts

Options

Both providers accept these options. e2bBrowsers() also accepts scope. The default, 'worker', keeps one sandbox per worker for the run. 'attempt' creates a new sandbox for every test attempt. For a dedicated E2B cluster, set E2B_DOMAIN.

How it works

  1. One sandbox per worker: when the run starts, the provider creates a sandbox for each worker and target. On Android, it installs your .apk. On the web, it starts Chromium.
  2. Private by default: the provider creates each sandbox with public traffic turned off. The runner reaches it through a tunnel on 127.0.0.1 that adds the E2B access token, so the device and the browser are not open to the internet.
  3. Cleanup: the runner deletes the sandboxes when the run ends. If the runner is killed first, E2B deletes them when timeoutMs ends.

Limitations

  • E2B has no iOS sandboxes, so e2b() refuses an iOS target.
  • Android on E2B is x86_64 only, has no Google Play Services, and renders in software. Apps with native libraries need x86_64 builds.
  • The provider installs an .apk, not an .aab.
  • A sandbox is billed while it runs. Android sandboxes and worker-scope browser sandboxes run from the start of the run to its end.

Android and Chromium example

The game 2048 on Android and Wikipedia in Chromium, with scripted tests and agent tests

Run Android

What is in the android-16 template and how to drive it with adb

Templates

Build your own sandbox templates

e2e integration guide

All options of e2b() and e2bBrowsers() in the e2e documentation