-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplaywright.config.js
More file actions
79 lines (71 loc) · 2 KB
/
Copy pathplaywright.config.js
File metadata and controls
79 lines (71 loc) · 2 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
/**
* Playwright configuration for the WPify Custom Fields E2E Smoke set.
*
* The canonical environment is wp-env (see .wp-env.json), served at
* http://localhost:8889. Point the suite at any other WordPress install
* (e.g. the DDEV dev site) by exporting WP_BASE_URL, and override the admin
* credentials with WP_USERNAME / WP_PASSWORD (DDEV uses admin / admin;
* wp-env defaults to admin / password).
*/
const path = require( 'path' );
const { defineConfig, devices } = require( '@playwright/test' );
process.env.WP_ARTIFACTS_PATH =
process.env.WP_ARTIFACTS_PATH || path.join( __dirname, 'tests/e2e/artifacts' );
process.env.STORAGE_STATE_PATH =
process.env.STORAGE_STATE_PATH ||
path.join( process.env.WP_ARTIFACTS_PATH, 'storage-states/admin.json' );
const baseURL = process.env.WP_BASE_URL || 'http://localhost:8889';
module.exports = defineConfig( {
testDir: path.join( __dirname, 'tests/e2e' ),
globalSetup: require.resolve( './tests/e2e/config/global-setup.js' ),
outputDir: path.join( process.env.WP_ARTIFACTS_PATH, 'test-results' ),
// The specs mutate shared site state (options, a product, a post); run them
// serially in a single worker so they never race each other.
fullyParallel: false,
workers: 1,
forbidOnly: !! process.env.CI,
retries: process.env.CI ? 2 : 0,
timeout: 90_000,
expect: { timeout: 15_000 },
reporter: process.env.CI
? [
[ 'github' ],
[
'html',
{
open: 'never',
outputFolder: path.join(
process.env.WP_ARTIFACTS_PATH,
'playwright-report'
),
},
],
]
: [
[ 'list' ],
[
'html',
{
open: 'never',
outputFolder: path.join(
process.env.WP_ARTIFACTS_PATH,
'playwright-report'
),
},
],
],
use: {
baseURL,
storageState: process.env.STORAGE_STATE_PATH,
actionTimeout: 15_000,
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'off',
},
projects: [
{
name: 'chromium',
use: { ...devices[ 'Desktop Chrome' ] },
},
],
} );