forked from veridatum-labs/earnproof-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.visual.config.ts
More file actions
71 lines (69 loc) · 2.43 KB
/
Copy pathplaywright.visual.config.ts
File metadata and controls
71 lines (69 loc) · 2.43 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";
/**
* Dedicated Playwright configuration for the visual regression suite
* (e2e/visual). This config is intentionally separate from any other
* Playwright suites the project may add (functional e2e, a11y, perf) so the
* visual project can be run, reviewed, and evolved independently.
*
* Viewport rationale (see e2e/visual/README.md for the full write-up):
* - desktop-1440: the approved desktop breakpoint used across EarnProof's
* design references (max page width is 1440px, see pageContainer).
* - tablet-768: intermediate width required by the issue acceptance
* criteria; 768px is the Tailwind `md` breakpoint the app already
* branches layout on (grid-cols-3 -> stacked, nav collapse, etc.).
* - mobile-390: the approved mobile breakpoint (iPhone 12/13/14 class
* device width), the narrowest width the layouts are designed for.
*/
const PORT = 3100;
const BASE_URL = `http://127.0.0.1:${PORT}`;
export default defineConfig({
testDir: "./e2e/visual",
outputDir: "./e2e/visual/.test-results",
snapshotPathTemplate: "{testDir}/{testFilePath}-snapshots/{arg}-{projectName}{ext}",
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: process.env.CI
? [["list"], ["html", { outputFolder: "./e2e/visual/.report", open: "never" }]]
: "list",
timeout: 30_000,
expect: {
// Conservative pixel-diff thresholds. Kept small and explicit rather
// than relying on Playwright defaults so any tightening/loosening is a
// reviewable, intentional change.
toHaveScreenshot: {
maxDiffPixelRatio: 0.01,
animations: "disabled",
},
},
use: {
baseURL: BASE_URL,
locale: "en-US",
timezoneId: "UTC",
colorScheme: "dark",
trace: "retain-on-failure",
screenshot: "off",
video: "off",
},
projects: [
{
name: "desktop-1440",
use: { ...devices["Desktop Chrome"], viewport: { width: 1440, height: 900 } },
},
{
name: "tablet-768",
use: { ...devices["Desktop Chrome"], viewport: { width: 768, height: 1024 } },
},
{
name: "mobile-390",
use: { ...devices["Desktop Chrome"], viewport: { width: 390, height: 844 } },
},
],
webServer: {
command: `npm run start -- --port ${PORT}`,
url: BASE_URL,
reuseExistingServer: !process.env.CI,
timeout: 120_000,
},
});