@e2e-dev/e2b package runs the app under test in E2B sandboxes:
e2b()gives each test worker an Android 16 sandbox from theandroid-16template, with your.apkinstalled.e2bBrowsers()gives each test worker a Chromium sandbox.
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.
E2B_API_KEY (get one) in the environment that starts e2e.
Run Android tests
You do not need the Android SDK, an emulator, oradb on your machine. Set the device of the mobile engine to e2b() and point appPath at your .apk.
e2e.config.ts
tests/login.e2e.ts
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
browser of the web engine to e2bBrowsers().
e2e.config.ts
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.agents to your config. Keep your targets.
e2e.config.ts
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
- 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. - Private by default: the provider creates each sandbox with public traffic turned off. The runner reaches it through a tunnel on
127.0.0.1that adds the E2B access token, so the device and the browser are not open to the internet. - Cleanup: the runner deletes the sandboxes when the run ends. If the runner is killed first, E2B deletes them when
timeoutMsends.
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.
Related guides
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 adbTemplates
Build your own sandbox templates
e2e integration guide
All options of
e2b() and e2bBrowsers() in the e2e documentation