Add e2e example: end-to-end tests on Android and in Chromium (JavaScript)
Merged
TO
12d ago+2959+2959+0123456789012345678901234567890123456789-0-0-0123456789
Adds examples/e2e-android-web-tests-js: end-to-end tests that run in E2B sandboxes with e2e, an open-source test runner, and the two providers from @e2e-dev/e2b (merged upstream in e2e-inc/e2e#1598).
e2b()leases Android 16 sandboxes from the publicandroid-16template. The example tests the game 2048. No Android SDK, emulator, oradbon the machine.e2bBrowsers()leases Chromium sandboxes from a template built one time from the Playwright image. The example tests Wikipedia.
Each target has one scripted test and one agent test (a model works toward a goal, and a scripted assertion checks the result).
Draft until the package is on npm
@e2e-dev/e2b 0.0.1 is not on npm yet. It ships with the pending e2e release, e2e-inc/e2e#1590, together with e2e 0.23.1, @e2e-dev/web 0.16.0 and @e2e-dev/mobile 0.12.7. package.json already pins those versions, so npm install fails until the release. After it:
- add
package-lock.json - run the example one more time against the published packages
- mark the PR ready
Design
- Android first.
npm startruns only the Android target, which needs an E2B key and one APK download. The Chromium template build and the agent tests are optional later steps in the README. - Agent tests are optional. Without
ANTHROPIC_API_KEY, they are skipped and the scripted tests still run. - No binary in the repo.
npm run download-apkgets Privacy Friendly 2048 (GPL-3.0) from F-Droid and checks a pinned SHA-256. - Not in the example runner. e2e leases its own sandboxes, so a run inside
tests/run-examples.tswould nest sandboxes, and the web target needs the template on the account first. The note in that file explains this.
Also adds a row to the root README under "Remote execution integrations".
Testing
npm run check(typecheck, oxlint): passing.- Live against E2B with packages built from e2e
main(046bd08f), E2B SDK 2.63.0 and Node.js 24:npm run test:allwith an Anthropic key: 4 of 4 tests pass in about 35 s.npm startwithout the key: the scripted Android test passes, the agent test is skipped.npm run download-apkandnpm run build-template: both work.