-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathplaywright.premium.config.js
More file actions
75 lines (70 loc) · 2.61 KB
/
Copy pathplaywright.premium.config.js
File metadata and controls
75 lines (70 loc) · 2.61 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
/**
* Playwright config for Stackable's premium e2e suite.
*
* Requires `pro__premium_only/` on disk and a prior `npm run build:e2e:premium`.
* Uses a separate Playground port and mounts the e2e premium-mock
* MU-plugin (in-memory Freemius license + exit activation mode).
*
* See e2e/readme.md.
*/
const path = require( 'path' )
const { defineConfig, devices } = require( '@playwright/test' )
const PORT = process.env.WP_PORT || '9421'
const baseURL = process.env.WP_BASE_URL || `http://127.0.0.1:${ PORT }`
process.env.WP_BASE_URL = baseURL
process.env.WP_USERNAME = process.env.WP_USERNAME || 'admin'
process.env.WP_PASSWORD = process.env.WP_PASSWORD || 'password'
process.env.STACKABLE_SLUG = process.env.STACKABLE_SLUG || 'stackable/plugin'
const STORAGE_STATE_PATH = path.join( __dirname, 'e2e/.auth/admin.premium.json' )
process.env.STORAGE_STATE_PATH = STORAGE_STATE_PATH
const PLAYGROUND_BLUEPRINT = path.join( __dirname, 'e2e/playground-blueprint.json' )
const PHP_VERSION = process.env.WP_PHP_VERSION || '8.2'
const WP_VERSION = process.env.WP_VERSION || 'latest'
const MOCK_PREMIUM_MU = path.join(
__dirname,
'pro__premium_only/e2e/mu-plugins/stackable-e2e-mock-premium.php'
)
const E2E_META_MU = path.join(
__dirname,
'e2e/config/stackable-e2e-mu-plugin.php'
)
module.exports = defineConfig( {
testDir: './pro__premium_only/e2e/tests',
globalSetup: require.resolve( './e2e/config/global-setup.js' ),
fullyParallel: false,
forbidOnly: !! process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: 1,
timeout: 120_000,
reporter: process.env.CI
? [ [ './e2e/config/reporter.ts', { outputFolder: './playwright-stk-premium' } ], [ 'github' ], [ 'html', { outputFolder: 'playwright-report-premium', open: 'never' } ] ]
: [ [ 'list' ], [ 'html', { outputFolder: 'playwright-report-premium', open: 'never' } ] ],
reportSlowTests: null,
webServer: {
command: [
'npx @wp-playground/cli server',
'--mount=.:/wordpress/wp-content/plugins/stackable',
`--mount=${ E2E_META_MU }:/wordpress/wp-content/mu-plugins/stackable-e2e.php`,
`--mount=${ MOCK_PREMIUM_MU }:/wordpress/wp-content/mu-plugins/stackable-e2e-mock-premium.php`,
`--blueprint=${ PLAYGROUND_BLUEPRINT }`,
`--php=${ PHP_VERSION }`,
`--wp=${ WP_VERSION }`,
`--port=${ PORT }`,
'--workers=1',
].join( ' ' ),
port: Number( PORT ),
reuseExistingServer: ! process.env.CI,
timeout: 180 * 1000,
stdout: 'pipe',
stderr: 'pipe',
},
use: {
baseURL,
storageState: STORAGE_STATE_PATH,
ignoreHTTPSErrors: true,
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
video: 'retain-on-failure',
...devices[ 'Desktop Chrome' ],
},
} )