mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
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.
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
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');
|
|
});
|