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:
German Khokhlov committed 2026-11-10 16:43:58 +04:00
1 parent 37263a3e2b
commit 731eadc34a
7 files changed
+305

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import puppeteer from 'puppeteer';
import { launchBrowser } from './browser.mjs';
test('scenario launch uses the selected ANGLE backend and stays headless', async (t) => {
const prior = process.env.QA_ANGLE;
t.after(() => {
if (prior === undefined) delete process.env.QA_ANGLE;
else process.env.QA_ANGLE = prior;
});
process.env.QA_ANGLE = 'swiftshader';
const browser = {};
let options;
t.mock.method(puppeteer, 'launch', async (value) => {
options = value;
return browser;
});
assert.equal(
await launchBrowser({
headless: false,
args: ['--no-sandbox'],
defaultViewport: { width: 800, height: 600 },
protocolTimeout: 120000,
}),
browser,
);
assert.equal(options.headless, true);
assert.deepEqual(options.args, [
'--use-angle=swiftshader',
'--enable-gpu',
'--no-sandbox',
]);
assert.deepEqual(options.defaultViewport, { width: 800, height: 600 });
assert.equal(options.protocolTimeout, 120000);
delete process.env.QA_ANGLE;
await launchBrowser();
assert.equal(options.args[0], '--use-angle=metal');
});