Loading...
Loading...
Agentic end-to-end tests with e2e, the e2e runner. Covers scaffolding e2e.config.ts, picking the Playwright browser engine or the agent-device mobile engine, starting the app under test from the config, driving flows with agent.act, judging with agent.assert, agent.waitFor, and agent.extract, pinning values with screen, app, browser, and expect, shaping the agent (context, system prompt, tools, personas), the replay cache, the e2e CLI, reading .e2e/report.json, and bug bashes (parallel explore runs proven with repro tests). Use when a project depends on e2e, when asked for end-to-end, browser, mobile, or agentic UI tests, to bug bash or hunt for bugs, or when an e2e run fails.
npx skill4agent add tester-army/e2e e2eagent.actagent.assertagent.waitForagent.extractscreenappbrowserexpect@e2e-dev/web@e2e-dev/mobileappfetchexpectwriting-tests// e2e.config.ts
import type { E2EConfig } from 'e2e';
import { web } from '@e2e-dev/web';
import { gateway } from 'ai';
export default {
targets: [
{
engine: web(),
app: {
url: 'http://127.0.0.1:3000',
command: { executable: 'pnpm', args: ['dev'], log: '.e2e/logs/app.log' },
},
},
],
// The model behind every agent.* step: an AI SDK instance; gateway() from 'ai' reads AI_GATEWAY_API_KEY or a Vercel OIDC token.
agents: {
default: {
model: gateway('openai/gpt-6-luna-fast'),
system: 'You are a thorough QA agent. Verify every outcome on screen.',
},
},
} satisfies E2EConfig;// tests/billing.e2e.ts
import { test } from '@e2e-dev/web';
import { expect } from 'e2e';
test('a member upgrades to Pro', async ({ app, agent, screen, browser }) => {
await app.open('/settings/billing');
await agent.act('upgrade the workspace to the Pro plan');
await expect(screen.getByRole('status')).toContainText('Pro');
await expect(browser).toHaveURL('/settings/billing');
});npx e2e guide <topic>e2e guidedocs/e2enode_modules/e2e/docs/reference/clidocs/reference/cli.mdx| Topic | File | Read it when |
|---|---|---|
| references/setup.md | Adding e2e to a project, writing |
| references/writing-tests.md | Writing or fixing tests: fixtures, locators, actions, matchers, sign-in sessions, the |
| references/agent.md | Adding |
| references/running.md | CLI flags, reporters, |
| references/explore.md | Exploring an app toward a goal without a test file: |
| references/debugging.md | A run failed: error codes and their fixes, |
| references/mcp.md | Driving the live app from a coding agent over MCP: |
| references/bug-bash.md | Asked to bug bash, QA, or hunt for bugs across an app or a branch: parallel |
e2e.config.tse2e.config.mtsteststests/**/*.e2e.tse2epackage.jsonsetup--headede2e mcpmcpopen_sessionobservelocatetests/<feature>.e2e.tsagent.actexpectagent.assertscreennpx e2e run tests/<feature>.e2e.ts.e2e/report.jsonnpx e2e ...pnpm exec e2e ...export default { ... } satisfies E2EConfigimport type { E2EConfig } from 'e2e'targets{ engine: web(), app: { url, command } }platformtestdescribeexpectcredentialssecretse2ebrowsertestdescribe@e2e-dev/webbrowserpackage.jsontypeexpecttextContent()count()LOCATOR_AMBIGUOUSwriting-testscredentialssecretscredentials.user(name).passwordsecrets.get(name)secrets.getSecretfill()agent.actacttoContain('Pro')actagentcontextsystemagents.e2e/report.jsonartifacts/cache/logs/outputcache/bugdocsfeaturenpx e2e feedback --type bug -m "<one or two sentences>" \
--task "<what you were doing>" --expected "<...>" --actual "<error code and message>" \
--approach "<what you tried>" --command "<e2e command>" --agent "<agent / model>"--dry-run