test: capture CHRNX grunge stage review
This commit is contained in:
3 files changed
+216
-76
No files matched your search
@@ -92,27 +92,26 @@ 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', () => {
|
||||
test( 'grunge stage capture stays bounded to approved routes, widths, themes, and filenames', () => {
|
||||
const capture = read( 'scripts/capture-visual-review.mjs' );
|
||||
|
||||
for ( const target of [ 'home', 'music', 'post', 'footer' ] ) {
|
||||
for ( const target of [ 'music', 'podcasts', 'podcasts-long-copy' ] ) {
|
||||
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.equal( capture.match( /path: '\/podcasts\/'/g )?.length, 2 );
|
||||
for ( const width of [ 375, 768, 1440, 2560 ] ) {
|
||||
assert.match( capture, new RegExp( `width: ${ width }` ) );
|
||||
}
|
||||
assert.match( capture, /const THEMES = \[ 'light', 'dark' \]/ );
|
||||
assert.match(
|
||||
capture,
|
||||
/`editorial-polish-\$\{\s*target\.name\s*\}-\$\{\s*variant\.name\s*\}\.png`/,
|
||||
/`grunge-stage-\$\{\s*target\.name\s*\}-\$\{\s*viewport\.width\s*\}-\$\{\s*theme\s*\}\.png`/,
|
||||
);
|
||||
assert.doesNotMatch( capture, /name: 'topic-|name: 'podcasts'|name: 'about'/ );
|
||||
assert.doesNotMatch( capture, /name: 'home'|name: 'post'|name: 'footer'|editorial-polish/ );
|
||||
} );
|
||||
|
||||
test( 'editorial review capture isolates browser compositing between theme variants', () => {
|
||||
test( 'grunge stage capture isolates every image and waits for stable rendered assets', () => {
|
||||
const capture = read( 'scripts/capture-visual-review.mjs' );
|
||||
|
||||
assert.ok(
|
||||
@@ -122,9 +121,35 @@ test( 'editorial review capture isolates browser compositing between theme varia
|
||||
);
|
||||
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',
|
||||
/const browser = await chromium\.launch\(\);[\s\S]*?try \{[\s\S]*?finally \{\s*try \{\s*await context\?\.close\(\);\s*\} finally \{\s*await browser\.close\(\);\s*\}\s*\}/,
|
||||
'Every isolated browser must close even when navigation, capture, or context cleanup fails',
|
||||
);
|
||||
assert.match( capture, /await document\.fonts\.ready/ );
|
||||
assert.match( capture, /image\.complete/ );
|
||||
assert.match( capture, /image\.naturalWidth/ );
|
||||
assert.match( capture, /image\.decode\(\)/ );
|
||||
assert.match( capture, /reducedMotion: 'reduce'/ );
|
||||
assert.match( capture, /page\.setDefaultTimeout\( 5_000 \)/ );
|
||||
assert.match( capture, /page\.setDefaultNavigationTimeout\( 15_000 \)/ );
|
||||
assert.match( capture, /LOCAL_HOSTS/ );
|
||||
assert.match( capture, /route\.abort\( 'blockedbyclient' \)/ );
|
||||
assert.equal( capture.match( /const browser = await chromium\.launch\(\)/g )?.length, 1 );
|
||||
assert.match(
|
||||
capture,
|
||||
/for \( const target[\s\S]*for \( const viewport[\s\S]*for \( const theme[\s\S]*await capture\( baseURL, target, viewport, theme \)/,
|
||||
);
|
||||
} );
|
||||
|
||||
test( 'long-copy review mutates only the rendered latest podcast title and excerpt', () => {
|
||||
const capture = read( 'scripts/capture-visual-review.mjs' );
|
||||
const titleSelector = '.chrnx-latest-podcast .chrnx-podcast-card__title';
|
||||
const excerptSelector = '.chrnx-latest-podcast .chrnx-podcast-card__excerpt';
|
||||
|
||||
assert.ok( capture.includes( `titleSelector: '${ titleSelector }'` ) );
|
||||
assert.ok( capture.includes( `excerptSelector: '${ excerptSelector }'` ) );
|
||||
assert.match( capture, /target\.longCopy[\s\S]*locator\( target\.longCopy\.titleSelector \)[\s\S]*locator\( target\.longCopy\.excerptSelector \)/ );
|
||||
assert.match( capture, /element\.textContent = value/ );
|
||||
assert.doesNotMatch( capture, /wp-json|fetch\(|XMLHttpRequest|wp eval|seed-test-content/ );
|
||||
} );
|
||||
|
||||
test( 'the page canvas is atmospheric rather than a repeating grid', () => {
|
||||
|
||||
Reference in new issue
Block a user