diff --git a/scripts/qa-navara-bloom.mjs b/scripts/qa-navara-bloom.mjs index 41a7dd1c7..e6818ace1 100644 --- a/scripts/qa-navara-bloom.mjs +++ b/scripts/qa-navara-bloom.mjs @@ -21,6 +21,7 @@ import { diff, freeze, pickStyle, + pinDaytime, saveCapture, stats, visualPageUrl, @@ -58,6 +59,9 @@ await strict.run( const page = await browser.newPage(); const errors = []; page.on('pageerror', (error) => errors.push(error.message)); + // The same sun on every run: the frame's brightness decides what blooms + // and what each style's signature reads. + await pinDaytime(page); await page.evaluateOnNewDocument(() => { localStorage.setItem('gev:first-run-mission:v1', 'suppressed'); }); diff --git a/scripts/qa-navara-visual-styles.mjs b/scripts/qa-navara-visual-styles.mjs index de19400e1..213fd71fd 100644 --- a/scripts/qa-navara-visual-styles.mjs +++ b/scripts/qa-navara-visual-styles.mjs @@ -24,6 +24,7 @@ import { freeze, histogramShift, pickStyle, + pinDaytime, saveCapture, stats, visualPageUrl, @@ -50,6 +51,9 @@ await strict.run( const page = await browser.newPage(); const errors = []; page.on('pageerror', (error) => errors.push(error.message)); + // The same sun on every run: the frame's brightness decides what blooms + // and what each style's signature reads. + await pinDaytime(page); await page.evaluateOnNewDocument(() => { localStorage.setItem('gev:first-run-mission:v1', 'suppressed'); }); diff --git a/scripts/qa/navaraVisual.mjs b/scripts/qa/navaraVisual.mjs index 6da59e8b9..709d15bc5 100644 --- a/scripts/qa/navaraVisual.mjs +++ b/scripts/qa/navaraVisual.mjs @@ -11,6 +11,29 @@ import sharp from 'sharp'; export const STILL_VIEW = 'v=2&lat=30.2672&lon=-97.7431&alt=20000&heading=0&pitch=-70&map=osm&l='; +/** + * Before the app loads: the page's Date runs from `utc` on, so the look's + * sun (and with it the frame's brightness, which the bloom threshold and + * the styles' signatures read) does not follow the time of day the + * scenario happens to run at. Default: Austin early afternoon. + */ +export function pinDaytime(page, utc = '2026-11-03T18:30:00Z') { + return page.evaluateOnNewDocument((utc) => { + const offset = Date.parse(utc) - Date.now(); + const RealDate = Date; + class ShiftedDate extends RealDate { + constructor(...args) { + if (args.length === 0) super(RealDate.now() + offset); + else super(...args); + } + static now() { + return RealDate.now() + offset; + } + } + globalThis.Date = ShiftedDate; + }, utc); +} + /** The keyless page on `engine` with the still view (and `extra` hash). */ export const visualPageUrl = (origin, engine, extra = '', view = STILL_VIEW) => `${origin}/?engine=${engine}&welcome=0&look=cinematic#${view}${extra}`;