-
Notifications
You must be signed in to change notification settings - Fork 6
/
playwright.config.ts
78 lines (70 loc) · 2.13 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
import path from 'node:path';
import { defineConfig, devices } from '@playwright/test';
import { testDir, authFile } from './tests/e2e/fixtures/helpers';
if (!process.env.CI) {
// eslint-disable-next-line @typescript-eslint/no-require-imports
require('dotenv').config({ path: path.join(testDir, '.env') });
}
export default defineConfig({
testDir,
outputDir: path.join(testDir, 'test-results'),
// We don't want this set to true as that would make tests in each file to run
// in parallel, which will cause conflicts with the "global state". With this
// set to false and workers > 1, multiple test files can run in parallel, but
// tests within a file are run at one at a time. We make extensive use of
// worker-scope fixtures and beforeAll hooks to achieve best performance.
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [
['list'],
[
'html',
{ open: 'never', outputFolder: path.join(testDir, 'playwright-report') },
],
],
use: { trace: 'retain-on-failure' },
projects: [
{
name: 'setup',
testMatch: /.*\.setup\.ts/,
},
{
name: 'chrome',
use: {
...devices['Desktop Chrome'],
storageState: authFile,
channel: 'chrome',
},
dependencies: ['setup'],
},
// Firefox+Playwright doesn't work well enough at the moment.
// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'], storageState: authFile },
// dependencies: ['setup'],
// },
// Safari is surely a no-go for now
// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'], storageState: authFile },
// dependencies: ['setup'],
// },
{
name: 'msedge',
use: {
...devices['Desktop Edge'],
channel: 'msedge',
storageState: authFile,
},
dependencies: ['setup'],
},
],
/* 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,
// },
});