-
Notifications
You must be signed in to change notification settings - Fork 291
/
playwright.config.ts
67 lines (64 loc) · 1.75 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
import { PlaywrightTestConfig, defineConfig } from '@playwright/test';
import { cpus } from 'os';
// Prevent Vite from attempting to clear the screen
process.stdout.isTTY = false;
const config: PlaywrightTestConfig = defineConfig({
testMatch: '**/*.playwright.ts',
updateSnapshots: 'none',
expect: {
toMatchSnapshot: {
threshold: 0.2,
maxDiffPixelRatio: 0.02,
},
},
workers: process.env.CI ? cpus().length : undefined,
retries: process.env.CI ? 2 : 0,
forbidOnly: !!process.env.CI,
snapshotDir: 'tests/e2e/snapshots',
// put all snapshots in one directory
// https://playwright.dev/docs/api/class-testconfig#test-config-snapshot-path-template
snapshotPathTemplate: '{snapshotDir}/{arg}-{projectName}-{platform}{ext}',
projects: [
{
name: 'Desktop - Chromium',
grepInvert: /@agnostic/,
use: {
browserName: 'chromium',
channel: 'chrome',
viewport: {
width: 1200,
height: 1080,
},
},
},
{
name: 'Mobile - Chromium',
grepInvert: /@agnostic/,
use: {
browserName: 'chromium',
channel: 'chrome',
viewport: {
width: 414,
height: 896,
},
},
},
{
// If a test is browser/platform agnostic, add the @agnostic tag to the
// test name. We omit the project name here to keep snapshot names tidy.
name: '',
grep: /@agnostic/,
// put css snapshots in test filename subdirectories
snapshotPathTemplate: '{testFileDir}/{testFileName}-snapshots/{arg}{ext}',
use: {
browserName: 'chromium',
channel: 'chrome',
viewport: {
width: 1200,
height: 1080,
},
},
},
],
});
export default config;