playwright.config.ts
1,123 bytes
| 1 | import { defineConfig, devices } from '@playwright/test' |
|---|---|
| 2 | |
| 3 | /** |
| 4 | * Playwright e2e config. |
| 5 | * |
| 6 | * Prerequisites to run locally: |
| 7 | * 1. Backend + Postgres up on port 90 (docker compose up in rasmju-csweb-phase3) |
| 8 | * 2. `.env` has VITE_API_BASE_URL=http://localhost:90/api/v1/ |
| 9 | * |
| 10 | * Then: |
| 11 | * npm run test:e2e # headless |
| 12 | * npm run test:e2e:ui # interactive UI mode |
| 13 | * |
| 14 | * Playwright auto-starts the Vite dev server for you via `webServer` below, |
| 15 | * so you do NOT need to `npm run dev` in a separate terminal. |
| 16 | */ |
| 17 | export default defineConfig({ |
| 18 | testDir: './e2e', |
| 19 | fullyParallel: false, // shared backend seed data — keep tests serial |
| 20 | forbidOnly: !!process.env.CI, |
| 21 | retries: process.env.CI ? 1 : 0, |
| 22 | workers: 1, |
| 23 | reporter: [['list']], |
| 24 | use: { |
| 25 | baseURL: 'http://localhost:5173', |
| 26 | trace: 'on-first-retry', |
| 27 | screenshot: 'only-on-failure', |
| 28 | }, |
| 29 | projects: [ |
| 30 | { |
| 31 | name: 'chromium', |
| 32 | use: { ...devices['Desktop Chrome'] }, |
| 33 | }, |
| 34 | ], |
| 35 | webServer: { |
| 36 | command: 'npm run dev', |
| 37 | url: 'http://localhost:5173', |
| 38 | reuseExistingServer: !process.env.CI, |
| 39 | timeout: 60_000, |
| 40 | }, |
| 41 | }) |
| 42 | |