Repository navigation
Expand file tree
/
Copy pathshotdiff.config.example.jsonc
More file actions
122 lines (100 loc) · 4.5 KB
/
Copy pathshotdiff.config.example.jsonc
File metadata and controls
122 lines (100 loc) · 4.5 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// shotdiff config - copy to shotdiff.config.json and edit.
// Comments and trailing commas are allowed. Full reference: docs/CONFIG.md
{
"version": 1,
// Create a baseline from the first successful capture of a site that has
// none. A baseline is the permanent, lossless reference every future diff is
// measured against; it is never compacted and never pruned. Turn this off
// only if you manage baselines yourself with `shotdiff accept`.
"autoBaseline": true,
// A run's three stages. Baselines are exempt from all of it.
// age < losslessDays lossless PNG, still comparable
// age < days compacted to webp at compactScale - viewable ONLY
// age >= days deleted
// Compaction is ONE-WAY: the PNG is deleted and the image is stored at half
// size, so that run can never be compared again. Raise losslessDays if you
// need to compare runs that old, or set compactScale to 1 to keep full
// resolution. Set losslessDays equal to days to never compact at all.
"retention": {
"days": 7,
"losslessDays": 2,
"compactScale": 0.5,
"compactMaxWidth": null, // optional px cap applied after the scale
},
// On-disk format for RUN captures and diff images. Leave this as png: a
// lossy run cannot be a comparison operand. Baselines are always lossless
// PNG regardless. See "Storage and retention" in the README.
"storage": { "format": "png", "quality": 80 },
// Images inlined into the HTML report. Compressed by default because they
// are only ever looked at. Not resized by default, and the diff image is
// never resized at all - a two-pixel shift is the thing you opened the
// report to see.
"reportEmbed": { "format": "webp", "quality": 80 },
"defaults": {
"viewports": [
{ "name": "desktop", "width": 1440, "height": 900 },
{ "name": "mobile", "width": 390, "height": 844, "deviceScaleFactor": 2, "isMobile": true },
],
// Per-pixel colour tolerance (0-1). Lower is stricter.
"threshold": 0.1,
// The gate. Set this from what `shotdiff doctor` measures, not from taste.
"maxDiffPercent": 0.2,
// Analytics, chat widgets and ad iframes are the biggest source of
// nondeterminism on a live site, and none of them tell you whether a
// plugin update broke the layout. Off by default is a deliberate trade.
"blockThirdParty": true,
// Quiet wait immediately before the screenshot. Raise this first on a
// site that will not settle.
"settleMs": 1200,
},
"sites": [
{
"name": "example-client",
"baseUrl": "https://example.com",
// Site-wide selectors. Pages ADD to these rather than replacing them.
// mask: painted over. For things that repaint in place and that you do
// not care about - chat bubbles, ad slots, "3 minutes ago" labels.
"mask": [".chat-widget", "#ad-slot"],
// hide: display:none. For things that SHIFT everything below them -
// cookie bars, promo strips, notice banners.
"hide": [".cookie-banner"],
// click: pressed once before capture, best effort. Never fails a run.
"click": ["#accept-cookies"],
"maxDiffPercent": 0.5,
// Optional. Run with `shotdiff purge`. Executed through a shell, so
// prefer $VARIABLES over pasted tokens - shotdiff redacts what it can
// recognise, but the config file is executable content either way.
"purge": {
"command": "curl -fsS -X POST https://example.com/wp-json/wp-rocket/v1/purge -H \"Authorization: Bearer $EXAMPLE_PURGE_TOKEN\"",
},
"pages": [
{ "path": "/", "name": "home" },
{ "path": "/services/", "name": "services" },
{ "path": "/about/", "name": "about" },
// Per-page overrides. This page's mask ends up as
// [".chat-widget", "#ad-slot", ".wpcf7-spinner", "#map"].
{
"path": "/contact/",
"name": "contact",
"mask": [".wpcf7-spinner", "#map"],
"maxDiffPercent": 1.0,
},
],
},
{
"name": "second-client",
"baseUrl": "https://second.example",
// Let a specific third party through - an entry matches the host and
// its subdomains. "*" allows everything.
"allowHosts": ["fonts.gstatic.com"],
// A slow site that needs longer to settle, and a named element to wait
// for before the screenshot is taken.
"settleMs": 2500,
"waitFor": [".hero__image"],
"pages": [
"/",
{ "path": "/shop/", "name": "shop", "maxDiffPercent": 1.5 },
],
},
],
}