mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
style: adopt application modules into scoped formatting
This commit is contained in:
1 parent
4d37760314
commit
8666705e12
17 files changed
+528
-291
No files matched your search
@@ -11,5 +11,21 @@
|
||||
"src/data/infrastructure.test.mjs",
|
||||
"src/data/localGeojsonCore.js",
|
||||
"src/data/localGeojsonLod.js",
|
||||
"docs/CODE-BOUNDARIES.md"
|
||||
"docs/CODE-BOUNDARIES.md",
|
||||
"src/main.js",
|
||||
"docs/APPLICATION.md",
|
||||
"scripts/qa-application.mjs",
|
||||
"src/app/application.js",
|
||||
"src/app/application.test.mjs",
|
||||
"src/app/mapLifecycle.test.mjs",
|
||||
"src/app/startupCamera.test.mjs",
|
||||
"src/app/viewer.js",
|
||||
"src/editions/local/application.js",
|
||||
"src/editions/local/controls.js",
|
||||
"src/editions/local/data.js",
|
||||
"src/editions/local/errors.js",
|
||||
"src/editions/local/scene.js",
|
||||
"src/editions/local/startupChrome.js",
|
||||
"src/editions/local/startupChrome.test.mjs",
|
||||
"src/editions/local/tools.js"
|
||||
]
|
||||
@@ -10,28 +10,16 @@
|
||||
"src/data/localGeojsonCore.js",
|
||||
"src/data/localGeojsonLod.js"
|
||||
],
|
||||
"external": [
|
||||
"cesium"
|
||||
]
|
||||
"external": ["cesium"]
|
||||
},
|
||||
"application": {
|
||||
"exports": [
|
||||
"./application"
|
||||
],
|
||||
"modules": [
|
||||
"src/app/application.js"
|
||||
],
|
||||
"exports": ["./application"],
|
||||
"modules": ["src/app/application.js"],
|
||||
"external": []
|
||||
},
|
||||
"viewer": {
|
||||
"exports": [
|
||||
"./application/viewer"
|
||||
],
|
||||
"modules": [
|
||||
"src/app/viewer.js"
|
||||
],
|
||||
"external": [
|
||||
"cesium"
|
||||
]
|
||||
"exports": ["./application/viewer"],
|
||||
"modules": ["src/app/viewer.js"],
|
||||
"external": ["cesium"]
|
||||
}
|
||||
}
|
||||
@@ -8,22 +8,30 @@ const urlIndex = args.indexOf('--url');
|
||||
const url = urlIndex >= 0 ? args[urlIndex + 1] : 'http://localhost:4173';
|
||||
const browser = await puppeteer.launch({
|
||||
headless: true,
|
||||
executablePath: process.env.PUPPETEER_EXECUTABLE_PATH || await puppeteer.executablePath(),
|
||||
executablePath:
|
||||
process.env.PUPPETEER_EXECUTABLE_PATH || (await puppeteer.executablePath()),
|
||||
args: ['--no-sandbox', '--use-gl=angle', '--use-angle=swiftshader'],
|
||||
});
|
||||
try {
|
||||
const page = await browser.newPage();
|
||||
const errors = [];
|
||||
page.on('console', (message) => {
|
||||
if (message.type() === 'warn' && /^\[Data\].*(?:destroy|disable) error:/.test(message.text())) {
|
||||
if (
|
||||
message.type() === 'warn' &&
|
||||
/^\[Data\].*(?:destroy|disable) error:/.test(message.text())
|
||||
) {
|
||||
console.log(message.text());
|
||||
}
|
||||
});
|
||||
page.on('pageerror', (error) => errors.push(error.stack || error.message));
|
||||
await page.goto(`${url}/?welcome=1`, { waitUntil: 'domcontentloaded' });
|
||||
await page.waitForFunction(() => window.__godsEyeView?.voiceCommands, { timeout: 60_000 });
|
||||
await page.waitForFunction(() => window.__godsEyeView?.voiceCommands, {
|
||||
timeout: 60_000,
|
||||
});
|
||||
const before = await page.evaluate(async () => {
|
||||
const entry = [...document.scripts].find((script) => /\/src\/main\.js(?:\?|$)/.test(script.src));
|
||||
const entry = [...document.scripts].find((script) =>
|
||||
/\/src\/main\.js(?:\?|$)/.test(script.src),
|
||||
);
|
||||
const { application } = await import(entry.src);
|
||||
window.__qaApplication = application;
|
||||
const app = window.__godsEyeView;
|
||||
@@ -32,7 +40,12 @@ try {
|
||||
await app.styleManager.initialRestorePromise;
|
||||
const enabled = await app.dataManager.setEnabled('local-datacenters', true);
|
||||
const annotation = await app.annotations.annotate([
|
||||
{ type: 'pin', longitude: -97.74, latitude: 30.27, label: 'Lifecycle check' },
|
||||
{
|
||||
type: 'pin',
|
||||
longitude: -97.74,
|
||||
latitude: 30.27,
|
||||
label: 'Lifecycle check',
|
||||
},
|
||||
]);
|
||||
return {
|
||||
status: application.getState().status,
|
||||
@@ -49,7 +62,9 @@ try {
|
||||
assert.equal(before.annotationCount, 1);
|
||||
assert.equal(before.viewerAlive, true);
|
||||
assert.equal(before.credits, true);
|
||||
console.log('PASS: startup, data registration, annotations and visible attribution');
|
||||
console.log(
|
||||
'PASS: startup, data registration, annotations and visible attribution',
|
||||
);
|
||||
|
||||
const after = await page.evaluate(async () => {
|
||||
const application = window.__qaApplication;
|
||||
@@ -57,7 +72,8 @@ try {
|
||||
const first = application.destroy();
|
||||
const samePromise = first === application.destroy();
|
||||
await first.catch((error) => {
|
||||
const describe = (failure) => failure.errors?.map(describe).join('; ') || failure.message;
|
||||
const describe = (failure) =>
|
||||
failure.errors?.map(describe).join('; ') || failure.message;
|
||||
throw new Error(describe(error));
|
||||
});
|
||||
document.dispatchEvent(new Event('visibilitychange'));
|
||||
@@ -71,7 +87,10 @@ try {
|
||||
layers: app.dataManager.layers.size,
|
||||
annotations: app.annotations.count(),
|
||||
governor: app.getRenderGovernorDiagnostics(),
|
||||
handlesRemoved: !window.__godsEyeView && !window.__gevVoiceCommands && !window.__gevAnnotations,
|
||||
handlesRemoved:
|
||||
!window.__godsEyeView &&
|
||||
!window.__gevVoiceCommands &&
|
||||
!window.__gevAnnotations,
|
||||
creditsRemoved: !document.querySelector('#cesium-credits'),
|
||||
welcomeHidden: !document.querySelector('#first-run-launcher.visible'),
|
||||
settingsRemoved: !document.querySelector('#key-setup'),
|
||||
@@ -89,7 +108,9 @@ try {
|
||||
assert.equal(after.welcomeHidden, true);
|
||||
assert.equal(after.settingsRemoved, true);
|
||||
assert.deepEqual(errors, []);
|
||||
console.log('PASS: terminal teardown releases runtime owners without late browser errors');
|
||||
console.log(
|
||||
'PASS: terminal teardown releases runtime owners without late browser errors',
|
||||
);
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
Reference in new issue
Block a user