From 2ee09c5911bf912dc6d560603e1634353c8c79dc Mon Sep 17 00:00:00 2001 From: German Khokhlov Date: Tue, 3 Nov 2026 02:32:19 +0400 Subject: [PATCH] Verify renderer startup rollback keeps the flight cockpit usable --- scripts/qa-layer-handoff.mjs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scripts/qa-layer-handoff.mjs b/scripts/qa-layer-handoff.mjs index e451ae0d5..77df33698 100644 --- a/scripts/qa-layer-handoff.mjs +++ b/scripts/qa-layer-handoff.mjs @@ -103,6 +103,35 @@ try { started: Date.now(), }; }); + // Refuse the first Cesium canvas. The application must roll back with the + // original aircraft still in the cockpit, then allow an ordinary retry. + await page.evaluate(() => { + const original = HTMLCanvasElement.prototype.getContext; + HTMLCanvasElement.prototype.getContext = function (type, ...args) { + if (String(type).includes('webgl')) { + window.__refusedContext = true; + throw new Error('QA renderer startup failure'); + } + return original.call(this, type, ...args); + }; + window.__restoreContext = () => { + HTMLCanvasElement.prototype.getContext = original; + }; + }); + await page.select('#globe-engine', 'cesium'); + await page.waitForFunction(() => window.__refusedContext === true); + await ready('navara'); + assert.ok(await page.evaluate(() => { + window.__restoreContext(); + const {dataManager, styleManager} = window.__godsEyeView; + return new URL(location.href).searchParams.get('engine') === 'navara' && + dataManager === window.__handoff.dataManager && + dataManager.layers.get('flights') === window.__handoff.entry && + styleManager.getCockpitState().active && + styleManager.getAircraftTrackingTarget()?.id === '71be26'; + }), 'a failed scene must leave the live session usable'); + console.log('PASS failed renderer rolled back to the same flight and cockpit'); + for (const kind of ['cesium', 'navara']) { await page.select('#globe-engine', kind); await ready(kind);