Skip to content

test: add E2E test foundation with Playwright#132

Open
jakebromberg wants to merge 5 commits intomainfrom
feat/e2e-foundation
Open

test: add E2E test foundation with Playwright#132
jakebromberg wants to merge 5 commits intomainfrom
feat/e2e-foundation

Conversation

@jakebromberg
Copy link
Member

@jakebromberg jakebromberg commented Feb 3, 2026

Summary

  • Add comprehensive E2E testing infrastructure using Playwright
  • Playwright configuration with tuned timeouts for CI
  • Reusable page objects (login, dashboard, roster, onboarding)
  • Auth fixtures with session reuse
  • Helper scripts for local E2E test environment
  • GitHub Actions workflows for CI and E2E tests
  • Authorization module (lib/features/authorization/) with AuthorizedView component

E2E workflow performance (Closes #189)

  • Replace Docker Compose with GitHub Actions services: container + native Node processes
  • Parallelize frontend build, Playwright install, and backend setup
  • Add globalTimeout (10 min), tighter per-test timeouts, --max-failures=10
  • Reduce timeout-minutes from 45 to 15
  • Capture all service PIDs for reliable cleanup
  • BETTER_AUTH_JWKS_URL moved into shared .env so it's available to both services and the user-seeding script

Speed comparison

Measured from successful CI runs on the same branch (before vs after).

Before (Feb 4) After (avg of 3 runs) Change
Total job time 4m 47s ~1m 57s 2.4x faster
DB startup 2m 11s (Docker Compose) ~10s (GHA services:) 12x faster
Install deps 45s (sequential) 30s (parallel npm ci) 1.5x faster
Playwright install 27s (no cache) 3s (cached browsers) 9x faster
Build + start services 66s (sequential) 41s (parallelized) 1.6x faster

Key changes that drive the improvement:

  1. GHA services: containers start PostgreSQL before any workflow step runs, eliminating the 2m 11s Docker Compose boot
  2. Parallel tracks: frontend (Playwright install + dj-site build) runs concurrently with backend (npm ci + build + DB init + seed)
  3. Playwright browser caching avoids re-downloading Chromium on every run

Test plan

  • Verify E2E scripts work locally
  • Verify CI workflow runs and passes
  • Verify auth/backend healthchecks respond in CI logs
  • Verify DB migrations run successfully via init-db.mjs output

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 3, 2026

Deploying wxyc-dj with  Cloudflare Pages  Cloudflare Pages

Latest commit: b109696
Status: ✅  Deploy successful!
Preview URL: https://baecb561.dj-site.pages.dev
Branch Preview URL: https://feat-e2e-foundation.dj-site.pages.dev

View logs

@jakebromberg jakebromberg marked this pull request as draft February 3, 2026 18:11
@jakebromberg jakebromberg marked this pull request as ready for review February 16, 2026 23:51
Jake Bromberg and others added 4 commits February 26, 2026 12:40
Infrastructure:
- Add Playwright configuration for E2E testing
- Create reusable page objects for auth flows (login, dashboard, roster, onboarding)
- Implement auth fixtures with session reuse
- Add helper scripts for E2E test environment
- Add GitHub Actions workflows for CI and E2E tests

This is the foundation for comprehensive E2E testing.
Test specs will be added in subsequent PRs.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Add @playwright/test to devDependencies
- Add test:e2e and test:e2e:ui scripts
- Exclude e2e folder from main tsconfig to prevent type errors
- Add e2e/tsconfig.json for E2E test type checking
Replace Docker Compose with GitHub Actions service containers for
PostgreSQL and native Node background processes for auth/backend.
Parallelize npm ci, Playwright install, dj-site build, and backend
setup to overlap the frontend and backend tracks.

Playwright config changes:
- Add 10-minute globalTimeout to cap runaway runs
- Lower per-test timeout from 30s to 15s (3x the ~5s baseline)
- Lower expect.timeout from 15s to 10s (aligned with actionTimeout)
- Disable retries during development (re-enable once suite is stable)

Workflow changes:
- Use services: postgres instead of Docker Compose
- Run auth + backend as native Node background processes
- Source .env in backend subshell so vars are available at import time
- Parallelize npm ci for both repos
- Run backend track (build, init-db, start services, seed users)
  concurrently with frontend track (Playwright install + dj-site build)
- Cache Playwright browsers across runs
- Add --max-failures=10 to stop after 10 failures
- Lower job timeout from 45 to 15 minutes
The frontend process started by `npm run start &` was not tracked,
so it was never killed in the Cleanup step. Write its PID to
/tmp/frontend.pid and include it in cleanup alongside auth/backend.
Also add frontend logs to the failure diagnostics step.
The .npmrc references ${NPM_TOKEN} for @wxyc/shared (a private package
on GitHub Packages), but CI workflows never exposed the secret as an
env var, causing 401 Unauthorized on every npm ci step.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: speed up E2E workflow -- timeouts, remove Docker, parallelize setup

2 participants