-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
88 lines (74 loc) · 2.49 KB
/
playwright.config.ts
File metadata and controls
88 lines (74 loc) · 2.49 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import { defineConfig, devices } from '@playwright/test';
/**
* Playwright configuration for documentation screenshot automation.
* See https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
testDir: './scripts/docs-screenshots',
// Run tests sequentially for consistent screenshots
fullyParallel: false,
// Fail the build on CI if you accidentally left test.only in the source code
forbidOnly: !!process.env.CI,
// No retries for screenshot generation
retries: 0,
// Single worker for consistent captures
workers: 1,
// Reporter
reporter: 'list',
// Timeout for each test (60s)
timeout: 60000,
// Shared settings for all projects
use: {
// Base URL for the app
baseURL: 'http://localhost:8080',
// Capture trace on failure for debugging
trace: 'on-first-retry',
// Screenshot settings
screenshot: 'off', // We handle screenshots manually
// Video recording for GIF animations
video: {
mode: 'on',
size: { width: 1536, height: 864 },
},
},
// Configure projects
projects: [
{
name: 'screenshots',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1536, height: 864 },
// Disable video for static screenshots
video: 'off',
// WebGL support: use headless mode based on environment
// On macOS, headless: false uses system GPU for better WebGL support
// On CI, headless: true uses SwiftShader (software rendering)
// For better WebGL on CI, consider using xvfb with headless: false
headless: !!process.env.CI,
},
testMatch: /capture-static\.spec\.ts/,
},
{
name: 'animations',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1536, height: 864 },
// Enable video recording for animations
video: {
mode: 'on',
size: { width: 1536, height: 864 },
},
// WebGL support: use headless mode based on environment
// On macOS, headless: false uses system GPU for better WebGL support
// On CI, headless: true uses SwiftShader (software rendering)
// For better WebGL on CI, consider using xvfb with headless: false
headless: !!process.env.CI,
},
testMatch: /capture-animations\.spec\.ts/,
},
],
// Output directories
outputDir: './test-results/',
// Don't start a web server - assume dev server is already running
// Run `pnpm dev:app` before running screenshot generation
});