End-to-End Testing
Boottify includes a Playwright-based E2E testing framework with 40 tests across 5 spec files covering authentication, navigation, API endpoints, and user workflows.
Prerequisites
- Node.js 18+ installed
- Development server running (
npm run dev) - Database seeded with test data
Setting Up Test Data
Before running tests, seed the database with test users and sessions:
npx tsx e2e/helpers/seed.ts
This creates test users, valid sessions, an app template, and a subscription plan. Session tokens are written to e2e/helpers/sessions.json.
Running Tests
# Run all tests
npx playwright test
# Run a specific test file
npx playwright test e2e/auth-flow.spec.ts
# Run in debug mode (opens browser)
npx playwright test --debug
# Run with UI mode
npx playwright test --ui
Authentication in Tests
Tests use database session injection instead of form-based login. This avoids hitting rate limiters and makes tests faster and more reliable. Each test receives a pre-authenticated session cookie.
Writing New Tests
Place test files in the e2e/ directory with the .spec.ts extension. Use the existing test helpers for common operations:
import { test, expect } from "@playwright/test";
import { authenticatedPage } from "./helpers/auth";
test("user can view dashboard", async ({ page }) => {
await authenticatedPage(page, "client");
await page.goto("/dashboard");
await expect(page.locator("h1")).toContainText("Dashboard");
});