Write and run Playwright E2E tests with a live HyperBEAM backend. Tests full user flows in the browser.
Steps
- •Check prerequisites:
test -d frontend/e2e && echo "OK" || echo "ERROR: No e2e/ directory" cd frontend && npx playwright --version 2>/dev/null || echo "ERROR: Playwright not installed"
If Playwright is missing: cd frontend && npx playwright install
- •
Read
tasks.jsonand find the task matching$ARGUMENTS(task id). Update its status to"in_progress". - •
Kill stale HyperBEAM processes:
bashpkill -f beam.smp 2>/dev/null || true
- •
Write Playwright tests in
frontend/e2e/:jsimport { test, expect } from "@playwright/test" test.describe("{feature} E2E", () => { test("full user flow", async ({ page }) => { await page.goto("http://localhost:5173") // Wait for app to load await expect(page.locator("h1")).toBeVisible() // Test wallet connection flow // (mock ArConnect via page.addInitScript if needed) // Test process interaction // - Fill form inputs // - Click submit // - Wait for response from AO process // - Verify UI updates // Test error states // - Network failure // - Invalid input }) }) - •
Write global setup if needed for HyperBEAM lifecycle:
js// frontend/e2e/global-setup.js import { HyperBEAM } from "wao/test" let hbeam export default async function globalSetup() { hbeam = await new HyperBEAM({ reset: true }).ready() process.env.HYPERBEAM_URL = hbeam.url } export async function globalTeardown() { if (hbeam) await hbeam.kill() }Reference in
frontend/playwright.config.js:jsexport default { globalSetup: "./e2e/global-setup.js", globalTeardown: "./e2e/global-setup.js", use: { baseURL: "http://localhost:5173" }, } - •
Ensure the Vite dev server is running (or start it):
bashcd frontend && npm run dev &
- •
Run E2E tests:
bashcd frontend && npx playwright test
- •
If any tests fail:
- •Read the error output and screenshots (if any)
- •Fix the test or frontend code
- •Re-run
- •Repeat until 100% pass
- •
Kill the Vite dev server and HyperBEAM after tests.
- •
Update the task status to
"done"intasks.json.