-
Notifications
You must be signed in to change notification settings - Fork 2
/
playwright.config.ts
190 lines (180 loc) Β· 5.8 KB
/
playwright.config.ts
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
import { defineConfig, devices } from '@playwright/test';
import * as dotenv from 'dotenv';
import { LogLevel } from '@slack/web-api/dist/index.js';
import path from 'path';
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
dotenv.config({
path: ['.env.playwright.local', '.env.playwright.production', '.env.playwright'],
});
const globalSetup = path.resolve('./e2e/global-setup.ts');
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
globalSetup,
globalTimeout: process.env.CI ? 1800000 : 600000,
timeout: process.env.CI ? 120000 : 60000,
expect: {
timeout: process.env.CI ? 10000 : 7000,
},
testDir: './e2e',
/* 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 : process.env.ENVIRONMENT?.startsWith('local-') ? 0 : 1,
/* Opt out of parallel tests on CI. */
workers: process.env.CI || process.env.ENVIRONMENT?.startsWith('local-') ? 4 : 6,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
[
'./node_modules/playwright-slack-report/dist/src/SlackReporter.js',
{
channels: ['health_check'], // provide one or more Slack channels
sendResults: 'always', // "always" , "on-failure", "off"
maxNumberOfFailuresToShow: 100,
meta: [
{
key: `Tests launched π¬`,
value: `${process.env.CI ? 'Github Actions π' : 'Locally'}`,
},
{
key: `Environment π·π»ββοΈ`,
value: `${process.env.ENVIRONMENT?.toUpperCase()}`,
},
{
key: `Application π²`,
value: `${process.env.APP_NAME?.toUpperCase()}`,
},
{
key: 'Tested user with no rights',
value: process.env.EMAIL,
},
{
key: `HTML Results π`,
value: '<https://konturtestplaywright.surge.sh/|(see)>',
},
{
key: `Note`,
value:
'HTML results are updated only when tests are run from GitHub Actions. β After each run, the report is refreshed. β»οΈ For previous reports, go to Workflow runs (below) -> Any workflow run -> Artifacts π΅οΈ',
},
{
key: `Workflow runs π¦Ύ`,
value:
'<https://github.com/konturio/disaster-ninja-fe/actions/workflows/run_e2e_tests.yml|(see)>',
},
],
slackOAuthToken: process.env.SLACK_BOT_USER_OAUTH_TOKEN,
slackLogLevel: LogLevel.DEBUG,
disableUnfurl: true,
showInThread: true,
},
],
['html'], // other reporters
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
ignoreHTTPSErrors: true,
trace: 'on-first-retry',
actionTimeout: process.env.CI ? 20000 : 15000,
navigationTimeout: process.env.CI ? 20000 : 15000,
viewport: { width: 1280, height: 720 },
screenshot: 'only-on-failure',
},
/* Configure projects for major browsers */
projects: [
{
name: 'setup',
testMatch: 'auth.setup.ts',
},
{
name: 'setup_pro',
testMatch: 'authAsPro.setup.ts',
dependencies: ['setup'],
},
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
testIgnore: [/WithUser/, /WithPro/],
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
testIgnore: [/WithUser/, 'location.spec.ts', /WithPro/, 'privacy.spec.ts'],
},
{
name: 'chromium_logged_in',
use: { ...devices['Desktop Chrome'], storageState: 'e2e/.auth/user.json' },
dependencies: ['setup'],
testMatch: /WithUser/,
},
{
name: 'webkit_logged_in',
use: { ...devices['Desktop Safari'], storageState: 'e2e/.auth/user.json' },
dependencies: ['setup'],
testMatch: /WithUser/,
testIgnore: ['privacyWithUser.spec.ts'],
},
{
name: 'chromium_pro',
use: { ...devices['Desktop Chrome'], storageState: 'e2e/.auth/user-pro.json' },
dependencies: ['setup_pro'],
testMatch: /WithPro/,
testIgnore: ['openOsmWithPro.spec.ts'],
},
{
name: 'webkit_pro',
use: { ...devices['Desktop Safari'], storageState: 'e2e/.auth/user-pro.json' },
dependencies: ['setup_pro'],
testMatch: /WithPro/,
testIgnore: [
'locationWithPro.spec.ts',
'privacyWithPro.spec.ts',
'openOsmWithPro.spec.ts',
'populationPopupWithPro.spec.ts',
],
},
{
name: 'chromium_pro_affecting',
use: { ...devices['Desktop Chrome'], storageState: 'e2e/.auth/user-pro.json' },
dependencies: ['chromium_pro'],
testMatch: ['openOsmWithPro.spec.ts'],
},
// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
/* 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: 'pnpm dev',
// url: 'https://localhost:3000/',
// reuseExistingServer: !process.env.CI,
// stdout: 'pipe',
// timeout: 30000
// },
});