Files
phaseflow/playwright.config.ts
Petru Paler 27f084f950
All checks were successful
Deploy / deploy (push) Successful in 1m38s
Fix Garmin token connection not persisting after save
Root cause: The setup-db script was missing user field definitions
(garminConnected, tokens, etc.). Production PocketBase had no such
fields, so updates silently failed to persist.

Changes:
- Add user custom fields to setup-db.ts (matches e2e harness)
- Fix status route to use strict boolean check (=== true)
- Add verification in tokens route with helpful error message
- Add ENCRYPTION_KEY to playwright config for e2e tests
- Add comprehensive e2e tests for Garmin connection flow

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

62 lines
1.9 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",
// Required for Garmin token encryption
ENCRYPTION_KEY: "e2e-test-encryption-key-32chars",
},
},
});