[ agent view ]
Documentation Index
Fetch the complete documentation index at: https://e2e.com/docs/llms.txt Use this file to discover all available pages before exploring further.
Quickstart
Set up e2e with one prompt to your coding agent, or step by step.
Set up with your coding agent
Paste this prompt into Claude Code, Codex, Cursor, or another coding agent in your app's directory:
The agent installs the e2e skill, so later prompts such as "add a test for checkout" need no more setup.
Use Node.js 24.8 or newer (22.22.3 or newer on Node.js 22), or Bun 1.4.3 or newer for web tests. On Windows, run inside WSL. Mobile tests also need Xcode with an iOS simulator runtime, or the Android SDK with an emulator.
Set up manually
Run your first test
In your app's directory:
npx e2e init
pnpm dlx e2e init
bunx e2e init
Choose Web (Playwright) or Mobile (iOS/Android), then a subscription, a model provider, or None for tests without AI. The wizard writes a config and an example test, adds dependencies, and offers to set up your coding agent. It keeps existing files.
Start your app's dev server at http://localhost:3000, or set its address
in e2e.config.ts. You can also let e2e start it.
This config uses Vercel AI Gateway. The wizard configures the provider you chose.
export default {
agents: { default: { model: gateway('openai/gpt-6-luna-fast') } },
targets: [{ engine: web(), app: { url: 'http://localhost:3000' } }],
} satisfies E2EConfig;
test('app opens', async ({ app, browser }) => {
await app.open('/');
await expect(browser.locator('body')).toBeVisible();
});
Run npx e2e doctor to check your setup. The wizard picks iOS on macOS
and Android elsewhere. The example opens the Settings app.
This config uses Vercel AI Gateway. For Android, the wizard sets
platform: 'android' and app: { bundleId: 'com.android.settings' }.
export default {
agents: { default: { model: gateway('openai/gpt-6-luna-fast') } },
targets: [{ name: 'ios', engine: mobile({ platform: 'ios' }), app: { bundleId: 'Settings' } }],
workers: 1,
} satisfies E2EConfig;
test('Settings opens', async ({ app, screen }) => {
await app.open();
await expect(screen.getByRole('button', 'General')).toBeVisible();
});
See Mobile to use your own app.
npx e2e run
pnpm exec e2e run
bunx e2e run
e2e downloads a browser or boots the simulator or emulator, checks that the app opens, and prints the result. The example makes no model calls, so it needs no sign-in or API key.
npx e2e init asks a few questions, then shows every change before it writes anything.
Use a subscription or API key
| Plan | How to connect |
|---|---|
| ChatGPT Plus or Pro | npx e2e login openai |
| GitHub Copilot | npx e2e login github-copilot |
| OpenCode Console (OpenCode Zen and OpenCode Go) | npx e2e login opencode-console |
| SuperGrok or X Premium+ | npx e2e login spacexai |
| Claude Max or Team (Claude Code) | API key from the plan's monthly API credits. See Claude Max or Team. |
Copilot uses your GitHub CLI login if you have one. See Subscriptions.
Select your provider. Install its package and set the variables it reads, if any, in the terminal where you run e2e.
The wizard writes the config for Vercel AI Gateway, OpenRouter, and
OpenAI-compatible endpoints. For another provider, replace the model import
and model value in e2e.config.ts, and use agent as agents.default:
See Models for local models and more options.
Add an agent step
Give agent.act one atomic goal per call, then
check the result. Adapt the example to a flow in your app:
test('a visitor signs up for a trial', async ({ app, agent, screen }) => {
await app.open('/');
await agent.act('sign up for a free trial as {name} with email {email}', {
params: { name: 'Ada Lovelace', email: 'ada@example.test' },
});
await agent.assert('the welcome screen greets Ada by name');
await expect(screen.getByRole('status')).toContainText('trial');
});
test('the agent opens General', async ({ agent, app, device }) => {
await app.open();
await agent.act('open {section} settings', { params: { section: 'General' } });
await agent.assert('the General settings screen is showing');
await expect(device.locator('role=navigation-bar id=General')).toBeVisible();
});
app.open() launches the app fresh. Without it, a test starts where the
previous one left the device. device.locator takes
agent-device selectors.
params fill the goal's placeholders. agent.assert judges the screen.
expect checks an exact value.
npx e2e run tests/agent.e2e.ts
pnpm exec e2e run tests/agent.e2e.ts
bunx e2e run tests/agent.e2e.ts
If you chose None in the wizard, add a model first. Add
--headed to watch a web test. Add --no-cache to skip cached actions.
Configure the project
e2e.config.ts holds the options. These are the ones most projects change
after init:
| To | Set | See |
|---|---|---|
| point at your app | app.url, or app.bundleId on mobile | The app under test |
| start the app with the run | app.command | Starting your app |
| use a model | agents.default.model | Models |
| test several browsers or devices | one targets entry each, with a name | targets |
| give tests more time | timeout, actionTimeout, assertionTimeout | timeout |
| retry failed tests | retries, 1 in CI | retries |
| run tests in parallel | workers, 1 in CI | workers |
| pick the test files | tests | tests |
| keep traces and videos | trace, video | Recording |
| write a JUnit report | reporters: ['list', 'junit'] | reporters |
| sign in and pass API keys | credentials, secrets | Authentication |
| write the replay cache in CI | cache: 'read-write' | Caching |
const app = {
url: process.env.APP_URL ?? 'http://localhost:3000',
command: { executable: 'npm', args: ['run', 'dev'], reuseExisting: true },
};
export default {
agents: { default: { model: gateway('openai/gpt-6-luna-fast') } },
targets: [
{ name: 'chromium', engine: web({ viewport: { width: 1440, height: 900 } }), app },
{ name: 'firefox', engine: web({ browser: 'firefox' }), app },
],
timeout: 180_000,
workers: 4,
reporters: ['list', 'junit'],
video: 'retain-on-failure',
} satisfies E2EConfig;
--target firefox runs one target. Targets that share one command share
one server process.
Next
Goals, assertions, and locators.
Reuse an app login and keep passwords out of model input.
Read failures, screenshots, and traces.
Run your tests on GitHub Actions, Expo Workflows, Bitrise, or Codemagic.
