Files
phaseflow/playwright.config.ts
Petru Paler 8c59b3bd67
Some checks failed
CI / quality (push) Failing after 29s
Deploy / deploy (push) Successful in 2m37s
Add self-contained e2e test harness with ephemeral PocketBase
Previously, 15 e2e tests were skipped because TEST_USER_EMAIL and
TEST_USER_PASSWORD env vars weren't set. Now the test harness:

- Starts a fresh PocketBase instance in /tmp on port 8091
- Creates admin user, collections, and API rules automatically
- Seeds test user with period data for authenticated tests
- Cleans up temp directory after tests complete

Also fixes:
- Override toggle tests now use checkbox role (not button)
- Adds proper wait for OVERRIDES section before testing toggles
- Suppresses document.cookie lint warning with explanation

Test results: 64 e2e tests pass, 1014 unit tests pass

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 09:38:24 +00:00

60 lines
1.8 KiB
TypeScript

// ABOUTME: Playwright E2E test configuration for browser-based testing.
// ABOUTME: Configures Chromium-only headless testing with automatic dev server startup.
import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
// Test directory for E2E tests
testDir: "./e2e",
// Global setup/teardown for PocketBase harness
globalSetup: "./e2e/global-setup.ts",
globalTeardown: "./e2e/global-teardown.ts",
// Exclude vitest test files
testIgnore: ["**/pocketbase-harness.test.ts"],
// Run tests in parallel
fullyParallel: true,
// Fail the build on CI if you accidentally left test.only in the source code
forbidOnly: !!process.env.CI,
// Retry failed tests on CI only
retries: process.env.CI ? 2 : 0,
// Limit parallel workers on CI to avoid resource issues
workers: process.env.CI ? 1 : undefined,
// Reporter configuration
reporter: [["html", { open: "never" }], ["list"]],
// Shared settings for all projects
use: {
// Base URL for navigation actions like page.goto('/')
baseURL: "http://localhost:3000",
// Collect trace on first retry for debugging
trace: "on-first-retry",
// Take screenshot on failure
screenshot: "only-on-failure",
},
// Configure projects - Chromium only per requirements
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
// Run dev server before starting tests
// Note: POCKETBASE_URL is set by global-setup.ts for the test PocketBase instance
webServer: {
command: "pnpm dev",
url: "http://localhost:3000",
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000, // 2 minutes for Next.js to start
env: {
// Use the test PocketBase instance (port 8091)
NEXT_PUBLIC_POCKETBASE_URL: "http://127.0.0.1:8091",
POCKETBASE_URL: "http://127.0.0.1:8091",
},
},
});