Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
103 lines (95 loc) · 2.66 KB
/
Copy pathplaywright.config.ts
File metadata and controls
103 lines (95 loc) · 2.66 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
import { defineConfig, devices, ReporterDescription } from '@playwright/test';
const MAX_DIFF_PIXEL_RATIO = 0.025 as const;
const isDevelopment = !process.env.CI;
const reporter: ReporterDescription[] = isDevelopment ? [['list']] : [
['html', { open: 'never' }],
['playwright-teamcity-reporter', {
'testMetadataArtifacts': 'test-results',
logConfig: false
}]
];
const retries = isDevelopment ? 0 : 2;
const timeout = isDevelopment ? 10000 : 5000;
const forbidOnly = !isDevelopment;
export default defineConfig({
globalSetup: require.resolve('./test/global-setup.ts'),
forbidOnly,
retries,
reporter,
snapshotDir: 'test/snapshots',
expect: {
timeout,
toMatchSnapshot: { maxDiffPixelRatio: MAX_DIFF_PIXEL_RATIO },
toHaveScreenshot: { maxDiffPixelRatio: MAX_DIFF_PIXEL_RATIO }
},
use: {
baseURL: process.env.BASE_URL || 'http://localhost:3000',
storageState: 'test/storage-state.json',
trace: 'off',
screenshot: 'only-on-failure',
video: 'retain-on-failure'
},
projects: getProjects()
});
function getProjects() {
if (process.env.E2E_PROJECTS === 'breakpoints-v2') return [
{
name: 'MS',
use: {
viewport: { width: 414, height: 736 },
deviceScaleFactor: 2,
isMobile: true,
hasTouch: true
}
},
{
name: 'ML',
use: {
viewport: { width: 473, height: 896 },
deviceScaleFactor: 2,
isMobile: true,
hasTouch: true
}
},
{
name: 'TS',
use: {
viewport: { width: 648, height: 864 },
deviceScaleFactor: 2,
isMobile: true,
hasTouch: true
}
},
{
name: 'TL',
use: {
viewport: { width: 810, height: 1080 },
deviceScaleFactor: 2,
isMobile: true,
hasTouch: true
}
},
{
name: 'DS',
use: {
viewport: { width: 1008, height: 1792 },
deviceScaleFactor: 2,
isMobile: false,
hasTouch: false
}
},
{
name: 'DL',
use: {
viewport: { width: 1280, height: 720 },
deviceScaleFactor: 2,
isMobile: false,
hasTouch: false
}
}
];
return [{
name: 'chromium',
use: { ...devices['Desktop Chrome'] }
}];
}