-
Notifications
You must be signed in to change notification settings - Fork 0
/
playwright.config.ts
80 lines (75 loc) · 1.77 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
import { defineConfig, devices } from "@playwright/test"
export default defineConfig({
testDir: "./test/e2e",
timeout: process.env.CI ? 60_000 : 30_000,
expect: {
timeout: 5000,
toHaveScreenshot: {
threshold: 0.05,
},
},
fullyParallel: true,
forbidOnly: !!process.env.CI,
maxFailures: process.env.CI ? 10 : undefined,
retries: process.env.CI ? 1 : 0,
workers: process.env.CI ? 2 : undefined,
reporter: [
[process.env.CI ? "github" : "line"],
["html", { outputFolder: "./test/e2e/output/html/", open: "never" }],
],
use: {
actionTimeout: 0,
baseURL: "http://localhost:4321",
trace: process.env.PLAYWRIGHT_TRACE
? "retain-on-failure"
: "on-first-retry",
screenshot: "only-on-failure",
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
grepInvert: /@mobile/,
},
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
grepInvert: /@mobile/,
},
{
name: "webkit",
use: { ...devices["Desktop Safari"] },
grepInvert: /@mobile/,
expect: {
toHaveScreenshot: {
maxDiffPixelRatio: 0.00025,
},
},
},
{
name: "pixel-5",
use: { ...devices["Pixel 5"] },
},
{
name: "pixel-5-landscape",
use: { ...devices["Pixel 5 landscape"] },
},
{
name: "ipad-7",
use: { ...devices["iPad (gen 7)"] },
grepInvert: /@mobile/,
expect: {
toHaveScreenshot: {
maxDiffPixelRatio: 0.00025,
},
},
},
],
outputDir: "test/e2e/output/artefacts/",
snapshotPathTemplate:
"{testDir}/__screenshots__/{testFilePath}/{arg}--{projectName}{ext}",
webServer: {
command: "npm run preview",
port: 4321,
},
})