File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { dirname, join } from 'node:path'
1111import { chromium } from 'playwright'
1212
1313import { EMAIL , NOW , pages } from './pages.mjs'
14+ import { STEADY_RASTER } from './raster.mjs'
1415
1516/** VisualCI's production gallery, as frontend/src/components/GalleryImage.tsx names it. */
1617const GALLERY = 'https://app.visualci.com/g/docspring/visualci'
@@ -100,19 +101,9 @@ async function unstick(page) {
100101
101102async function main ( ) {
102103 const opts = args ( )
103- // Software rasterising on one thread, one colour profile and greyscale text: with the GPU and partial raster, small SVG
104- // icons came out a few pixels different from run to run.
105104 const browser = await chromium . launch ( {
106105 ...( process . env . CHROME_PATH ? { executablePath : process . env . CHROME_PATH } : { } ) ,
107- args : [
108- '--disable-gpu' ,
109- '--force-color-profile=srgb' ,
110- '--disable-partial-raster' ,
111- '--disable-skia-runtime-opts' ,
112- '--disable-lcd-text' ,
113- '--font-render-hinting=none' ,
114- '--num-raster-threads=1' ,
115- ] ,
106+ args : STEADY_RASTER ,
116107 } )
117108 const contexts = new Map ( )
118109 const missing = new Set ( )
Original file line number Diff line number Diff line change 1313import { chromium } from 'playwright'
1414import { EMAIL , pages } from './pages.mjs'
1515import { checkLightbox } from './lightbox.mjs'
16+ import { STEADY_RASTER } from './raster.mjs'
1617
1718const arg = ( name , fallback ) => {
1819 const i = process . argv . indexOf ( name )
1920 return i > 0 ? process . argv [ i + 1 ] : fallback
2021}
2122const BASE = arg ( '--base-url' , 'http://127.0.0.1:5151' )
2223
23- const browser = await chromium . launch ( )
24+ const browser = await chromium . launch ( { args : STEADY_RASTER } )
2425try {
2526 await checkLightbox ( browser , BASE )
2627
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { createHash, randomBytes } from 'node:crypto'
66import { mkdir } from 'node:fs/promises'
77import { createServer } from 'node:http'
88import { chromium , request } from 'playwright'
9+ import { STEADY_RASTER } from './raster.mjs'
910
1011const arg = ( name , fallback ) => {
1112 const i = process . argv . indexOf ( `--${ name } ` )
@@ -21,7 +22,7 @@ const MCP = 'https://mcp.visualci.test'
2122const NO_MOTION = '*, *::before, *::after { animation: none !important; transition: none !important; caret-color: transparent !important; }'
2223
2324await mkdir ( out , { recursive : true } )
24- const browser = await chromium . launch ( )
25+ const browser = await chromium . launch ( { args : STEADY_RASTER } )
2526const failures = [ ]
2627
2728/** One journey in a fresh browser (no cookies), its steps' screenshots named `<journey>/<nn>-<step>`. */
Original file line number Diff line number Diff line change 99// image hasn't loaded yet, the way a slow connection does.
1010import { chromium } from 'playwright'
1111import { pathToFileURL } from 'node:url'
12+ import { STEADY_RASTER } from './raster.mjs'
1213
1314// A 1×1 PNG: the check reads which URL each image shows, not its pixels.
1415const PNG = Buffer . from (
@@ -95,7 +96,7 @@ export async function checkLightbox(browser, base) {
9596if ( import . meta. url === pathToFileURL ( process . argv [ 1 ] ) . href ) {
9697 const i = process . argv . indexOf ( '--base-url' )
9798 const base = i > 0 ? process . argv [ i + 1 ] : 'http://127.0.0.1:5151'
98- const browser = await chromium . launch ( )
99+ const browser = await chromium . launch ( { args : STEADY_RASTER } )
99100 try {
100101 await checkLightbox ( browser , base )
101102 } catch ( e ) {
Original file line number Diff line number Diff line change 1+ // Chromium flags for screenshots that come out the same every run: software rasterising on one thread, one colour
2+ // profile and greyscale text. With the GPU and partial raster, small SVG icons and rounded corners' anti-aliased edges
3+ // came out a shade different from run to run (4 Dec 2026: 28 pixels on the site header's button in a journey).
4+ export const STEADY_RASTER = [
5+ '--disable-gpu' ,
6+ '--force-color-profile=srgb' ,
7+ '--disable-partial-raster' ,
8+ '--disable-skia-runtime-opts' ,
9+ '--disable-lcd-text' ,
10+ '--font-render-hinting=none' ,
11+ '--num-raster-threads=1' ,
12+ ]
You can’t perform that action at this time.
0 commit comments