Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
65 lines (64 loc) · 2.12 KB
/
Copy pathplaywright.config.ts
File metadata and controls
65 lines (64 loc) · 2.12 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
import { defineConfig, devices } from '@playwright/test';
import { VISUAL_PLAYWRIGHT_USE } from './e2e/fixtures/visual-environment';
/**
* Behavioral suites stay on the default `chromium` project.
* Visual pilots use `visual-chromium` with deterministic locale/timezone/scale
* and strict screenshot comparison options. Snapshot paths are platform-suffix
* free so the pinned Linux authoring environment owns the golden images (T03).
*/
export default defineConfig({
testDir: './e2e',
timeout: 30_000,
expect: {
timeout: 5_000,
},
fullyParallel: false,
// Stable artifact roots for CI failure uploads (M014/S03 T02).
outputDir: 'test-results',
reporter: [
['list'],
['html', { open: 'never', outputFolder: 'playwright-report' }],
],
// Predictable artifact path: e2e/visual/<file>.ts-snapshots/<name>.png
snapshotPathTemplate: '{testDir}/{testFilePath}-snapshots/{arg}{ext}',
use: {
baseURL: 'http://127.0.0.1:5173',
// Retain trace + failure screenshots for visual diagnosis (no auto-update).
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
},
projects: [
{
name: 'chromium',
testIgnore: ['**/visual/**'],
use: { ...devices['Desktop Chrome'] },
},
{
name: 'visual-chromium',
testMatch: ['**/visual/**/*.visual.spec.ts', '**/visual/**/*-slice-flows.spec.ts'],
use: {
...devices['Desktop Chrome'],
...VISUAL_PLAYWRIGHT_USE,
viewport: { width: 1280, height: 720 },
// CSS scale keeps device pixels deterministic at deviceScaleFactor: 1.
deviceScaleFactor: VISUAL_PLAYWRIGHT_USE.deviceScaleFactor,
},
expect: {
toHaveScreenshot: {
animations: 'disabled',
caret: 'hide',
scale: 'css',
// Strict pilot compare; intentional updates use --update-snapshots only.
maxDiffPixelRatio: 0,
threshold: 0,
},
},
},
],
webServer: {
command: 'npx vite --config webview/vite.config.ts --host 127.0.0.1 --port 5173',
url: 'http://127.0.0.1:5173',
reuseExistingServer: !process.env.CI,
timeout: 120_000,
},
});