Files
resolutionflow/frontend/playwright.config.ts
Michael Chihlas 63e5881972
Some checks failed
Mirror to GitHub / mirror (push) Successful in 4s
CI / frontend (pull_request) Successful in 6m47s
CI / backend (pull_request) Failing after 9m24s
CI / e2e (pull_request) Successful in 10m26s
test(e2e): disable rate limiting in the Playwright backend webserver
RATE_LIMIT_ENABLED now defaults on regardless of DEBUG; the e2e suite
logs in dozens of times per run from one IP and trips the per-minute
auth limits (429 at helpers/api.ts login).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-12 20:14:05 -04:00

73 lines
2.7 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test'
const frontendBaseUrl = process.env.PLAYWRIGHT_BASE_URL || 'http://127.0.0.1:4173'
const apiOrigin = process.env.PLAYWRIGHT_API_ORIGIN || 'http://127.0.0.1:8000'
const authStorageStatePath = './e2e/.auth/team-admin.json'
const backendDatabaseUrl =
process.env.PLAYWRIGHT_DATABASE_URL || 'postgresql+asyncpg://postgres:postgres@127.0.0.1:5433/resolutionflow'
const backendDatabaseUrlSync =
process.env.PLAYWRIGHT_DATABASE_URL_SYNC || 'postgresql://postgres:postgres@127.0.0.1:5433/resolutionflow'
export default defineConfig({
testDir: './e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 2 : undefined,
reporter: [['list'], ['html', { outputFolder: 'playwright-report', open: 'never' }]],
use: {
baseURL: frontendBaseUrl,
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
webServer: [
{
command: 'PYTHON_BIN=./venv/bin/python; if [ ! -x "$PYTHON_BIN" ]; then PYTHON_BIN=python; fi; "$PYTHON_BIN" -m alembic upgrade head && "$PYTHON_BIN" -m scripts.seed_test_users && "$PYTHON_BIN" -m uvicorn app.main:app --host 127.0.0.1 --port 8000',
url: `${apiOrigin}/health`,
cwd: '../backend',
reuseExistingServer: !process.env.CI,
timeout: 120_000,
env: {
...process.env,
DEBUG: process.env.PLAYWRIGHT_DEBUG || 'true',
// e2e logs in dozens of times per run from one IP — the per-minute
// auth limits would 429 every spec after the first few.
RATE_LIMIT_ENABLED: 'false',
SECRET_KEY: process.env.PLAYWRIGHT_SECRET_KEY || 'playwright-test-secret-key',
DATABASE_URL: backendDatabaseUrl,
DATABASE_URL_SYNC: backendDatabaseUrlSync,
CORS_ORIGINS: '["http://127.0.0.1:4173","http://localhost:4173","http://127.0.0.1:5173","http://localhost:5173"]',
},
},
{
command: process.env.CI
? 'npm run preview -- --host 127.0.0.1 --port 4173'
: 'NODE_OPTIONS="--max-old-space-size=4096" npm run build && npm run preview -- --host 127.0.0.1 --port 4173',
url: frontendBaseUrl,
reuseExistingServer: !process.env.CI,
timeout: 120_000,
env: {
...process.env,
VITE_API_URL: apiOrigin,
VITE_SENTRY_DSN: process.env.VITE_SENTRY_DSN || '',
},
},
],
projects: [
{
name: 'setup',
testMatch: /.*\.setup\.ts/,
},
{
name: 'chromium',
dependencies: ['setup'],
testIgnore: /.*\.setup\.ts/,
use: {
...devices['Desktop Chrome'],
storageState: authStorageStatePath,
},
},
],
})