بنقرة واحدة
e2e
// Run, debug, and manage Playwright e2e tests. Use when running e2e tests, debugging test failures, regenerating seed databases, or investigating test infrastructure issues.
// Run, debug, and manage Playwright e2e tests. Use when running e2e tests, debugging test failures, regenerating seed databases, or investigating test infrastructure issues.
Multi-agent code review that checks the current diff from 7 angles (spec compliance, modernization, bugs, CLAUDE.md rules, abstraction reuse, security, DB query performance) and produces a unified review. Works on branch diffs vs main or staged changes.
Help write, debug, and explore SQLite database queries using Kysely. Use when writing repository code, exploring data, debugging query issues, or understanding the database schema.
| name | e2e |
| description | Run, debug, and manage Playwright e2e tests. Use when running e2e tests, debugging test failures, regenerating seed databases, or investigating test infrastructure issues. |
e2e/*.spec.ts, config in playwright.config.tse2e/global-setup.ts) builds the app, creates per-worker databases, and starts one server per workerE2E_BASE_PORT = PORT (from .env) + 500. Default PORT is typically 4001, so base port = 4501. Workers use ports base+0 through base+3db-test-e2e-0.sqlite3 through db-test-e2e-3.sqlite3 in the project roote2e/seeds/db-seed-*.sqlite3Before running tests, check for these common issues:
Stale worker databases — Files matching db-test-e2e-*.sqlite3 in the project root can cause "table already exists" migration errors if the schema has changed since they were created. Run pnpm run test:e2e:generate-seeds to regenerate these from the seed databases.
Port conflicts — Check if anything is already listening on the e2e ports (base port through base+3):
lsof -i :4501-4504 2>/dev/null
If ports are occupied by leftover e2e servers, kill them. If occupied by something else, warn the user.
Seed databases exist — Verify e2e/seeds/ contains the expected seed files. If missing, run pnpm run test:e2e:generate-seeds.
Docker running — MinIO requires Docker. Check with docker info if there are storage-related failures.
pnpm run test:e2e
pnpm exec playwright test e2e/<name>.spec.ts
pnpm run test:e2e:flaky-detect
pnpm run test:e2e:generate-seeds
Follow this funnel when tests fail:
Common infrastructure errors and fixes:
rm -f db-test-e2e-*.sqlite3lsof -i :<port> and check for build errorsdocker infopnpm run test:e2e:generate-seedsIf the error is unclear, re-run with debug output and a single worker to see server logs:
E2E_DEBUG=true E2E_WORKERS=1 pnpm exec playwright test e2e/<failing-test>.spec.ts
This shows stdout/stderr from the test server, which is hidden by default.
Playwright is configured with trace: "retain-on-failure". After a failure, view the trace:
pnpm exec playwright show-trace test-results/<test-folder>/trace.zip
Every test follows this pattern — use these imports from ./helpers/playwright, NOT raw Playwright APIs:
import { expect, impersonate, navigate, seed, test } from "./helpers/playwright";
test.describe("Feature", () => {
test("does something", async ({ page }) => {
await seed(page); // Reset DB to a known seed state
await impersonate(page, USER_ID); // Log in as a specific user (default: admin)
await navigate({ page, url: "..." });// Navigate (waits for hydration)
// ... interact with the page ...
await submit(page); // Submit a form (waits for POST response)
});
});
Key rules:
navigate() instead of page.goto() — it waits for hydrationsubmit() instead of clicking submit buttons directly — it waits for the POST responseseed(page, variation?) to reset the database. Available variations: DEFAULT, NO_TOURNAMENT_TEAMS, REG_OPEN, SMALL_SOS, NZAP_IN_TEAM, NO_SCRIMS, NO_SQ_GROUPSimpersonate(page, userId?) to authenticate. Default is admin (ADMIN_ID)page.waitForTimeout — use assertions or waitFor patterns insteadtest from ./helpers/playwright (not from @playwright/test) — it includes worker port fixtures| Variable | Purpose | Default |
|---|---|---|
E2E_WORKERS | Number of parallel workers | 4 |
E2E_DEBUG | Show server stdout/stderr when "true" | unset |
PORT | Base port for dev server (e2e adds 500) | 5173 |