tester-army/e2e

e2e

Writes, runs, and debugs end-to-end tests for web and mobile apps with e2e, the agentic test runner, which mixes agent.act goals with exact locator assertions on a Playwright browser or an iOS or Android device.

ソースを見る
リポジトリの原文

見出し、例、コード、表、リンク、参照画像を含む原文を表示しています。

e2e: agentic end-to-end tests

e2e runs UI tests that mix agent goals with exact steps. agent.act drives one goal; agent.assert, agent.waitFor, and agent.extract judge the screen; screen, app, browser, and expect act and check exactly. UI targets use @e2e-dev/web for browsers or @e2e-dev/mobile for iOS simulators, Android emulators, and connected phones.

Start here: pick the reference for the job

Read the one reference that matches the request before doing anything else. Each stands on its own; a reference names another topic only for a side trip. The installed CLI prints the same text with npx e2e guide <topic>.

When you areTopicRead
Adding e2e to a project, writing e2e.config.ts, starting the app from the config, signing in to a model, setting up mobile targetssetupreferences/setup.md
Looking at the running app, checking a UI change, taking a screenshot or video, or trying a locator before writing it, over e2e mcpmcpreferences/mcp.md
Writing or fixing a test: fixtures, locators, actions, matchers, sign-in sessions, the browser fixture, API-only testswriting-testsreferences/writing-tests.md
Adding agent.* steps, picking a model, cutting cost, budgets, the replay cacheagentreferences/agent.md
Running tests: CLI flags, CI, reporters, trace pages, report.json for scripts, exit codesrunningreferences/running.md
Handling a failed run: error codes and their fixes, --headed, --debug, --ai-tracedebuggingreferences/debugging.md
Exploring an app toward a goal without a test file: e2e explore, its budgets and verdictexplorereferences/explore.md
Asked to bug bash, QA, or hunt for bugs across an app or a branchbug-bashreferences/bug-bash.md

For anything the references do not cover, the full documentation ships in the docs/ directory of the installed e2e package (node_modules/e2e/docs in a single-package project); a link such as /reference/cli is docs/reference/cli.mdx. Complete projects for Vite, Next.js, Astro, Expo, SwiftUI, Jetpack Compose, Kotlin Multiplatform, and Flutter are in https://github.com/tester-army/e2e/tree/main/examples.

Quick start

A config with one web target and a model, and a test that drives one goal and pins the outcome:

ts
// 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;
ts
// 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');
});

Workflow: writing a test

  1. Look at what exists: e2e.config.ts or e2e.config.mts, the tests glob

(default tests/**/*.e2e.ts), e2e in package.json. Nothing there: follow setup.

  1. Learn the screens before writing a test: routes, labels, roles, button

text. Semantic locators need the accessible names the app renders, so read the components, open the page with --headed, or drive the live app over the registered e2e mcp server (topic mcp): open_session, observe, and locate show exact names and check a locator before you write it.

  1. Write tests/<feature>.e2e.ts. Drive the flow with agent.act, one goal

per call, and pin each outcome right after with expect or agent.assert. Exact values go through screen: a sign-in form in a setup test, a field that must receive one specific string, a count that must be one number.

  1. Run one file: npx e2e run tests/<feature>.e2e.ts. Agent steps need a

model in the config and that provider's authentication (a saved subscription login, an API key); a local endpoint may need none. Tests without agent steps need no model.

  1. Read the trace page the terminal names under each failed test

(.e2e/results/<test>/trace.md): every step with what it did, the cache's decision, what the app logged, the agent's turns, and the screen at failure. Fix the locator, the expectation, or the app. Never add a sleep.

Rules

  • Run the CLI as npx e2e ... (or pnpm exec e2e ...).
  • The config is export default { ... } satisfies E2EConfig with

import type { E2EConfig } from 'e2e'. targets is required; a UI target names an engine and declares the app beside it: { engine: web(), app: { url, command } }. A tools-only target can omit the engine and set platform.

  • Import test, describe, the hooks, expect, credentials, and

secrets from e2e. A test that uses the browser fixture imports test, describe, and the hooks from @e2e-dev/web: the same runtime functions, typed with browser.

  • Config and tests are ES modules whatever package.json sets as type.
  • Locators resolve when used. Actions wait for readiness and expect retries

assertions. Reads such as textContent() fail at once on zero matches and count() answers from the current screen; nothing waits for a value to change, so use a matcher when a value has to settle.

  • A locator that matches two nodes fails with LOCATOR_AMBIGUOUS; narrow it

(topic writing-tests).

  • Secrets never appear in test code. Declare accounts under credentials and

every other sensitive value under secrets in the config; resolve with credentials.user(name).password or secrets.get(name) (separate namespaces: secrets.get never returns a password), and hand the opaque Secret only to fill() or agent.act params.

  • Agent instructions: one goal per act, the wording on screen, real values

in params. Judge meaning, not phrasing: toContain('Pro'), not an exact sentence a model produced.

  • Check each agent goal's outcome. A passing act with a recorded check can

be cached and replayed without model calls (topic agent).

  • Shape the agent for this app: context for vocabulary the screens use,

system for how it works, tools for a test API, named personas under agents. When a step fails, tighten the goal first, then the context, then the agent.

  • .e2e/ is output (report.json, results/, cache/, logs/; the

config's output moves the report and artifacts, never cache/ or the app's log). Read it, never edit it.

Feedback

When e2e itself gets in your way, tell the e2e team: a command or API that broke (bug), docs or this skill that misled you (docs), or a capability you needed and did not find (feature). Send it once per problem, after you worked around it or gave up, never for failures of the app under test.

bash
npx 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>"

Describe e2e's behavior only: never paste app content, page text, test files, URLs of private apps, or credentials. Secret-named environment variables and common token shapes are redacted, but do not rely on it. --dry-run prints what would be sent. Tell the user you sent it and give them the reference id it prints.

同じリポジトリから

関連する Skills

すべての Skills
tester-army
コミュニティ

create-verification-skill

Generate a project-local verify- skill on top of e2e, so any coding agent can launch the app, check it is worth driving, exercise a feature the way a user does, keep evidence, and bug bash it. Writes the skill, a feature map with one explore charter per feature, and proves it once. Use for /create-verification-skill, "make a verification skill for this repo", or when a project has no scripted way to prove UI behavior.

導入数
5
GitHub Stars
9636
更新日
10月12日
tester-army
コミュニティ

babysit

Drive an open tester-army/e2e PR through conflicts, review bots, and CI until it is green with every thread handled, then label it Ready for Human Review. Use after opening a PR, or when asked to babysit, watch, monitor, check on, or get a PR green.

導入数
3
GitHub Stars
1816
更新日
10月2日
tester-army
コミュニティ

ship-pr

Take finished work in tester-army/e2e to a PR a human can review without fighting CI or bots - checks, verification against the built packages, a fresh-context self-review, the PR itself, then babysitting to the Ready for Human Review label. Use whenever you are asked to open, create, ship, or submit a PR, or when implementation is done and the next step is review.

導入数
3
GitHub Stars
1816
更新日
10月2日
tester-army
コミュニティ

verify

Prove a change to the e2e runner, an engine, the CLI, a reporter, the MCP server, or the docs works the way a user sees it - the real CLI against the testbed and benchmark apps, headed and on video when it matters, main against the branch for fixes. Use while iterating and before opening a PR, when asked to run, test, check, or screenshot something, to reproduce a bug report, or whenever you would otherwise say "it compiles".

導入数
3
GitHub Stars
1816
更新日
10月2日