-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaywright.config.ts
90 lines (75 loc) · 1.9 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
// import
import {defineConfig, devices} from '@playwright/test';
// vars
const isCI = !!process.env.CI;
const useBC = !!process.env.BCAT;
const getConnectOpts = () => {
const key = process.env.BROWSERCAT_API_KEY;
if (!key) {
throw new Error('Missing BROWSERCAT_API_KEY');
}
return {
wsEndpoint: 'wss://api.browsercat.com/connect',
headers: {'Api-Key': key},
};
};
const connectOptions = useBC ? getConnectOpts() : undefined;
// export
export default defineConfig({
timeout: 1000 * 60,
workers: useBC ? 10 : isCI ? 1 : '50%',
retries: useBC || isCI ? 2 : 0,
maxFailures: useBC && !isCI ? 0 : 3,
forbidOnly: isCI,
outputDir: '.test/spec/output',
snapshotPathTemplate: '.test/spec/snaps/{projectName}/{testFilePath}/{arg}{ext}',
testMatch: '*.spec.{ts,tsx}',
reporter: [
['json', {outputFile: '.test/spec/results.json'}],
['html', {outputFolder: '.test/spec/results', open: 'never'}],
isCI ? ['github'] : ['line'],
],
reportSlowTests: {
max: 5,
threshold: 1000 * 15,
},
expect: {
toMatchSnapshot: {
maxDiffPixelRatio: 0.05,
},
},
use: {
trace: 'on-first-retry',
},
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
connectOptions,
},
},
/**
* It's better to target a single browser for automations. We prefer
* Chromium-based browsers because they support PDF-generation and
* video-recording.
*
* However, your use-case may vary, and you are free to target any or all
* browsers. If so, uncomment these lines and add new config as needed.
*/
// {
// name: 'firefox',
// use: {
// ...devices['Desktop Firefox'],
// connectOptions,
// },
// },
// {
// name: 'webkit',
// use: {
// ...devices['Desktop Safari'],
// connectOptions,
// },
// },
],
});