mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
Cut duplicated and dead code across the engines, the layers and the QA scripts
- src/geo drops the ported debug argument checks and the tests that bitExact already covers; package boundaries accept a directory entry, so src/geo/ is listed once per group. - Cesium no longer carries movers and lines nobody draws with: they are optional engine capabilities. The fake engine and the Cesium camera use the shared cameraMath; unused contract tables, clock.ticked, the 'finest' surface detail and Navara click statistics are gone. - ALPR keeps one overlay core and one presentation model for both engines, bikeshare one station bookkeeping, the Navara ground effects one definition helper; image atlases, view centres, mover banks and colours are shared. - The legacy switch route, the clock offset and rate controls and other unused exports are removed. - The acceptance runs the Navara draw, geo import and scope checks; scenarios use the harness switch and page helpers; the main chunk check keeps the size budget only and runs once in CI.
This commit is contained in:
1 parent
c502404e1d
commit
7abf74518f
272 files changed
+4828
-10213
No files matched your search
+52
-47
@@ -1,19 +1,28 @@
|
||||
// Recent imagery on a keyless preview, starting on Navara: the NASA catalog
|
||||
// and imagery tiles are fixtures, and the image, A/B, swap, divider, opacity,
|
||||
// basemap, toggle, failure, box-drag and zoom-to-fit checks read the rendered
|
||||
// pixels; both pinned dates survive a switch to Cesium and back. The report
|
||||
// and its screenshots go next to the evidence file (or to the temp directory).
|
||||
//
|
||||
// node scripts/qa-w2-imagery.mjs http://127.0.0.1:<PORT>
|
||||
// [--layers=recent-imagery] [--evidence=FILE]
|
||||
import fs from 'node:fs/promises';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import sharp from 'sharp';
|
||||
import { createStrict, localPreview } from './qa-strict-harness.mjs';
|
||||
import {
|
||||
createStrict,
|
||||
localPreview,
|
||||
strictArguments,
|
||||
} from './qa-strict-harness.mjs';
|
||||
import { isExpectedPreviewSetupError, redact } from './qa-browserEvidence.mjs';
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const option = (name, fallback) =>
|
||||
args.includes(name) ? args[args.indexOf(name) + 1] : fallback;
|
||||
const url = option('--url', 'http://127.0.0.1:4193');
|
||||
const output = option('--report', '/private/tmp/gev-imagery.json');
|
||||
if (
|
||||
['4173', '4185', '4186', '4187', '4188', '4189', '4194'].includes(
|
||||
new URL(url).port,
|
||||
)
|
||||
)
|
||||
throw new Error('Reserved QA port');
|
||||
const { origin } = localPreview(process.argv[2]);
|
||||
const url = origin + '/?engine=navara';
|
||||
const { evidence } = strictArguments();
|
||||
const output = evidence
|
||||
? path.join(path.dirname(evidence), 'imagery-report.json')
|
||||
: path.join(os.tmpdir(), 'gev-imagery.json');
|
||||
const report = {
|
||||
url,
|
||||
checks: [],
|
||||
@@ -26,7 +35,7 @@ let failLandsat = false,
|
||||
// The engine the page runs, for the strict assertion manifest.
|
||||
let engine = null;
|
||||
const strict = createStrict({
|
||||
origin: localPreview(url).origin,
|
||||
origin,
|
||||
layers: ['recent-imagery'],
|
||||
// The scenario answers the NASA catalog and imagery tiles itself.
|
||||
fixtures: ['*://*.earthdata.nasa.gov/*'],
|
||||
@@ -48,8 +57,6 @@ const browser = await strict.launch({
|
||||
headless: true,
|
||||
args: [
|
||||
'--no-sandbox',
|
||||
'--use-angle=metal',
|
||||
'--enable-gpu',
|
||||
'--disable-background-timer-throttling',
|
||||
'--disable-renderer-backgrounding',
|
||||
],
|
||||
@@ -63,7 +70,7 @@ try {
|
||||
const text = redact(message.text());
|
||||
const expected =
|
||||
isExpectedPreviewSetupError(message, {
|
||||
preview: args.includes('--preview'),
|
||||
preview: true,
|
||||
baseUrl: url,
|
||||
}) ||
|
||||
(failedTiles > 0 &&
|
||||
@@ -231,37 +238,35 @@ try {
|
||||
await sleep(2500);
|
||||
image = await capture('ab');
|
||||
check('A/B dates on opposite sides', red(image.left) && green(image.right));
|
||||
if (args.includes('--switch')) {
|
||||
const first = await page.evaluate(() => {
|
||||
window.qaImageryOwner = window.__gevRecentImagery.layer;
|
||||
return window.qaImageryOwner.diagnostics().pins;
|
||||
});
|
||||
const reads = () =>
|
||||
report.requests.filter((r) => r.host === 'cmr.earthdata.nasa.gov').length;
|
||||
const expectedReads = reads();
|
||||
const initial = await page.evaluate(() => window.__godsEyeView.engine.kind);
|
||||
for (const kind of [initial === 'navara' ? 'cesium' : 'navara', initial]) {
|
||||
await strict.switchTo(page, kind);
|
||||
engine = kind;
|
||||
const state = await page.evaluate(() => ({
|
||||
same: window.__gevRecentImagery.layer === window.qaImageryOwner,
|
||||
...window.qaImageryOwner.diagnostics(),
|
||||
}));
|
||||
check(
|
||||
kind + ' holds both original pins',
|
||||
state.same &&
|
||||
state.mode === 'ab' &&
|
||||
state.pins.a === first.a &&
|
||||
state.pins.b === first.b,
|
||||
);
|
||||
await sleep(1800);
|
||||
const pixels = await capture('switch-' + kind);
|
||||
check(
|
||||
kind + ' renders both pinned dates',
|
||||
red(pixels.left) && green(pixels.right),
|
||||
);
|
||||
check(kind + ' reuses the STAC search', reads() === expectedReads);
|
||||
}
|
||||
const first = await page.evaluate(() => {
|
||||
window.qaImageryOwner = window.__gevRecentImagery.layer;
|
||||
return window.qaImageryOwner.diagnostics().pins;
|
||||
});
|
||||
const reads = () =>
|
||||
report.requests.filter((r) => r.host === 'cmr.earthdata.nasa.gov').length;
|
||||
const expectedReads = reads();
|
||||
const initial = await page.evaluate(() => window.__godsEyeView.engine.kind);
|
||||
for (const kind of [initial === 'navara' ? 'cesium' : 'navara', initial]) {
|
||||
await strict.switchTo(page, kind);
|
||||
engine = kind;
|
||||
const state = await page.evaluate(() => ({
|
||||
same: window.__gevRecentImagery.layer === window.qaImageryOwner,
|
||||
...window.qaImageryOwner.diagnostics(),
|
||||
}));
|
||||
check(
|
||||
kind + ' holds both original pins',
|
||||
state.same &&
|
||||
state.mode === 'ab' &&
|
||||
state.pins.a === first.a &&
|
||||
state.pins.b === first.b,
|
||||
);
|
||||
await sleep(1800);
|
||||
const pixels = await capture('switch-' + kind);
|
||||
check(
|
||||
kind + ' renders both pinned dates',
|
||||
red(pixels.left) && green(pixels.right),
|
||||
);
|
||||
check(kind + ' reuses the STAC search', reads() === expectedReads);
|
||||
}
|
||||
await page.evaluate(() => window.__gevRecentImagery.layer.swapSides());
|
||||
image = await capture('swap');
|
||||
|
||||
Reference in new issue
Block a user