mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 02:02:21 +00:00
Layer display tests no longer re-check Cesium primitives in every layer: they run on the fake engine, and one Cesium translation check per ground kind lives in the Cesium engine's ground tests. Their harnesses are shared, and the fake-engine, Cesium-engine and flights tests that repeated the contract suite are gone, 340 tests in all. The press-travel measurement is shared by the selection dispatcher and CCTV, which loses its ScreenSpaceEventHandler shim and world-click module. ALPR, installations and bikeshare share one selection keeper and selected marker write. Layers with their own click rules keep their handlers. Navara's pulse is a class like the ground pass, the ground and imagery passes share the surface uniforms, and the colour, log-depth and occlusion GLSL lives in one chunk module, each caller keeping its depth bias. The ground suite runs inside the contract suite (--only=ground:), and fixture and script names say what they test. Behaviour is unchanged on both engines.
61 lines
2.3 KiB
JavaScript
61 lines
2.3 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { EventEmitter } from 'node:events';
|
|
import { watchBrowserPage } from '../../scripts/qa-browserEvidence.mjs';
|
|
const baseUrl = 'http://127.0.0.1:4195/';
|
|
const message = (type, text, url) => ({
|
|
type: () => type,
|
|
text: () => text,
|
|
location: () => ({ url }),
|
|
});
|
|
test('Browser main and share pages aggregate console, runtime and crash errors', () => {
|
|
const report = {},
|
|
main = new EventEmitter(),
|
|
shared = new EventEmitter();
|
|
watchBrowserPage(main, report, { name: 'main', baseUrl });
|
|
watchBrowserPage(shared, report, { name: 'share', baseUrl });
|
|
main.emit('console', message('warning', 'ordinary warning', baseUrl));
|
|
shared.emit(
|
|
'console',
|
|
message('error', 'late error', baseUrl + 'api/x?key=sample-secret'),
|
|
);
|
|
shared.emit('pageerror', new Error('runtime failure'));
|
|
shared.emit('error', new Error('renderer crashed'));
|
|
assert.deepEqual(report.runtimePages, ['main', 'share']);
|
|
assert.equal(report.browserErrors.length, 3);
|
|
assert.match(report.browserErrors[0], /\[share\] late error/);
|
|
assert.ok(!JSON.stringify(report).includes('sample-secret'));
|
|
});
|
|
test('Browser preview exception stays exact on a share page', () => {
|
|
const report = {},
|
|
shared = new EventEmitter();
|
|
watchBrowserPage(shared, report, { name: 'share', baseUrl, preview: true });
|
|
const failure = (url) =>
|
|
shared.emit(
|
|
'console',
|
|
message(
|
|
'error',
|
|
'Failed to load resource: the server responded with a status of 404',
|
|
url,
|
|
),
|
|
);
|
|
failure(baseUrl + 'api/setup/status');
|
|
failure(baseUrl + 'api/other');
|
|
failure('https://example.invalid/api/setup/status');
|
|
assert.deepEqual(report.expectedPreviewErrors, ['/api/setup/status: 404']);
|
|
assert.equal(report.browserErrors.length, 2);
|
|
});
|
|
test('Browser response diagnostics retain page/status/path without query credentials', () => {
|
|
const report = {},
|
|
shared = new EventEmitter();
|
|
watchBrowserPage(shared, report, { name: 'share', baseUrl });
|
|
shared.emit('response', {
|
|
status: () => 503,
|
|
url: () => baseUrl + 'api/vessels?token=sample-secret',
|
|
});
|
|
assert.deepEqual(report.failedResponses, [
|
|
{ page: 'share', status: 503, resource: baseUrl + 'api/vessels' },
|
|
]);
|
|
assert.ok(!JSON.stringify(report).includes('sample-secret'));
|
|
});
|