Add e2e example: end-to-end tests on Android and in Chromium (JavaScript)

Merged
TO
12d ago
+2959-0

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 public android-16 template. The example tests the game 2048. No Android SDK, emulator, or adb on 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 start runs 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-apk gets 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.ts would 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:all with an Anthropic key: 4 of 4 tests pass in about 35 s.
    • npm start without the key: the scripted Android test passes, the agent test is skipped.
    • npm run download-apk and npm run build-template: both work.