mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Give QA scripts one launch, readiness and geometry helper
scripts/qa/browser.mjs launches headless Chrome with QA_ANGLE and the shared Chrome lookup; scripts/qa/ready.mjs adds frame, tile and transition readiness and bounded polling; scripts/qa/geometry.mjs hands page evaluations the engine-neutral geometry without dev-only source URLs. CODE-BOUNDARIES gains the rule for new QA scripts.
This commit is contained in:
1 parent
37263a3e2b
commit
731eadc34a
7 files changed
+305
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { build } from 'vite';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
let bundle;
|
||||
|
||||
/** Supply geometry to page callbacks without requiring a dev server's /src routes. */
|
||||
export async function evaluateWithGeo(page, callback, ...args) {
|
||||
const evaluate = new Function(
|
||||
'...args',
|
||||
`${await geometryBundle()}\nreturn (${callback})(qaGeo, ...args);`,
|
||||
);
|
||||
return page.evaluate(evaluate, ...args);
|
||||
}
|
||||
|
||||
/** A self-contained predicate for page-side polling as well as evaluation. */
|
||||
export async function withGeo(callback, ...args) {
|
||||
return `(() => { ${await geometryBundle()}\nreturn (${callback})(qaGeo, ...${JSON.stringify(args)}); })()`;
|
||||
}
|
||||
|
||||
function geometryBundle() {
|
||||
bundle ??= build({
|
||||
configFile: false,
|
||||
envFile: false,
|
||||
logLevel: 'silent',
|
||||
build: {
|
||||
write: false,
|
||||
minify: false,
|
||||
lib: {
|
||||
entry: fileURLToPath(
|
||||
new URL('../../src/geo/index.js', import.meta.url),
|
||||
),
|
||||
name: 'qaGeo',
|
||||
formats: ['iife'],
|
||||
},
|
||||
},
|
||||
}).then((result) => result[0].output[0].code);
|
||||
return bundle;
|
||||
}
|
||||
Reference in new issue
Block a user