test: verify CHRNX editorial polish

This commit is contained in:
chrnx committed 2026-08-12 16:10:55 -05:00
1 parent c5720b21ca
commit cb545c316c
2 files changed
+104 -60

No files matched your search

+35
View File
@@ -76,6 +76,41 @@ test( 'the visual layer is separately enqueued and covers responsive accessible
assert.match( components, /html\[data-theme="light"\]/ );
} );
test( 'editorial review capture stays bounded to approved pages, variants, and filenames', () => {
const capture = read( 'scripts/capture-visual-review.mjs' );
for ( const target of [ 'home', 'music', 'post', 'footer' ] ) {
assert.match( capture, new RegExp( `name: '${ target }'` ) );
}
assert.match( capture, /path: '\/'/ );
assert.match( capture, /path: '\/music\/'/ );
assert.match( capture, /path: '\/una-cuerda-rota-tambien-puede-decidir-el-arreglo\/'/ );
assert.match( capture, /selector: 'footer\.wp-block-template-part'/ );
for ( const variant of [ 'desktop-dark', 'desktop-light', 'mobile-dark', 'mobile-light' ] ) {
assert.match( capture, new RegExp( `name: '${ variant }'` ) );
}
assert.match(
capture,
/`editorial-polish-\$\{\s*target\.name\s*\}-\$\{\s*variant\.name\s*\}\.png`/,
);
assert.doesNotMatch( capture, /name: 'topic-|name: 'podcasts'|name: 'about'/ );
} );
test( 'editorial review capture isolates browser compositing between theme variants', () => {
const capture = read( 'scripts/capture-visual-review.mjs' );
assert.ok(
capture.indexOf( 'const browser = await chromium.launch()' ) >
capture.indexOf( 'async function capture' ),
'Chromium must launch inside capture so a dark render cannot corrupt the next light screenshot',
);
assert.match(
capture,
/const browser = await chromium\.launch\(\);[\s\S]*?try \{[\s\S]*?finally \{\s*await browser\.close\(\);\s*\}/,
'Every isolated browser must close even when navigation or capture fails',
);
} );
test( 'the page canvas is atmospheric rather than a repeating grid', () => {
const components = read( 'assets/css/components.css' );