-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathplaywright.visual.config.ts
More file actions
52 lines (50 loc) · 1.32 KB
/
Copy pathplaywright.visual.config.ts
File metadata and controls
52 lines (50 loc) · 1.32 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
import { defineConfig, devices } from '@playwright/test';
import {
applyEnvDefaults,
loadPlaywrightTestEnv,
} from './tests/e2e/helpers/testEnv';
const isCI = !!process.env.CI;
const visualEnv = loadPlaywrightTestEnv();
applyEnvDefaults(process.env, visualEnv);
export default defineConfig({
testDir: './tests/visual',
fullyParallel: false,
forbidOnly: isCI,
retries: isCI ? 1 : 0,
workers: 1,
reporter: [['html', { outputFolder: 'playwright-visual-report', open: 'never' }], ['list']],
use: {
baseURL: 'http://localhost:3000',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
viewport: { width: 1440, height: 1000 },
deviceScaleFactor: 1,
colorScheme: 'light',
timezoneId: 'UTC',
locale: 'en-US',
},
expect: {
toHaveScreenshot: {
pathTemplate: '{testDir}/{testFilePath}-snapshots/{arg}{ext}',
maxDiffPixelRatio: 0.01,
threshold: 0.2,
animations: 'disabled',
},
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'], viewport: { width: 1440, height: 1000 }, deviceScaleFactor: 1 },
},
],
webServer: {
command: 'npm run build && npm run start',
env: {
...visualEnv,
...process.env,
},
url: 'http://localhost:3000',
reuseExistingServer: !isCI,
timeout: 120 * 1000,
},
});