Move QA scripts to the shared harness, batch 2 of 4

Each script launches and closes Chrome through scripts/qa/browser.mjs,
waits on the application through scripts/qa/ready.mjs instead of the
loading screen and fixed pauses, and reads the contract instead of
Cesium where the check is not about Cesium itself.
This commit is contained in:
German Khokhlov committed 2026-11-10 16:43:58 +04:00
1 parent ee697422c9
commit 373edf2989
26 files changed
+526 -803

No files matched your search

+22 -23
View File
@@ -1,4 +1,7 @@
#!/usr/bin/env node
// Cesium-only probes: native primitive positions provide the Cesium floor oracle.
import { evaluateWithGeo } from './qa/geometry.mjs';
import { whenSettled } from './qa/ready.mjs';
/**
* scripts/qa-floor-hold.mjs — a grounded contact holds its floor through a
* terrain-proxy outage (owner incident, 2026-08-21).
@@ -25,13 +28,13 @@
* under Metal — a backend comparison at one point, not to be confused with the
* same-backend run-to-run spread (122.1 m vs 20.6 m on a cell centre) that
* retired the hold chain's unvalidated tier. The
* default is Metal on macOS and SwiftShader elsewhere; `--angle` overrides it.
* default is Metal; QA_ANGLE overrides it.
* Mesh samples describe the selected backend, not another GPU's rendered LOD.
* An unavailable rendered-mesh oracle remains a failed check, even if the
* separate bare-earth DEM check passes. Software evidence does not establish
* real-GPU visual correctness.
*/
import puppeteer from 'puppeteer';
import { launchBrowser, closeBrowser } from './qa/browser.mjs';
import fs from 'node:fs';
import path from 'node:path';
@@ -39,7 +42,7 @@ const APP_URL = process.env.QA_BASE_URL || 'http://localhost:4173';
const argv = Object.fromEntries(process.argv.slice(2)
.map((a) => a.replace(/^--/, '').split('=')).map(([k, v]) => [k, v ?? true]));
// Metal is a macOS-only ANGLE backend; defaulting to it off-Mac fails WebGL init.
const ANGLE = String(argv.angle || (process.platform === 'darwin' ? 'metal' : 'swiftshader'));
const ANGLE = process.env.QA_ANGLE || 'metal';
const HEADFUL = !!argv.headful;
// Austin airport apron by default — the site qa-floor-verify pins, where the
// mesh sits ~150 m above the geoid and burial is unmistakable.
@@ -58,12 +61,9 @@ function record(name, ok, detail) {
}
fs.mkdirSync(OUT_DIR, { recursive: true });
const chrome = await puppeteer.executablePath().catch(() => undefined);
const browser = await puppeteer.launch({
headless: HEADFUL ? false : 'new',
executablePath: chrome,
args: ['--use-gl=angle', `--use-angle=${ANGLE}`, '--enable-webgl',
'--ignore-gpu-blocklist', '--no-sandbox'],
const browser = await launchBrowser({
headless: true,
args: ['--enable-webgl', '--ignore-gpu-blocklist', '--no-sandbox'],
});
const page = await browser.newPage();
await page.setViewport({ width: 1400, height: 900 });
@@ -109,14 +109,14 @@ console.log(`\nFloor hold through a terrain outage\n App : ${APP_URL}\n GPU
await page.goto(APP_URL, { waitUntil: 'domcontentloaded', timeout: 120000 });
await page.waitForFunction(() => window.__godsEyeView?.layers && window.__godsEyeView?.dataManager,
{ timeout: 150000 });
await sleep(12000); // let the boot fly-to settle before pinning
await whenSettled(page); // let the boot fly-to settle before pinning
await page.evaluate(() => {
document.querySelector('#first-run-launcher:not([hidden]) [data-first-run-choice="explore"]')?.click();
});
await sleep(600); // let the launcher dismissal finish before taking evidence
await whenSettled(page); // let the launcher dismissal finish before taking evidence
await page.evaluate((site) => { window.__SITE = site; }, SITE);
const pin = () => page.evaluate(async () => {
const pin = () => evaluateWithGeo(page, async (qaGeo) => {
const app = window.__godsEyeView;
if (!app.viewer) {
const geo = await import('/src/geo/index.js');
@@ -128,16 +128,15 @@ const pin = () => page.evaluate(async () => {
app.engine.camera.moveEnd.raiseEvent();
return;
}
const v = app.viewer;
const C = v.camera.positionCartographic.constructor;
v.camera.cancelFlight();
v.camera.setView({
destination: v.scene.globe.ellipsoid.cartographicToCartesian(
const C = qaGeo.cartographic;
window.__godsEyeView.engine.camera.cancelFlight();
window.__godsEyeView.engine.camera.setView({
destination: qaGeo.cartographic.toCartesian(
C.fromDegrees(window.__SITE.lon, window.__SITE.lat - 0.008, 900),
),
orientation: { heading: 0, pitch: -0.45, roll: 0 },
});
v.camera.moveEnd.raiseEvent();
window.__godsEyeView.engine.camera.moveEnd.raiseEvent();
});
await pin();
const billboardMode = await page.evaluate(async () => {
@@ -152,7 +151,7 @@ const billboardMode = await page.evaluate(async () => {
record('the billboard floor test is explicitly in 2D aircraft mode', billboardMode);
/** Reads the contact's rendered height and the rendered mesh beneath it. */
const measure = () => page.evaluate(async (icao) => {
const measure = () => evaluateWithGeo(page, async (qaGeo, icao) => {
const app = window.__godsEyeView;
if (!app.viewer) {
const geo = await import('/src/geo/index.js');
@@ -171,7 +170,7 @@ const measure = () => page.evaluate(async (icao) => {
lat: +(carto.latitude * 180 / Math.PI).toFixed(5), lon: +(carto.longitude * 180 / Math.PI).toFixed(5), terrain: { ...window.__TERRAIN } };
}
const v = app.viewer;
const C = v.camera.positionCartographic.constructor;
const C = qaGeo.cartographic;
// The contact as the layer draws it (the probe's drawn rows: the layer owns
// no Cesium billboard of its own any more; the engine's batched billboards
// keep a hidden spare's old id, so an id match there can be stale).
@@ -201,7 +200,7 @@ const measure = () => page.evaluate(async (icao) => {
// harness does, and accept the coarse cell centre as a fallback point.
const pump = () => new Promise((resolve) => {
try { window.__godsEyeView.requestRender?.(); } catch { /* no governor */ }
try { v.scene.requestRender(); } catch { /* explicit-render off */ }
try { window.__godsEyeView.engine.render.request(); } catch { /* explicit-render off */ }
requestAnimationFrame(() => requestAnimationFrame(resolve));
});
let mesh = null;
@@ -210,7 +209,7 @@ const measure = () => page.evaluate(async (icao) => {
for (const [pLat, pLon] of [[lat, lon], [+lat.toFixed(3), +lon.toFixed(3)]]) {
for (const exclude of [[...sprites, ...models], []]) {
try {
const h = v.scene.sampleHeight(C.fromDegrees(pLon, pLat, 0), exclude);
const h = window.__godsEyeView.engine.surface.sampleHeight(C.fromDegrees(pLon, pLat, 0), exclude);
if (Number.isFinite(h)) { mesh = h; break; }
} catch { /* mid-stream */ }
}
@@ -278,7 +277,7 @@ for (let i = 1; i <= 4; i++) {
await sample('B', `poll+${i}`);
}
fs.writeFileSync(path.join(OUT_DIR, `hold-B-outage-${ANGLE}.png`), await page.screenshot({ type: 'png' }));
await browser.close();
await closeBrowser(browser);
console.log('');
const outage = samples.filter((s) => s.phase === 'B');