-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
250 lines (236 loc) · 7.21 KB
/
Copy pathplaywright.config.ts
File metadata and controls
250 lines (236 loc) · 7.21 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
249
250
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig, devices } from '@playwright/test';
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './e2e/tests',
/* Run tests in files in parallel */
fullyParallel: true,
/* 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 ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 2 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [['html', { outputFolder: 'playwright-report' }]],
outputDir: 'test-results',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
screenshot: 'only-on-failure',
},
/* Configure projects for major browsers */
projects: [
// The setup test logs in 5 users (admin + readwrite + readonly + 2 sign-out
// dedicated users). 30 s is not enough; use 120 s.
{name: 'setup', testMatch: /.*\.setup\.ts/, timeout: 120000},
// Cluster tests (new project for cluster functionality)
{
name: '[Cluster] - Chromium',
use: {
...devices['Desktop Chrome'],
},
grep: /@cluster/,
testMatch: /.*cluster\.spec\.ts$/,
},
{
name: '[Cluster] - Firefox',
use: {
...devices['Desktop Firefox'],
},
grep: /@cluster/,
testMatch: /.*cluster\.spec\.ts$/,
},
// Regular projects for sharding (exclude TLS, settings, and tests that
// call Logout() — those destroy shared Token DB entries and break other
// parallel tests using the same admin session).
{
name: '[Admin] Chromium',
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['setup'],
grep: /@admin/,
testIgnore: /.*settingsConfig\.spec\.ts$|.*settingsUsers\.spec\.ts$|.*tls\.spec\.ts$|.*cluster\.spec\.ts$|.*signOut\.spec\.ts$/,
},
{
name: '[Admin] Firefox',
use: {
...devices['Desktop Firefox'],
storageState: 'playwright/.auth/admin.json',
},
timeout: 40000,
dependencies: ['setup'],
grep: /@admin/,
testIgnore: /.*settingsConfig\.spec\.ts$|.*settingsUsers\.spec\.ts$|.*tls\.spec\.ts$|.*cluster\.spec\.ts$|.*signOut\.spec\.ts$/,
},
{
name: '[Read-Write] - Chromium',
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/readwriteuser.json',
},
dependencies: ['setup'],
grep: /@readwrite/,
testIgnore: /.*tls\.spec\.ts$|.*cluster\.spec\.ts$|.*signOut\.spec\.ts$/,
},
{
name: '[Read-Write] - Firefox',
use: {
...devices['Desktop Firefox'],
storageState: 'playwright/.auth/readwriteuser.json',
},
timeout: 40000,
dependencies: ['setup'],
grep: /@readwrite/,
testIgnore: /.*tls\.spec\.ts$|.*cluster\.spec\.ts$|.*signOut\.spec\.ts$/,
},
{
name: '[Read-Only] - Chromium',
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/readonlyuser.json',
},
dependencies: ['setup'],
grep: /@readonly/,
testIgnore: /.*tls\.spec\.ts$|.*cluster\.spec\.ts$|.*signOut\.spec\.ts$/,
},
{
name: '[Read-Only] - Firefox',
use: {
...devices['Desktop Firefox'],
storageState: 'playwright/.auth/readonlyuser.json',
},
timeout: 40000,
dependencies: ['setup'],
grep: /@readonly/,
testIgnore: /.*tls\.spec\.ts$|.*cluster\.spec\.ts$|.*signOut\.spec\.ts$/,
},
// Sign-out tests (dedicated projects with isolated auth state).
// Each project uses a SEPARATE auth file that is safe to invalidate;
// the shared readwriteuser / readonlyuser sessions are never touched.
{
name: '[Admin: Sign-Out] Chromium',
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
dependencies: ['setup'],
grep: /@admin/,
testMatch: /.*signOut\.spec\.ts$/,
},
{
name: '[Read-Write: Sign-Out] Chromium',
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/signout-readwriteuser.json',
},
dependencies: ['setup'],
grep: /@readwrite/,
testMatch: /.*signOut\.spec\.ts$/,
},
{
name: '[Read-Only: Sign-Out] Chromium',
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/signout-readonlyuser.json',
},
dependencies: ['setup'],
grep: /@readonly/,
testMatch: /.*signOut\.spec\.ts$/,
},
// Settings tests (run separately)
{
name: '[Admin: Settings - Chromium]',
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/admin.json',
},
grep: /@admin|@config/,
dependencies: ['setup'],
testMatch: /.*(settingsConfig|settingsUsers)\.spec\.ts$/,
},
{
name: '[Admin: Settings - Firefox]',
use: {
...devices['Desktop Firefox'],
storageState: 'playwright/.auth/admin.json',
},
grep: /@admin|@config/,
dependencies: ['setup'],
testMatch: /.*(settingsConfig|settingsUsers)\.spec\.ts$/,
},
// Smoke tests (run separately against the dockers - browser + core).
// Self-contained: no setup dependency, no stored auth state.
{
name: '[Smoke] - Chromium',
use: {
...devices['Desktop Chrome'],
},
grep: /@smoke/,
testMatch: /.*smoke\.spec\.ts$/,
},
{
name: '[Smoke] - Firefox',
use: {
...devices['Desktop Firefox'],
},
grep: /@smoke/,
testMatch: /.*smoke\.spec\.ts$/,
},
// TLS tests (run separately)
{
name: '[TLS - Chromium]',
use: {
...devices['Desktop Chrome'],
},
grep: /@tls/,
},
{
name: '[TLS - Firefox]',
use: {
...devices['Desktop Firefox'],
},
grep: /@tls/,
},
// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },
/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
});