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

+18 -6
View File
@@ -121,21 +121,33 @@ export function waitForFirstFrame(
clearTimer = clearTimeout,
} = {},
) {
if (document?.hidden) return Promise.resolve(false);
const outcome = (path) => {
if (engine.host?.canvas?.dataset)
engine.host.canvas.dataset.firstFrameOutcome = path;
};
if (document?.hidden) {
outcome('hidden');
return Promise.resolve(false);
}
outcome('pending');
return new Promise((resolve) => {
let finished = false;
let timer = null;
let remove = () => {};
const finish = (drawn) => {
const finish = (path) => {
if (finished) return;
finished = true;
outcome(path);
remove();
clearTimer(timer);
document?.removeEventListener?.('visibilitychange', hidden);
resolve(drawn);
resolve(path === 'frame');
};
function hidden() {
if (document.hidden) finish(false);
if (document.hidden) finish('hidden');
}
remove = engine.frames.postRender.addEventListener(() => finish(true));
timer = setTimer(() => finish(false), timeoutMs);
remove = engine.frames.postRender.addEventListener(() => finish('frame'));
timer = setTimer(() => finish('timeout'), timeoutMs);
document?.addEventListener?.('visibilitychange', hidden);
engine.render.request('engine-switch');
});