Wait for the application, not the clock, in the strict QA set

The probe exposes settled() and the first-frame outcome; scripts/qa/ready.mjs
waits for drawn frames with the camera at rest and for a pick at the click
position, with a deadline and its reason in the error. The strict scenarios
use these instead of fixed pauses and loading-screen polling, and the
hidden-switch scenario checks how the loading screen was lifted instead of
how long it took.

Each switch scenario now records a draw ledger per engine and runs a
contract monitor; both write to the scenario's evidence file only, with an
empty allowlist until browser runs show what differs on purpose.
This commit is contained in:
German Khokhlov committed 2026-11-10 15:46:26 +04:00
1 parent 9c2a2d6951
commit 60f9de8511
47 files changed
+1788 -312

No files matched your search

+13 -6
View File
@@ -1,4 +1,4 @@
// Contract: a parked globe is released after ?parkedMs= (8 s here; three
// Contract: a parked globe is released after ?parkedMs= (one minute here; three
// minutes by default). A switch back in time is warm (the same engine
// object); after the delay the parked engine's WebGL context is lost and a
// switch back builds a new engine on the same session that draws a
@@ -21,9 +21,9 @@ import {
startSession,
} from './qa-strict-session.mjs';
// Room for a cold switch on a busy machine (2-3 s) before the switch back.
const PARKED_MS = 8000;
const base = localPreview(process.argv[2]);
// Leave a margin for both complete switches on a busy GPU.
const PARKED_MS = Number(base.searchParams.get('parkedMs') ?? 60000);
const other = (kind) => (kind === 'navara' ? 'cesium' : 'navara');
const strict = createStrict({ origin: base.origin, layers: [] });
await strict.run({}, async (b) => {
@@ -70,7 +70,6 @@ await strict.run({}, async (b) => {
]),
kind,
);
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
for (const parked of ['navara', 'cesium']) {
const running = other(parked);
@@ -82,7 +81,6 @@ await strict.run({}, async (b) => {
const parkedAt = await pick(running);
await rememberEngine(p);
// A switch back in time is warm.
await wait(1000);
const backAt = await pick(parked);
const early = await engines(parked);
await assertSession(p, parked, `a quick switch back to ${parked}`);
@@ -93,7 +91,16 @@ await strict.run({}, async (b) => {
);
// Parked past the delay: released, and the next switch back is cold.
await pick(running);
await wait(PARKED_MS + 1500);
await p.waitForFunction(
(kind) => {
const canvas = window.__qaEngines.get(kind)?.host.canvas;
return (
canvas?.getContext('webgl2') ?? canvas?.getContext('webgl')
)?.isContextLost();
},
{ polling: 100, timeout: PARKED_MS + 30000 },
parked,
);
const released = await engines(parked);
contract(
`${parked} parked past the delay is released: its context is lost`,