-
Notifications
You must be signed in to change notification settings - Fork 341
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
77 lines (74 loc) · 2.13 KB
/
playwright.config.ts
File metadata and controls
77 lines (74 loc) · 2.13 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
import { type PlaywrightTestConfig, defineConfig } from '@playwright/test';
import { cpus } from 'os';
import { NEXT_SERVERS } from './tests/servers';
// Prevent Vite from attempting to clear the screen
process.stdout.isTTY = false;
const config: PlaywrightTestConfig = defineConfig({
fullyParallel: true,
testMatch: '**/*.playwright.ts',
updateSnapshots: 'none',
expect: {
toMatchSnapshot: {
threshold: 0.2,
maxDiffPixelRatio: 0.02,
},
},
webServer: NEXT_SERVERS.map((server) => ({
command: server.script + ` --port ${server.port}`,
env: { NODE_ENV: server.isProduction ? 'production' : 'development' },
url: `http://localhost:${server.port}`,
reuseExistingServer: !process.env.CI,
name: server.name,
})),
workers: process.env.CI ? cpus().length : undefined,
retries: process.env.CI ? 2 : 0,
timeout: 120_000,
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;