PR: #425: [Story-1743] Run Playwright e2e in CI by @ankitmaheshwari-com
View PR →
Story-1743

Playwright e2e now runs in CI

The gap was simple: PRAMAAN had Playwright tests and playwright-bdd generation, but CI never ran them. A green pull request could prove TypeScript, lint, unit tests, and Storybook while the browser path stayed untested.

The CI workflow now installs WebKit and runs pnpm exec bddgen && pnpm exec playwright test --project=webkit --project=webkit-bdd.

What Runs Now

Surface Evidence
Unauth redirects Existing auth.test.ts and health.test.ts checks prove protected routes redirect to localized sign-in.
Auth surface Existing signed-out page and sign-in checks render through the real Next app server.
Accessibility smoke The signed-out confirmation keeps its current automatic WCAG A Axe check.
BDD smoke bddgen emits generated specs from tests/features/, then Playwright runs them under WebKit.

Authed Gate

Authenticated specs remain opt-in. The Playwright config now has a project-based clerk-setup dependency, but that setup skips unless the seeded Clerk test environment is present. The existing authed specs now call the shared sign-in helper before visiting workspace pages.

PLAYWRIGHT_AUTH_E2E=1
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...
PLAYWRIGHT_TEST_USER_EMAIL=firm-admin+clerk_test@example.com
PLAYWRIGHT_TEST_FIRM_NAME="Ahuja Legal"
GitHub Actions name Runtime env it feeds When needed
secrets.E2E_CLERK_PUBLISHABLE_KEY NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY Always, because the signed-out auth surface mounts Clerk.
secrets.E2E_CLERK_SECRET_KEY CLERK_SECRET_KEY Always for the app server; also required for seeded-user authed sign-in.
secrets.E2E_CLERK_TESTING_TOKEN CLERK_TESTING_TOKEN Optional pre-minted Clerk bot-bypass token.
secrets.E2E_CLERK_TEST_USER_EMAIL PLAYWRIGHT_TEST_USER_EMAIL Only when PLAYWRIGHT_AUTH_E2E=1.
vars.PLAYWRIGHT_AUTH_E2E PLAYWRIGHT_AUTH_E2E Set to 1 to enable authed specs.
vars.E2E_TEST_FIRM_NAME PLAYWRIGHT_TEST_FIRM_NAME Only when the dashboard authed smoke is enabled.
CLERK_TESTING_TOKEN may pre-mint the testing token, but the seeded-user sign-in helper still needs CLERK_SECRET_KEY to mint an email sign-in ticket for the existing firm admin.

Changed Files

.github/workflows/ci.yml Adds the WebKit e2e CI job.
playwright.config.ts Adds the Clerk setup project dependency and a WebKit-backed BDD project whose testDir is the generated specs directory.
tests/e2e/clerk.setup.ts Runs clerkSetup() only when auth e2e is enabled.
tests/e2e/clerk-auth.ts Centralizes auth e2e gating and seeded-user sign-in.
tests/e2e/* Authed specs now use the shared Clerk sign-in helper.

Recall

The mental model is: unauth browser proof is always on in CI; authed browser proof is wired but dormant until Clerk test identity secrets are provisioned.

Files changed

8 file(s), +152 / -31 lines

Path Role + -
.github/workflows/ci.ymlWorkflow+33-0
playwright.config.tsSource+19-6
src/components/report-bug/report-bug-client.tsComponent+0-12
tests/e2e/auth.test.tsTest+20-7
tests/e2e/clerk-auth.tsTest+44-0
tests/e2e/clerk.setup.tsTest+14-0
tests/e2e/filing-types.spec.tsTest+11-3
tests/e2e/matter-types.spec.tsTest+11-3