Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
41 lines (39 loc) · 1.56 KB
/
Copy pathplaywright.config.ts
File metadata and controls
41 lines (39 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { defineConfig, devices } from '@playwright/test'
const isCI = !!process.env.CI
const skipBuild = !!process.env.SKIP_BUILD
export default defineConfig({
testDir: './tests/e2e',
fullyParallel: true,
forbidOnly: isCI,
retries: 0,
workers: isCI ? 2 : undefined,
reporter: 'html',
// Use OS-independent snapshot names (HTML content is the same across platforms)
snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}{ext}',
use: {
baseURL: isCI ? 'http://localhost:4173' : 'http://localhost:5173',
trace: 'on-first-retry',
// Fixed viewport to ensure consistent map rendering
viewport: { width: 1280, height: 720 },
},
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
// CHROMIUM_PATH: point at a system-installed browser (e.g. NixOS, where Playwright's own
// downloaded chromium is dynamically linked against libs the sandbox doesn't have).
// Unset elsewhere (CI, other machines) so Playwright uses its own managed browser.
...(process.env.CHROMIUM_PATH ? { launchOptions: { executablePath: process.env.CHROMIUM_PATH } } : {}),
},
},
],
webServer: {
// In CI: build (done as a separate cached step) and preview for production-like testing
// In dev: use vite dev server (faster, no rebuild needed)
command: isCI ? (skipBuild ? 'npm run preview' : 'npm run build && npm run preview') : 'npm run dev',
url: isCI ? 'http://localhost:4173' : 'http://localhost:5173',
reuseExistingServer: !isCI,
timeout: 120000,
},
})