-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
106 lines (85 loc) · 2.89 KB
/
playwright.config.ts
File metadata and controls
106 lines (85 loc) · 2.89 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import { defineConfig, devices } from '@playwright/test';
import dotenv from 'dotenv';
// Load environment variables
dotenv.config();
const baseURL = process.env.WORDPRESS_URL || 'http://localhost:8080';
export default defineConfig({
testDir: './tests/e2e/specs',
// Run tests in parallel by default
fullyParallel: true,
// Fail the build on CI if you accidentally left test.only in the source code
forbidOnly: !!process.env.CI,
// Retry on CI only
retries: process.env.CI ? 2 : 0,
// Opt out of parallel tests on CI for more predictable results
workers: process.env.CI ? 1 : undefined,
// Reporter to use
reporter: [
['html', { open: 'never' }],
['list'],
],
// Global timeout
timeout: 30000,
// Shared settings for all the projects below
use: {
baseURL,
// Ignore HTTPS errors for local development with self-signed certificates
ignoreHTTPSErrors: true,
// Collect trace on first retry
trace: 'on-first-retry',
// Take screenshot on failure
screenshot: 'only-on-failure',
// Video recording on first retry
video: 'on-first-retry',
// Increase timeout for slow WordPress operations
actionTimeout: 15000,
// Use authenticated state by default
storageState: './auth.json',
},
// Global setup for authentication
globalSetup: './tests/e2e/global-setup.ts',
// Global teardown for cleanup
globalTeardown: './tests/e2e/global-teardown.ts',
// Configure projects for different browsers
projects: [
// Sequential tests that must run in order
// Includes: onboarding (must run first on fresh install),
// todo tests (create/delete/complete/reorder - share state),
// task-tagline (modifies WordPress settings)
{
name: 'sequential',
testMatch: [
'**/onboarding.spec.ts',
'**/todo-crud.spec.ts',
'**/todo-complete.spec.ts',
'**/todo-reorder.spec.ts',
'**/task-tagline.spec.ts',
],
use: { ...devices['Desktop Chrome'] },
fullyParallel: false,
workers: 1,
},
// Main test suite - can run in parallel
// Depends on sequential in CI (fresh install needs onboarding first)
{
name: 'parallel',
testIgnore: [
'**/onboarding.spec.ts',
'**/todo-crud.spec.ts',
'**/todo-complete.spec.ts',
'**/todo-reorder.spec.ts',
'**/task-tagline.spec.ts',
],
dependencies: process.env.CI ? ['sequential'] : [],
use: { ...devices['Desktop Chrome'] },
},
],
// Run WP Playground server before starting the tests
webServer: {
command: 'npx @wp-playground/cli server --mount=.:/wordpress/wp-content/plugins/progress-planner --blueprint=tests/e2e/blueprint.json --port=8080',
url: 'http://localhost:8080',
// Always reuse if server is already running (needed for Yoast tests which use Docker WordPress)
reuseExistingServer: true,
timeout: 120 * 1000,
},
});