Repository navigation
Expand file tree
/
Copy pathplaywright.config.js
More file actions
47 lines (46 loc) · 1.53 KB
/
Copy pathplaywright.config.js
File metadata and controls
47 lines (46 loc) · 1.53 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
// playwright.config.js
const { defineConfig, devices } = require( '@playwright/test' );
require( 'dotenv' ).config();
module.exports = defineConfig( {
testDir: './test/e2e',
fullyParallel: false, // Disable parallel for better stability
forbidOnly: !! process.env.CI,
retries: process.env.CI ? 2 : 1,
workers: 1, // Use single worker to avoid conflicts
timeout: 180000,
expect: {
timeout: 10000, // Shorter expect timeout for faster feedback
},
reporter: [
[ 'html' ],
[ 'list', { printSteps: true } ],
[ 'junit', { outputFile: 'test-results/junit.xml' } ],
],
globalSetup: './test/e2e/global-setup.js',
use: {
baseURL: process.env.WP_BASE_URL || 'http://localhost:8889',
trace: 'on-first-retry',
video: 'on-first-retry',
screenshot: 'only-on-failure',
storageState: './test/e2e/storageState.json',
actionTimeout: 15000, // Longer action timeout for slow WordPress admin
navigationTimeout: 30000, // Longer navigation timeout
},
projects: [
{
name: 'chromium',
use: {
...devices[ 'Desktop Chrome' ],
// In CI, run against the Google Chrome preinstalled on the
// GitHub runner instead of Playwright's downloaded Chromium —
// the `playwright install chromium` download hangs after
// completing on the runners (observed 2026-05-30). Local runs
// keep using the downloaded Chromium so no system Chrome is
// required for development.
...( process.env.CI ? { channel: 'chrome' } : {} ),
storageState: './test/e2e/storageState.json',
},
},
],
outputDir: './test-results/',
} );