-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
55 lines (53 loc) · 1.51 KB
/
Copy pathplaywright.config.ts
File metadata and controls
55 lines (53 loc) · 1.51 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
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: 'html',
use: {
baseURL: 'http://localhost:3000',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
},
// Visual regression testing configuration
expect: {
toHaveScreenshot: {
// An acceptable ratio of pixels that are different to the total amount of pixels
threshold: 0.3,
// An acceptable amount of pixels that could be different
maxDiffPixels: 1000,
},
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
testIgnore: 'e2e/visual/**/*',
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
testIgnore: 'e2e/visual/**/*',
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
testIgnore: 'e2e/visual/**/*',
},
// Visual regression tests only run on chromium for consistency
{
name: 'visual',
testDir: './e2e/visual',
use: { ...devices['Desktop Chrome'] },
},
],
webServer: {
// Prefer the dev branch DB (seeded) for local E2E runs; fall back to `next start`
// (mock DB_URL from CI) when no local env file is present.
command: '[ -f .env.development ] && dotenv -e .env.development -- next start || next start',
port: 3000,
reuseExistingServer: true,
},
});