-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
71 lines (70 loc) · 2.48 KB
/
playwright.config.ts
File metadata and controls
71 lines (70 loc) · 2.48 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
66
67
68
69
70
71
import { defineConfig, devices } from '@playwright/test'
/**
* Playwright config for visual regression of the Vue v2.3.4 demo
* (`src/App.vue` + `src/lib/*`).
*
* Scope: capture a small set of high-signal screenshots from the
* running Vue demo so future refactors (especially the alpha.9 Vue
* migration `src/lib/` → `packages/vue/`) can be gated on
* pixel-perfect parity. We don't snapshot every viewport — three
* scenarios are enough to catch the regressions that would matter.
*
* Storage:
* - Baselines live at `tests/visual/__screenshots__/<test>-chromium-…png`
* - First run writes them; subsequent runs diff against them.
* - Commit the baselines so CI can verify them.
*/
export default defineConfig({
testDir: './tests/visual',
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
reporter: 'list',
use: {
baseURL: 'http://localhost:5174',
// The Vue demo runs ambient EQ + idle animations. Bump the
// action timeout so Playwright's stability heuristic has time
// to converge on a frame; `animations: 'disabled'` in the
// expect config below already snaps to the first frame, but
// the stability check still needs slack.
actionTimeout: 15000,
trace: 'retain-on-failure',
},
timeout: 60_000,
webServer: {
command: 'npm run dev',
url: 'http://localhost:5174',
reuseExistingServer: !process.env.CI,
timeout: 60_000,
stdout: 'ignore',
stderr: 'pipe',
},
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
launchOptions: {
// Headless Chromium on CI runners rejects
// HTMLMediaElement.play() under the autoplay policy even
// after a force-click (synthetic gestures don't always count
// as "user activation" there). The pages-live "play actually
// plays" smoke needs play() to be allowed so the assertion
// tests OUR pipeline (file present + decodable + store state
// holds), not Chrome's gesture heuristics. Harmless for the
// visual / a11y / responsive suites — none of them autoplay.
args: ['--autoplay-policy=no-user-gesture-required'],
},
},
},
],
expect: {
toHaveScreenshot: {
// Allow tiny anti-aliasing differences across Chromium versions.
maxDiffPixelRatio: 0.005,
// Threshold for individual pixel comparison (0..1).
threshold: 0.15,
animations: 'disabled',
},
},
})