Skip to content

Commit e7afcf4

Browse files
committed
Docs: steady rasterising flags for Chromium screenshots (deterministic guide, Playwright guide); plugin 0.1.54
1 parent ec77d6b commit e7afcf4

8 files changed

Lines changed: 64 additions & 8 deletions

File tree

‎.claude-plugin/marketplace.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"plugins": [
66
{
77
"name": "visualci",
8-
"version": "0.1.53",
8+
"version": "0.1.54",
99
"description": "Visual regression and snapshot review for PDFs, screenshots, JSON, HTML and text: VisualCI's MCP server and its skills for each CI provider and test tool.",
1010
"author": { "name": "DocSpring", "url": "https://visualci.com" },
1111
"homepage": "https://visualci.com/docs/skills/",

‎.claude-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "visualci",
3-
"version": "0.1.53",
3+
"version": "0.1.54",
44
"description": "Visual regression and snapshot review for PDFs, screenshots, JSON, HTML and text: VisualCI's MCP server and its skills for each CI provider and test tool.",
55
"author": { "name": "DocSpring", "url": "https://visualci.com" },
66
"homepage": "https://visualci.com/docs/skills/",

‎.cursor-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "visualci",
33
"displayName": "VisualCI",
4-
"version": "0.1.53",
4+
"version": "0.1.54",
55
"description": "Visual regression and snapshot review for PDFs, screenshots, JSON, HTML and text: VisualCI's MCP server and its skills for each CI provider and test tool.",
66
"author": {
77
"name": "DocSpring"

‎frontend/content/docs/screenshots/deterministic.md‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ as a change somebody has to look at. Fix these in the tests, once, rather than a
2424
| Lazy-loaded images | Wait for every image to finish loading |
2525
| Viewport, scrollbars, pixel ratio | Fix the viewport size, hide scrollbars, use a device pixel ratio of 1 |
2626
| Text cursor, hover, focus | Hide the caret, and move the mouse away |
27+
| Anti-aliased edges and icons a shade off | Launch Chromium with software raster on one thread ([flags](#steady-rasterising)) |
2728
| Scroll position | Scroll once the page has stopped changing, never while it still lays out |
2829

29-
What's left after this (anti-aliasing that differs slightly between runs) is what a
30+
What's left after this (anti-aliasing that still differs slightly between runs, as between two machines) is what a
3031
[threshold](/docs/screenshots/#thresholds) is for. A threshold can't fix a clock or an animation: those change far
3132
more pixels than anti-aliasing does.
3233

@@ -123,6 +124,33 @@ purpose: a screenshot from a Retina laptop is twice the size of one from CI). Hi
123124
operating systems and appear only when content overflows. Hide the text cursor, and move the mouse away from
124125
anything with a hover state.
125126

127+
### Steady rasterising
128+
129+
Chromium rasterises on the GPU, in tiles and on several threads, so the anti-aliased edges of rounded corners, borders
130+
and small SVG icons can come out a shade different from one run to the next on the same machine: a handful of pixels,
131+
one colour step off, with nothing else changed. Launch it with software rasterising on one thread, one colour profile
132+
and greyscale text, and those edges come out the same every run:
133+
134+
```ts
135+
// playwright.config.ts
136+
use: {
137+
launchOptions: {
138+
args: [
139+
'--disable-gpu',
140+
'--force-color-profile=srgb',
141+
'--disable-partial-raster',
142+
'--disable-skia-runtime-opts',
143+
'--disable-lcd-text',
144+
'--font-render-hinting=none',
145+
'--num-raster-threads=1',
146+
],
147+
},
148+
},
149+
```
150+
151+
The same flags work with `chromium.launch({ args })` and Puppeteer's `launch({ args })`. Switching them on changes
152+
every screenshot slightly once (greyscale text instead of subpixel text), so approve that build as the new baseline.
153+
126154
### Scroll position
127155

128156
A test that scrolls an element into view before the screenshot gets a different scroll position on each run when the

‎frontend/content/docs/screenshots/playwright.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ visualci upload --platform webkit-linux --threshold 0.1 screenshots/webkit
2626
visualci build finalize
2727
```
2828

29-
Use this instead of `toHaveScreenshot`: the baselines live on VisualCI, a change waits for review instead of failing the test, and no PNGs are committed. Hide content that changes on every run (times, avatars) with Playwright's `mask` option, or wait for animations to finish, before the screenshot. [Deterministic screenshots](/docs/screenshots/deterministic/#playwright) has a fixture that pins the clock, randomness and network.
29+
Use this instead of `toHaveScreenshot`: the baselines live on VisualCI, a change waits for review instead of failing the test, and no PNGs are committed. Hide content that changes on every run (times, avatars) with Playwright's `mask` option, or wait for animations to finish, before the screenshot. [Deterministic screenshots](/docs/screenshots/deterministic/#playwright) has a fixture that pins the clock, randomness and network. Launch Chromium with the [steady rasterising flags](/docs/screenshots/deterministic/#steady-rasterising) too, or rounded corners and icons can differ by a shade between runs.
3030

3131
Run the tests in CI's browsers, not on a laptop: see [Platforms](/docs/screenshots/#platforms) and [Local runs](/docs/local-runs/).

‎gemini-extension.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "visualci",
3-
"version": "0.1.53",
3+
"version": "0.1.54",
44
"description": "Visual regression and snapshot review for PDFs, screenshots, JSON, HTML and text: VisualCI's MCP server and its skills for each CI provider and test tool.",
55
"mcpServers": {
66
"visualci": {

‎skills/visualci-deterministic/SKILL.md‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ as a change somebody has to look at. Fix these in the tests, once, rather than a
2929
| Lazy-loaded images | Wait for every image to finish loading |
3030
| Viewport, scrollbars, pixel ratio | Fix the viewport size, hide scrollbars, use a device pixel ratio of 1 |
3131
| Text cursor, hover, focus | Hide the caret, and move the mouse away |
32+
| Anti-aliased edges and icons a shade off | Launch Chromium with software raster on one thread ([flags](#steady-rasterising)) |
3233
| Scroll position | Scroll once the page has stopped changing, never while it still lays out |
3334

34-
What's left after this (anti-aliasing that differs slightly between runs) is what a
35+
What's left after this (anti-aliasing that still differs slightly between runs, as between two machines) is what a
3536
[threshold](https://visualci.com/docs/screenshots.md#thresholds) is for. A threshold can't fix a clock or an animation: those change far
3637
more pixels than anti-aliasing does.
3738

@@ -128,6 +129,33 @@ purpose: a screenshot from a Retina laptop is twice the size of one from CI). Hi
128129
operating systems and appear only when content overflows. Hide the text cursor, and move the mouse away from
129130
anything with a hover state.
130131

132+
### Steady rasterising
133+
134+
Chromium rasterises on the GPU, in tiles and on several threads, so the anti-aliased edges of rounded corners, borders
135+
and small SVG icons can come out a shade different from one run to the next on the same machine: a handful of pixels,
136+
one colour step off, with nothing else changed. Launch it with software rasterising on one thread, one colour profile
137+
and greyscale text, and those edges come out the same every run:
138+
139+
```ts
140+
// playwright.config.ts
141+
use: {
142+
launchOptions: {
143+
args: [
144+
'--disable-gpu',
145+
'--force-color-profile=srgb',
146+
'--disable-partial-raster',
147+
'--disable-skia-runtime-opts',
148+
'--disable-lcd-text',
149+
'--font-render-hinting=none',
150+
'--num-raster-threads=1',
151+
],
152+
},
153+
},
154+
```
155+
156+
The same flags work with `chromium.launch({ args })` and Puppeteer's `launch({ args })`. Switching them on changes
157+
every screenshot slightly once (greyscale text instead of subpixel text), so approve that build as the new baseline.
158+
131159
### Scroll position
132160

133161
A test that scrolls an element into view before the screenshot gets a different scroll position on each run when the

‎skills/visualci-playwright/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ visualci upload --platform webkit-linux --threshold 0.1 screenshots/webkit
3131
visualci build finalize
3232
```
3333

34-
Use this instead of `toHaveScreenshot`: the baselines live on VisualCI, a change waits for review instead of failing the test, and no PNGs are committed. Hide content that changes on every run (times, avatars) with Playwright's `mask` option, or wait for animations to finish, before the screenshot. [Deterministic screenshots](https://visualci.com/docs/screenshots/deterministic.md#playwright) has a fixture that pins the clock, randomness and network.
34+
Use this instead of `toHaveScreenshot`: the baselines live on VisualCI, a change waits for review instead of failing the test, and no PNGs are committed. Hide content that changes on every run (times, avatars) with Playwright's `mask` option, or wait for animations to finish, before the screenshot. [Deterministic screenshots](https://visualci.com/docs/screenshots/deterministic.md#playwright) has a fixture that pins the clock, randomness and network. Launch Chromium with the [steady rasterising flags](https://visualci.com/docs/screenshots/deterministic.md#steady-rasterising) too, or rounded corners and icons can differ by a shade between runs.
3535

3636
Run the tests in CI's browsers, not on a laptop: see [Platforms](https://visualci.com/docs/screenshots.md#platforms) and [Local runs](https://visualci.com/docs/local-runs.md).
3737

0 commit comments

Comments
 (0)