-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
248 lines (226 loc) · 6.26 KB
/
Copy pathplaywright.config.ts
File metadata and controls
248 lines (226 loc) · 6.26 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
/**
* External dependencies
*/
import { defineConfig, devices, ViewportSize } from '@playwright/test';
import { WpCliEnvType } from '@inpsyde/playwright-utils/build/@types/wp-cli';
import dotenv from 'dotenv';
import path from 'path';
/**
* Internal dependencies
*/
import { BaseExtend } from './tests/qa/utils';
const dotenvPath = process.env.CI
? path.resolve( __dirname, '.env.ci' )
: undefined;
dotenv.config( { path: dotenvPath } );
const viewportSize: ViewportSize = { width: 1280, height: 850 };
export default defineConfig< BaseExtend >( {
testDir: 'tests/qa/tests',
expect: {
timeout: 20_000,
},
timeout: 2 * 60_000,
/* Run tests in files in parallel */
fullyParallel: false,
/* 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 ? 1 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : 1,
/* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot */
snapshotDir: './snapshots',
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
[ 'list' ],
[ 'html', { outputFolder: 'playwright-report' } ],
[
'@inpsyde/playwright-utils/build/integration/jira/xray-reporter.js',
{
apiClient: {
client_id: process.env.XRAY_CLIENT_ID,
client_secret: process.env.XRAY_CLIENT_SECRET,
},
testExecutionKey: process.env.XRAY_TEST_EXEC_KEY,
},
],
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
globalSetup: require.resolve( './tests/qa/global-setup' ),
use: {
baseURL: process.env.WP_BASE_URL,
storageState: process.env.STORAGE_STATE_PATH_ADMIN,
ignoreHTTPSErrors: process.env.IGNORE_HTTPS_ERRORS === 'true',
/**
* For envs with Basic Auth. Omit when both are empty (e.g. wp-env).
*/
...( process.env.WP_BASIC_AUTH_USER &&
process.env.WP_BASIC_AUTH_PASS && {
httpCredentials: {
username: process.env.WP_BASIC_AUTH_USER,
password: process.env.WP_BASIC_AUTH_PASS,
},
} ),
...devices[ 'Desktop Chrome' ],
launchOptions: {
// Put your chromium-specific args here
args: [ '--disable-web-security' ],
},
viewport: viewportSize,
trace: process.env.CI
? 'off'
: 'retain-on-failure', //process.env.CI ? 'off' : 'on-first-retry',//'on',//
screenshot: {
mode: 'only-on-failure',
fullPage: true, // Captures entire scrollable page
},
video: process.env.CI
? 'off'
: {
mode: 'retain-on-failure', //'on',//
size: viewportSize,
},
recordVideoOptions: process.env.CI
? undefined
: {
mode: 'retain-on-failure',
size: viewportSize,
},
cliConfig: {
envType: process.env.WPCLI_ENV_TYPE as WpCliEnvType,
path: process.env.WPCLI_PATH,
ssh: {
login: process.env.SSH_LOGIN,
host: process.env.SSH_HOST,
port: process.env.SSH_PORT,
path: process.env.SSH_PATH,
},
},
},
projects: [
// Manual setup (grep scripts target this — no dependency chain)
{
name: 'setup',
testMatch: /(01-env|02-woocommerce|03-pcp)\.setup\.ts/,
fullyParallel: false,
},
// WooCommerce (dependency target only)
{
name: 'setup-woocommerce',
testMatch: /02-woocommerce\.setup\.ts/,
fullyParallel: false,
},
// PCP setups by country (dependency targets)
{
name: 'setup-pcp-usa',
dependencies: [ 'setup-woocommerce' ],
testMatch: /03-pcp\.setup\.ts/,
grep: /setup:pcp:usa;/,
fullyParallel: false,
},
{
name: 'setup-pcp-germany',
dependencies: [ 'setup-woocommerce' ],
testMatch: /03-pcp\.setup\.ts/,
grep: /setup:pcp:germany;/,
fullyParallel: false,
},
{
name: 'setup-pcp-mexico',
dependencies: [ 'setup-woocommerce' ],
testMatch: /03-pcp\.setup\.ts/,
grep: /setup:pcp:mexico;/,
fullyParallel: false,
},
// Setup per test set (dependency targets)
{
name: 'setup-transaction-usa',
dependencies: [ 'setup-pcp-usa' ],
testMatch: /03-pcp\.setup\.ts/,
grep: /setup:transaction:usa;/,
fullyParallel: false,
},
{
name: 'setup-transaction-mexico',
dependencies: [ 'setup-pcp-mexico' ],
testMatch: /03-pcp\.setup\.ts/,
grep: /setup:transaction:mexico;/,
fullyParallel: false,
},
{
name: 'setup-transaction-germany',
dependencies: [ 'setup-pcp-germany' ],
testMatch: /03-pcp\.setup\.ts/,
grep: /setup:transaction:germany;/,
fullyParallel: false,
},
{
name: 'setup-vaulting',
dependencies: [ 'setup-pcp-usa' ],
testMatch: /03-pcp\.setup\.ts/,
grep: /setup:vaulting;/,
fullyParallel: false,
},
{
name: 'setup-subscription',
dependencies: [ 'setup-pcp-usa' ],
testMatch: /03-pcp\.setup\.ts/,
grep: /setup:subscription;/,
fullyParallel: false,
},
// Test projects
{
name: 'stress',
dependencies: [ 'setup-woocommerce' ],
testMatch: /stress\.spec\.ts/,
},
// =============================================================
// Project shards (for parallel/separate executions)
// =============================================================
{
name: 'shard:plugin-foundation',
dependencies: [ 'setup-woocommerce' ],
testMatch: /01-plugin-foundation\/.*\.spec\.ts/,
},
{
name: 'shard:onboarding',
dependencies: [ 'setup-woocommerce' ],
testMatch: /02-onboarding\/.*\.spec\.ts/,
},
{
name: 'shard:settings',
dependencies: [ 'setup-woocommerce' ],
testMatch: /03-plugin-settings\/.*\.spec\.ts/,
},
{
name: 'shard:transaction-usa',
dependencies: [ 'setup-transaction-usa' ],
testMatch: /05-transactions\/transaction-usa.*\.spec\.ts/,
},
{
name: 'shard:transaction-mexico',
dependencies: [ 'setup-transaction-mexico' ],
testMatch: /05-transactions\/transaction-mexico.*\.spec\.ts/,
},
{
name: 'shard:transaction-germany',
dependencies: [ 'setup-transaction-germany' ],
testMatch: /05-transactions\/transaction-germany.*\.spec\.ts/,
},
{
name: 'shard:refund',
dependencies: [ 'setup-transaction-usa' ],
testMatch: /06-refund\/.*\.spec\.ts/,
},
{
name: 'shard:vaulting',
dependencies: [ 'setup-vaulting' ],
testMatch: /07-vaulting\/.*\.spec\.ts/,
},
{
name: 'shard:subscription',
dependencies: [ 'setup-subscription' ],
testMatch: /08-subscription\/.*\.spec\.ts/,
},
],
} );