.claude/skills/e2e-testing/SKILL.md
Run, debug, and fix Playwright E2E tests locally. Use when writing new E2E tests, debugging failing tests, or iterating on test fixes before pushing to CI.
npx skillsauth add iota-uz/iota-sdk E2E TestingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
The E2E tests use a separate iota_erp_e2e database. Create it if missing:
# Check DB connection params from .env (DB_HOST, DB_PORT, DB_PASSWORD)
grep '^DB_' .env
# Create the database (adjust host/port from .env)
PGPASSWORD=postgres psql -U postgres -h localhost -p 5438 -c "CREATE DATABASE iota_erp_e2e;"
# Run migrations
just e2e migrate up
The server must run with test endpoints enabled:
PORT=3201 ORIGIN='http://localhost:3201' DB_NAME=iota_erp_e2e ENABLE_TEST_ENDPOINTS=true \
go run -tags e2e ./cmd/server/main.go
Or use just e2e dev (uses air hot-reload, same env vars).
Verify it's running:
curl -s -o /dev/null -w "%{http_code}" http://localhost:3201/login
# Should return 200
kill $(lsof -ti:3201) 2>/dev/null
# Run a specific test file
cd e2e && npx playwright test tests/roles/roles.spec.ts --reporter=line
# Run a specific test by line number
cd e2e && npx playwright test tests/roles/roles.spec.ts:26 --reporter=line
# Run all E2E tests (headless)
just e2e ci
# Run with Playwright UI (interactive debugging)
just e2e run
When fixing a failing E2E test, follow this loop:
e2e/test-results/ after failures.webm) for timing/animation issues# Quick iteration: run just the failing test
cd e2e && npx playwright test tests/module/test.spec.ts:LINE --reporter=line
# After fixing, run the full suite
cd e2e && npx playwright test tests/module/test.spec.ts --reporter=line
# View failure screenshot
# (path shown in test output, use Read tool to view)
The <dialog> top-layer positioning confuses Playwright's elementFromPoint() hit testing
in headless Chromium. The bottom action bar (sticky footer) intercepts pointer events even
though the dialog is visually on top.
Workaround: After verifying the dialog is visible, trigger the htmx form submit directly instead of clicking the confirm button:
// Open the confirmation dialog
await page.locator('[data-test-id="delete-btn"]').click();
// Wait for dialog to appear
const dialog = page.locator('[data-test-id="delete-confirmation-dialog"]');
await expect(dialog).toBeVisible();
// Trigger htmx delete directly (bypasses dialog hit-test issue)
await page.evaluate(() => {
const form = document.getElementById('delete-form') as HTMLFormElement;
(window as any).htmx.trigger(form, 'submit');
});
await page.waitForURL(/\/expected-path$/);
Prefer data-test-id attributes over text-based or structural selectors:
// Good
page.locator('[data-test-id="save-role-btn"]')
page.locator('[data-test-id="dialog-confirm-btn"]')
// Fragile
page.locator('button').filter({ hasText: /Save/i })
page.getByRole('button', { name: /confirm/i })
import { waitForAlpine } from '../../fixtures/auth';
await waitForAlpine(page);
Tests use beforeAll to reset and seed:
import { resetTestDatabase, seedScenario } from '../../fixtures/test-data';
test.beforeAll(async ({ request }) => {
await resetTestDatabase(request, { reseedMinimal: false });
await seedScenario(request, 'comprehensive');
});
e2e/
├── fixtures/
│ ├── auth.ts # login, logout, waitForAlpine helpers
│ └── test-data.ts # resetTestDatabase, seedScenario
├── tests/
│ ├── roles/ # Role management tests
│ ├── users/ # User management tests
│ └── ...
├── playwright.config.ts # Playwright config (1280x720 viewport)
└── test-results/ # Screenshots, videos, traces from failures
http://localhost:3201development
Connect to local or staging PostgreSQL database. Use when you need to inspect tables, run queries, check migration status, or debug database issues.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.