-
Notifications
You must be signed in to change notification settings - Fork 587
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
63 lines (58 loc) · 1.44 KB
/
playwright.config.ts
File metadata and controls
63 lines (58 loc) · 1.44 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
import { defineConfig, devices, expect } from '@playwright/test';
const config = defineConfig({
expect: {
toHaveScreenshot: {
maxDiffPixelRatio: 0.025,
},
},
forbidOnly: !!process.env.CI,
fullyParallel: true,
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
],
reporter: 'html',
retries: process.env.CI ? 2 : 0,
snapshotDir: './e2e/__snapshots__',
snapshotPathTemplate: '{testDir}/__snapshots__/{testName}/{arg}-{projectName}{ext}',
testDir: './e2e',
use: {
baseURL: 'http://localhost:3000',
trace: 'on-first-retry',
launchOptions: {
slowMo: process.env.SLO_MO ? Number(process.env.SLO_MO) : 0,
},
},
webServer: {
command: 'pnpm website:serve',
port: 3000,
reuseExistingServer: !process.env.CI,
},
workers: process.env.CI ? 1 : undefined,
});
expect.extend({
toBeAround(expected: number, actual: number, precision = 10) {
const pass = expected - precision <= actual && actual <= expected + precision;
if (pass) {
return {
message: () => `expected ${actual} not to be around ${expected}`,
pass: true,
};
}
return {
message: () => `expected ${actual} to be around ${expected}`,
pass: false,
};
},
});
export default config;