name: e2e-example-acceptance description: Validate or update example-level E2E coverage. Use when adding/updating e2e.spec.ts, debugging example start/build/preview behavior, or verifying browser console/request errors and page expectations. license: MIT compatibility: Requires Node, pnpm, and Playwright dependencies installed. metadata: author: farm version: "1.0"
Run example acceptance with executable checks for start/build/preview and browser behavior.
When to Use
- Adding a new
examples/<name>/e2e.spec.ts - Updating an existing E2E case for an example
- Verifying regression fixes in an example before merge
- Confirming no browser console/page/request anomalies during acceptance
Mandatory Acceptance Flow
Identify affected examples
- From changed files, collect all
examples/<name>/...paths. - If no explicit list is provided, ask for the intended scope.
- From changed files, collect all
Build each affected example
cd examples/<name> && npm run build
Run start and preview checks for each affected example
- For examples with dedicated
e2e.spec.ts, run targeted E2E: pnpm run test-e2e -- --example <name>- For examples without a dedicated test, run smoke checks manually:
cd examples/<name> && npm run startcd examples/<name> && npm run preview
- For examples with dedicated
Browser-level acceptance criteria
- Console: no unhandled
error/pageerrormessages. - Network: no unexpected
requestfailedentries. - Content: assert key selectors/text that prove feature correctness.
- Console: no unhandled
Update or add E2E tests when needed
- Prefer dedicated
examples/<name>/e2e.spec.tsfor feature-specific behavior. - Keep assertions deterministic; avoid brittle timing-only checks.
- Include both
startandpreviewcoverage unless the example is explicitly single-mode.
- Prefer dedicated
Authoring Template
import { basename, dirname } from "path";
import { fileURLToPath } from "url";
import { expect, startAndTest } from "../../e2e/index.js";
const name = basename(import.meta.url);
const projectPath = dirname(fileURLToPath(import.meta.url));
export default async function (ctx) {
const runTest = (command?: "start" | "preview") =>
startAndTest(
projectPath,
async (page) => {
await page.waitForSelector("#root > *", { timeout: 10000 });
// assert page content and absence of runtime anomalies
},
command,
);
await ctx.test("e2e start", () => runTest());
await ctx.test("e2e preview", () => runTest("preview"));
}
Reporting Format
Examples: list of verified examplesBuild: pass/fail per exampleE2E Start: pass/fail per exampleE2E Preview: pass/fail per exampleAnomalies: console/request/pageerror summaryNotes: expected skips or known caveats
Guardrails
- Do not rely only on build success; start/preview behavior must be observed.
- Do not use
pnpm run readyunless the user explicitly asks for full CI parity. - Do not edit generated
dist/files. - Use the new standalone E2E runner (see
scripts/test-e2e.mts) — vitest is no longer involved.