-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.js
More file actions
112 lines (99 loc) · 2.31 KB
/
playwright.config.js
File metadata and controls
112 lines (99 loc) · 2.31 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
107
108
109
110
111
112
/**
* Playwright Configuration for Tour Operator Plugin
*
* @package Tour_Operator
* @subpackage Tests
*/
const { defineConfig, devices } = require('@playwright/test');
/**
* Read environment variables for WordPress test environment
* These should match your local WordPress installation
*/
const baseURL = process.env.WP_BASE_URL || 'http://localhost:8888';
const adminUsername = process.env.WP_ADMIN_USER || 'admin';
const adminPassword = process.env.WP_ADMIN_PASS || 'password';
/**
* Playwright Test Configuration
*
* @see https://playwright.dev/docs/test-configuration
*/
module.exports = defineConfig({
testDir: './tests/e2e',
/**
* Maximum time one test can run for
*/
timeout: 60 * 1000,
/**
* Test execution settings
*/
fullyParallel: false, // Run tests in series for WordPress
forbidOnly: !!process.env.CI, // Fail if test.only in CI
retries: process.env.CI ? 2 : 0, // Retry on CI failures
workers: 1, // Single worker for WordPress (avoids conflicts)
/**
* Reporter configuration
*/
reporter: [
['html', { open: 'never' }],
['list'],
...(process.env.CI ? [['github']] : []),
],
/**
* Shared test configuration
*/
use: {
baseURL,
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
/**
* WordPress-specific configuration
*/
storageState: {
cookies: [],
origins: [],
},
},
/**
* Test projects (browsers)
*/
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
// Uncomment to test in additional browsers
// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },
],
/**
* WordPress E2E Test Utils Configuration
*/
globalSetup: require.resolve(
'@wordpress/e2e-test-utils-playwright/playwright.config'
),
/**
* Environment setup for @wordpress/e2e-test-utils-playwright
*/
env: {
WP_BASE_URL: baseURL,
WP_ADMIN_USER: adminUsername,
WP_ADMIN_PASS: adminPassword,
},
/**
* Web server configuration (optional - if you want Playwright to start WordPress)
* Comment out if your WordPress is already running
*/
// webServer: {
// command: 'npm run wp-env start',
// port: 8888,
// timeout: 120 * 1000,
// reuseExistingServer: !process.env.CI,
// },
});