Running the Suite
These are the day-to-day commands for Playwright inside the dapp/e2e/playwright workspace, plus pointers to trace viewing and CI behaviour.
Local commands
Common runs
# Full headless run using Playwright config defaults
pnpm test:e2e
# Headed mode (opens the browser UI)
pnpm test:e2e -- --headed
# Single project (Chromium only, for example)
pnpm test:e2e -- --project=chromiumSet up .env.playwright before running anything that touches the wallet or MCP mocks; otherwise specs will fail during env.ts validation.
Viewing traces & videos
When the config records traces (trace.zip), open them with:
npx playwright show-trace path/to/trace.zipVideos and screenshots live under dapp/e2e/playwright/test-results/. Delete the folder between runs if you want a clean slate.
Continuous Integration
1. Install & build
CI installs dependencies (pnpm install), builds the dapp, and ensures the Playwright browsers are available (pnpm exec playwright install --with-deps).
2. Run pnpm test:e2e
The same command used locally runs headless specs on CI. Real-mode tests rely on repository secrets for .env.playwright.
3. Collect artifacts
Failures upload the Playwright HTML report, traces, and screenshots. Download the artifacts to reproduce locally with npx playwright show-trace.
Need to tweak browsers or shard tests? Extend package.json scripts or Playwright config, then mention the change here so other devs know how to invoke it.
GitHub workflow specifics
The job defined in .github/workflows/playwright-e2e.yml:
- Triggers automatically after the “Deploy Testnet to Vercel” workflow succeeds, or via manual
workflow_dispatch. - Runs on
ubuntu-latest, scoped to thedapp/directory. - Installs dependencies, then executes
pnpm playwright test hp-tokengate --project=chrome --workers=1. - Feeds secrets/variables into the run:
PRIVATE_KEYfromsecrets.PRIVATE_KEY_PLAYWRIGHT,TEST_BASE_URL/BASE_URLfrom environment variables so the suite points at the freshly deployed preview. - Restricts browsers to Chrome (
pnpm playwright install chrome) to keep runtime short; extend the workflow if you need additional projects.
Config defaults at a glance
- Test directory:
dapp/e2e. - Parallelism: fully parallel locally; CI forces
workers=1with 2 retries. - Base URL:
process.env.BASE_URLif provided; otherwise the config launchespnpm run start(Next.js) on port 3000 and points tests athttp://localhost:3000. - Artifacts: screenshots/videos/traces live in
dapp/test-results/. Traces & videos are captured on the first retry automatically. - Projects: Desktop Chrome (stable channel) plus a Pixel 5 mobile profile ship by default.
- Timeouts: 60 s per test, 30 s per
expect. - Reporters: list + HTML locally (HTML opens on failure); list + HTML + GitHub reporter on CI.
Override these via CLI flags (--project, --reporter, etc.) when necessary, but understanding the defaults keeps local vs. CI runs predictable.