Merge remote-tracking branch 'upstream/main' into pr1374-fix

This commit is contained in:
Said Turksever committed 2026-10-28 14:28:38 +00:00
commit b731adea49
265 files changed
+20172 -934

No files matched your search

+29 -1
View File
@@ -872,6 +872,18 @@
"src/layers/gnss/source.test.mjs",
"src/layers/gnss/ownership.test.mjs",
"scripts/qa-gnss.mjs",
"server/providers/ghostMaps.js",
"server/providers/ghostMaps.test.mjs",
"src/app/layers/ghostMaps.js",
"src/layers/ghostMaps/index.js",
"src/layers/ghostMaps/catalog.js",
"src/layers/ghostMaps/kml.js",
"src/layers/ghostMaps/records.js",
"src/layers/ghostMaps/source.js",
"src/layers/ghostMaps/catalog.test.mjs",
"src/layers/ghostMaps/records.test.mjs",
"src/layers/ghostMaps/lifecycle.test.mjs",
"scripts/qa-ghostmaps.mjs",
"src/layers/cyclones/index.js",
"src/layers/cyclones/rendering.js",
"src/layers/cyclones/labels.js",
@@ -1089,5 +1101,21 @@
"src/dockerTrustedPeers.test.mjs",
"src/cameraGlobeRotation.test.mjs",
"src/voice/globeResetConfirmation.test.mjs",
"src/hudDms.test.mjs"
"src/hudDms.test.mjs",
"src/voice/panel/preferences.test.mjs",
"src/voice/panel/host.test.mjs",
"src/voice/panel/manualPanel.test.mjs",
"src/voice/panel/nativeActivity.test.mjs",
"src/voice/panel/inactivity.test.mjs",
"src/voice/panel/actionObserver.test.mjs",
"src/voice/panel/testDom.mjs",
"src/voice/realtimeCostPanel.test.mjs",
"docs/SHARE-LINK-FORMAT.md",
"src/share/wire.test.mjs",
"src/share/viewCodec.test.mjs",
"src/share/legacyShareState.test.mjs",
"src/testSupport/shareViewFixtures.mjs",
"src/ui/shareLinks.test.mjs",
"src/ui/shareButton.test.mjs",
"src/share/shareLinkPath.test.mjs"
]
+165 -26
View File
@@ -441,7 +441,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": []
},
@@ -463,11 +464,7 @@
"src/styles/anime.js",
"src/styles/noir.js",
"src/styles/snow.js",
"src/i18n/index.js",
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/marker.js"
],
"external": ["cesium"]
},
@@ -484,7 +481,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": []
},
@@ -514,6 +512,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/unitLabels.js",
"src/ui/keyGuidance.js",
"src/ui/statusText.js",
@@ -534,7 +533,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": []
},
@@ -550,7 +550,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": []
},
@@ -570,6 +571,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/unitLabels.js",
"src/ui/statusBadge.js"
],
@@ -596,6 +598,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/layerNames.js"
],
"external": []
@@ -630,6 +633,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/unitLabels.js"
],
"external": ["cesium"]
@@ -646,6 +650,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/unitLabels.js"
],
"external": []
@@ -770,6 +775,9 @@
"src/ui/scenePresentation.js",
"src/ui/actionButton.js",
"src/ui/scenes.js",
"src/ui/shareFollow.js",
"src/share/follow.js",
"src/data/trackedCamera.js",
"src/ui/shareRestoration.js",
"src/ui/shellElements.js",
"src/ui/shellFeedback.js",
@@ -801,6 +809,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/unitLabels.js",
"src/ui/keyGuidance.js",
"src/ui/layerNames.js",
@@ -922,6 +931,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/unitLabels.js"
],
"external": ["cesium"]
@@ -989,6 +999,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/unitLabels.js"
],
"external": ["cesium"]
@@ -1036,7 +1047,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["cesium"]
},
@@ -1098,7 +1110,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["cesium"]
},
@@ -1128,6 +1141,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/unitLabels.js",
"src/layers/recentImagery/display.js"
],
@@ -1157,7 +1171,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["cesium"]
},
@@ -1188,6 +1203,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/unitLabels.js"
],
"external": ["cesium", "satellite.js"]
@@ -1220,7 +1236,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["cesium"]
},
@@ -1263,6 +1280,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/layers/installations/classLabel.js"
],
"external": ["cesium", "@mapbox/vector-tile", "pbf"]
@@ -1299,6 +1317,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/unitLabels.js"
],
"external": ["cesium"]
@@ -1348,7 +1367,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["cesium", "pbf", "@mapbox/vector-tile"]
},
@@ -1377,7 +1397,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["cesium"]
},
@@ -1425,7 +1446,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["hls.js", "cesium"]
},
@@ -1489,6 +1511,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/layers/streetLevel/providers/mapillary/policy.js"
],
"external": ["cesium", "pbf", "@mapbox/vector-tile", "mapillary-js"]
@@ -1517,7 +1540,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["cesium", "@mapbox/vector-tile", "pbf"]
},
@@ -1557,7 +1581,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["cesium"]
},
@@ -1579,7 +1604,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["cesium"]
},
@@ -1635,7 +1661,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["cesium"]
},
@@ -1656,6 +1683,12 @@
"src/voice/layerSummary.js",
"src/voice/voiceCost.js",
"src/voice/commands.js",
"src/voice/panel/actionObserver.js",
"src/voice/panel/host.js",
"src/voice/panel/inactivity.js",
"src/voice/panel/manualPanel.js",
"src/voice/panel/nativeActivity.js",
"src/voice/panel/preferences.js",
"src/voice/session.js",
"src/voice/sessionCommands.js",
"src/voice/realtimeSession.js",
@@ -1692,6 +1725,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/statusText.js",
"src/voice/providerCommands.js",
"src/voice/providerCapabilities.js",
@@ -2189,6 +2223,11 @@
"src/services/meshFloorSampler.js",
"src/services/requests.js",
"src/services/terrainHeights.js",
"src/share/follow.js",
"src/share/legacyShareState.js",
"src/share/shareLinkPath.js",
"src/share/viewCodec.js",
"src/share/wire.js",
"src/sharelink.js",
"src/sources/live/aircraft.js",
"src/sources/live/contract.js",
@@ -2281,6 +2320,7 @@
"src/ui/scenePresentation.js",
"src/ui/actionButton.js",
"src/ui/scenes.js",
"src/ui/shareFollow.js",
"src/ui/shareRestoration.js",
"src/ui/shellElements.js",
"src/ui/shellFeedback.js",
@@ -2293,6 +2333,12 @@
"src/ui/visualPresets.js",
"src/ui/visualSettings.js",
"src/voice/commands.js",
"src/voice/panel/actionObserver.js",
"src/voice/panel/host.js",
"src/voice/panel/inactivity.js",
"src/voice/panel/manualPanel.js",
"src/voice/panel/nativeActivity.js",
"src/voice/panel/preferences.js",
"src/voice/control.js",
"src/voice/gevActions.js",
"src/agent/worldPacket.js",
@@ -2357,6 +2403,12 @@
"src/layers/gnss/index.js",
"src/layers/gnss/source.js",
"src/layers/gnss/records.js",
"src/app/layers/ghostMaps.js",
"src/layers/ghostMaps/index.js",
"src/layers/ghostMaps/catalog.js",
"src/layers/ghostMaps/records.js",
"src/layers/ghostMaps/kml.js",
"src/layers/ghostMaps/source.js",
"src/layers/cctv/sourcePolicy.js",
"src/sources/reference.js",
"src/search/nominatim.js",
@@ -2556,6 +2608,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/unitLabels.js",
"src/layers/recentImagery/display.js",
"src/ui/keyGuidance.js",
@@ -2992,6 +3045,12 @@
"src/layers/gnss/index.js",
"src/layers/gnss/source.js",
"src/layers/gnss/records.js",
"src/app/layers/ghostMaps.js",
"src/layers/ghostMaps/index.js",
"src/layers/ghostMaps/catalog.js",
"src/layers/ghostMaps/records.js",
"src/layers/ghostMaps/kml.js",
"src/layers/ghostMaps/source.js",
"src/layers/cctv/sourcePolicy.js",
"src/search/nominatim.js",
"src/nominatimGeocode.js",
@@ -3134,6 +3193,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/unitLabels.js",
"src/layers/recentImagery/display.js",
"src/layers/installations/classLabel.js",
@@ -3144,7 +3204,10 @@
"src/layers/airQuality/source.js",
"src/ui/statusText.js",
"src/ui/layerNames.js",
"src/layers/streetLevel/providers/mapillary/policy.js"
"src/layers/streetLevel/providers/mapillary/policy.js",
"src/data/geoImportImages.js",
"src/data/geoImportPins.js",
"src/data/geoFileImport.js"
],
"external": [
"hls.js",
@@ -3241,6 +3304,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/i18n/index.js"
],
"external": ["cesium"]
@@ -3256,13 +3320,15 @@
"src/data/layerStateTokenReservations.json",
"src/loadingFeedback.js",
"src/navigationPolicy.js",
"src/share/follow.js",
"src/ui/shareRestoration.js",
"src/ui/uiLifetime.js",
"src/i18n/index.js",
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": []
},
@@ -3293,11 +3359,13 @@
"src/ui/visualPresets.js",
"src/ui/visualSettings.js",
"src/ui/segmentedControl.js",
"src/i18n/marker.js",
"src/i18n/index.js",
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/scopeMaskPolicy.js",
"src/ui/displayControls.js"
],
@@ -3323,7 +3391,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": []
},
@@ -3415,6 +3484,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/unitLabels.js"
],
"external": ["cesium"]
@@ -3470,6 +3540,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/statusText.js",
"src/voice/providerCapabilities.js"
],
@@ -3723,7 +3794,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["cesium", "egm96-universal", "pbf"]
},
@@ -3766,7 +3838,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["cesium", "pbf"]
},
@@ -3819,7 +3892,8 @@
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json"
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json"
],
"external": ["cesium"]
},
@@ -3836,6 +3910,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/statusText.js",
"src/ui/layerNames.js"
],
@@ -3850,6 +3925,69 @@
],
"external": []
},
"share-view-codec": {
"exports": ["./share/view-codec"],
"modules": [
"src/share/viewCodec.js",
"src/share/follow.js",
"src/share/wire.js",
"src/ui/visualPresets.js",
"src/bloom.js",
"src/styles/anime.js",
"src/styles/noir.js",
"src/styles/retro.js",
"src/styles/snow.js",
"src/styles/surveillance.js",
"src/styles/thermal.js",
"src/view/index.js",
"src/data/layerState.js",
"src/data/layerStateTokenReservations.json",
"src/data/idSwitches.js",
"src/data/detectionPolicy.js",
"src/scopeMaskPolicy.js",
"src/i18n/marker.js"
],
"external": []
},
"share-link-path": {
"exports": ["./share/link-path"],
"modules": ["src/share/shareLinkPath.js"],
"external": []
},
"ghostmaps": {
"exports": ["./layers/ghostmaps"],
"modules": [
"src/layers/ghostMaps/index.js",
"src/layers/ghostMaps/catalog.js",
"src/layers/ghostMaps/records.js",
"src/layers/ghostMaps/kml.js",
"src/layers/ghostMaps/source.js",
"src/sources/httpBody.js",
"src/data/geoFileImport.js",
"src/i18n/marker.js",
"src/i18n/index.js",
"src/i18n/locale.js",
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/data/geoImportImages.js",
"src/data/geoImportPins.js",
"src/layers/streetLevel/tileMath.js",
"src/layers/streetLevel/view.js"
],
"external": ["cesium"]
},
"ghostmaps-source": {
"exports": ["./layers/ghostmaps/source"],
"modules": [
"src/layers/ghostMaps/source.js",
"src/layers/ghostMaps/catalog.js",
"src/sources/httpBody.js",
"src/i18n/marker.js"
],
"external": []
},
"perimeters-source": {
"exports": ["./layers/perimeters/source"],
"modules": [
@@ -4029,6 +4167,7 @@
"src/i18n/locales/es.json",
"src/i18n/locales/ru.json",
"src/i18n/locales/zh-CN.json",
"src/i18n/locales/zh-Hant.json",
"src/ui/statusText.js",
"src/ui/layerNames.js"
],
+645
View File
@@ -0,0 +1,645 @@
#!/usr/bin/env node
/**
* qa-ghostmaps.mjs — headless proof for the S2 Underground GhostMaps layer
* (id `s2-ghostmaps`): S2's public KMZ intel products, kept current from
* github.com/s2underground/GhostMaps.
*
* Drives the REAL app in headless Chromium against a dev server (keyless).
*
* (i) LIVE — enabling the layer loads the default products (Common
* Intelligence Picture and the 30-day kinetic pull) from the live
* repository through /api/ghostmaps, one data source per product,
* matching the proxy's catalog commit; the row shows one chip per
* catalog product with the defaults active, and the page holds an
* open event stream to /api/ghostmaps/events.
* (ii) PICK — a Common Intelligence Picture marker at the screen centre
* picks as this layer's entity; clicking it paints its report card
* and clicking empty ground clears it.
* (iii) PUSH (synthetic) — the event stream is replaced in the page and a
* catalog naming a new edition of one product is pushed: only that
* product reloads (a new data source replaces the old one, no
* duplicates), the other keeps its data source. A catalog without a
* product removes it.
* (iv) CHIPS — clicking an active product chip removes that product,
* clicking it again restores it; the choice survives a reload.
* (v) DISABLE — every GhostMaps data source leaves the viewer.
* (vi) VIEWPORT — at a 390x844 phone viewport the open row and its chips
* fit the panel width with no horizontal overflow.
* (vii) FAR SIDE — pins skip the depth test, so they are horizon-culled:
* seen from over the Indian Ocean no pin clearly behind the planet is
* shown; back over North America the near-side pins show again.
*
* Screenshots go to qa-shots/ghostmaps-*.png (gitignored).
*
* Run: node scripts/qa-ghostmaps.mjs --url http://localhost:4173
* Optional: --timeout-ms 180000 for a slow boot, --shots <dir>.
* Exits non-zero on any FAIL. Does not commit anything.
*/
import puppeteer from 'puppeteer';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const argv = process.argv.slice(2);
const getOpt = (name, dflt) => {
const i = argv.indexOf(name);
return i >= 0 && argv[i + 1] ? argv[i + 1] : dflt;
};
const APP_URL = getOpt('--url', 'http://localhost:4173');
const HEADFUL = argv.includes('--headful');
const TIMEOUT_MS = Number(getOpt('--timeout-ms', '90000'));
const SHOTS_DIR = path.resolve(
getOpt('--shots', path.join(__dirname, '..', 'qa-shots')),
);
const LAYER_ID = 's2-ghostmaps';
const results = [];
function record(name, ok, detail) {
results.push({ name, ok, detail });
const tag = ok ? '\x1b[32mPASS\x1b[0m' : '\x1b[31mFAIL\x1b[0m';
console.log(` [${tag}] ${name}${detail ? ` — ${detail}` : ''}`);
}
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
async function boot(page) {
await page.goto(`${APP_URL}/?welcome=0`, {
waitUntil: 'domcontentloaded',
timeout: TIMEOUT_MS,
});
await page.waitForFunction(
() => window.__godsEyeView?.viewer && window.__godsEyeView?.dataManager,
{ timeout: TIMEOUT_MS },
);
await sleep(5000);
await page.keyboard.press('Escape');
}
/** GhostMaps data sources on the viewer: name → entity count. */
function ghostSources(prefix) {
const { dataSources } = window.__godsEyeView.viewer;
const out = [];
for (let i = 0; i < dataSources.length; i++) {
const ds = dataSources.get(i);
if (ds.name?.startsWith(prefix))
out.push({ name: ds.name, count: ds.entities.values.length });
}
return out;
}
function paintedOverlayPixels() {
const canvas = document.getElementById('world-overlay-canvas');
if (!canvas) return -1;
const pixels = canvas
.getContext('2d')
.getImageData(0, 0, canvas.width, canvas.height).data;
let count = 0;
for (let i = 3; i < pixels.length; i += 4) if (pixels[i] > 0) count++;
return count;
}
async function enableAndSettle(page) {
await page.evaluate((id) => {
const panel = document.getElementById('data-panel');
if (panel?.classList.contains('collapsed'))
panel.querySelector('[data-collapse-target="data-panel"]')?.click();
return window.__godsEyeView.dataManager.setEnabled(id, true);
}, LAYER_ID);
await page.waitForFunction(
(id) => {
const stats = window.__godsEyeView.dataManager.layers
.get(id)
.module.getStats();
return !stats.loading && stats.count > 0;
},
{ timeout: TIMEOUT_MS, polling: 500 },
LAYER_ID,
);
}
const stats = (page) =>
page.evaluate(
(id) => window.__godsEyeView.dataManager.layers.get(id).module.getStats(),
LAYER_ID,
);
const sources = (page) =>
page.evaluate(`(${ghostSources})(${JSON.stringify(`${LAYER_ID}:`)})`);
async function showRow(page) {
await page.evaluate((id) => {
document
.querySelector(`[data-layer-id="${id}"]`)
?.scrollIntoView({ block: 'center' });
}, LAYER_ID);
await sleep(400);
}
async function main() {
fs.mkdirSync(SHOTS_DIR, { recursive: true });
const browser = await puppeteer.launch({
headless: !HEADFUL,
args: ['--use-angle=swiftshader', '--enable-unsafe-swiftshader'],
defaultViewport: { width: 1440, height: 900 },
});
try {
// ---- (i) LIVE ---------------------------------------------------------
const page = await browser.newPage();
// Start clean once; a reload must keep what the page stored.
await page.evaluateOnNewDocument(() => {
try {
if (sessionStorage.getItem('qa-ghostmaps-clean')) return;
localStorage.clear();
sessionStorage.setItem('qa-ghostmaps-clean', '1');
} catch {
/* sandboxed frames have no storage */
}
});
page.on('pageerror', (error) =>
console.log(` [page error] ${error.message}`),
);
await boot(page);
const catalog = await page.evaluate(() =>
fetch('/api/ghostmaps/catalog').then((r) => r.json()),
);
record(
'LIVE: proxy catalog names a commit and the default products',
/^[0-9a-f]{40}$/.test(catalog.commit || '') &&
['cip', 'kinetic-30d'].every((id) =>
catalog.products.some((p) => p.id === id && p.defaultOn),
),
`${catalog.commit?.slice(0, 7)} "${catalog.message}", ${catalog.products.length} products`,
);
const t0 = Date.now();
await enableAndSettle(page);
const live = await stats(page);
const liveSources = await sources(page);
record(
'LIVE: default products load as one data source each',
liveSources.length === 2 &&
liveSources.every((s) => s.count > 0) &&
live.products.sort().join() === 'cip,kinetic-30d',
`${liveSources.map((s) => `${s.name}=${s.count}`).join(', ')} in ${Date.now() - t0} ms`,
);
record(
'LIVE: layer reports the proxy commit and no error',
live.commit === catalog.commit && !live.error,
`commit ${live.commit?.slice(0, 7)}, error ${live.error}`,
);
await showRow(page);
const chips = await page.evaluate(
(id) =>
[
...document.querySelectorAll(
`[data-layer-id="${id}"] .data-toggle-chip`,
),
].map((chip) => ({
id: chip.dataset.chipId,
active: chip.getAttribute('aria-pressed') === 'true',
})),
LAYER_ID,
);
record(
'LIVE: one chip per product, defaults pressed',
chips.length === catalog.products.length &&
chips.every(
(chip) =>
chip.active ===
catalog.products.find((p) => p.id === chip.id)?.defaultOn,
),
chips.map((c) => `${c.id}${c.active ? '*' : ''}`).join(' '),
);
const stream = await page
.waitForFunction(
(id) =>
window.__godsEyeView.dataManager.layers.get(id).module.getStats()
.stream === 'open',
{ timeout: 15000, polling: 250 },
LAYER_ID,
)
.then(
() => true,
() => false,
);
record('LIVE: the /api/ghostmaps/events stream is open', stream);
await page.screenshot({ path: path.join(SHOTS_DIR, 'ghostmaps-live.png') });
// ---- (ii) PICK ----------------------------------------------------------
const target = await page.evaluate((id) => {
const gev = window.__godsEyeView;
const ds = [...Array(gev.viewer.dataSources.length).keys()]
.map((i) => gev.viewer.dataSources.get(i))
.find((item) => item.name === `${id}:cip`);
const entity = ds.entities.values.find((e) => e.billboard);
const carto = gev.viewer.scene.globe.ellipsoid.cartesianToCartographic(
entity.position.getValue(gev.viewer.clock.currentTime),
);
try {
gev.viewer.camera.cancelFlight();
} catch {
/* no flight */
}
gev.viewer.camera.setView({
destination: gev.viewer.scene.globe.ellipsoid.cartographicToCartesian({
longitude: carto.longitude,
latitude: carto.latitude,
height: 40000,
}),
orientation: { heading: 0, pitch: -Math.PI / 2, roll: 0 },
});
gev.viewer.scene.requestRender?.();
return entity.id;
}, LAYER_ID);
await page
.waitForFunction(
() => window.__godsEyeView.viewer.scene.globe.tilesLoaded,
{ timeout: 30000 },
)
.catch(() => {});
// The horizon cull reveals the pin on the frame after the camera moves.
await page
.waitForFunction(
() => {
const v = window.__godsEyeView.viewer;
v.scene.requestRender?.();
const c = v.scene.canvas;
return v.scene
.drillPick({ x: c.clientWidth / 2, y: c.clientHeight / 2 }, 8)
.some((p) =>
String(p?.id?.id ?? p?.id ?? '').startsWith('ghostmaps:cip:'),
);
},
{ timeout: 15000, polling: 500 },
)
.catch(() => {});
const probe = await page.evaluate(() => {
const v = window.__godsEyeView.viewer;
const c = v.scene.canvas;
const box = c.getBoundingClientRect();
const centre = { x: c.clientWidth / 2, y: c.clientHeight / 2 };
const picked = v.scene.drillPick(centre, 8);
// Empty ground: the first point below the marker (the card is drawn
// above it) that picks nothing at all; markers can be dense in a city.
let empty = null;
for (let r = 120; r < 420 && !empty; r += 60)
for (const a of [2, 1, 3, 0, 4]) {
const p = {
x: centre.x + r * Math.cos((a * Math.PI) / 4),
y: centre.y + r * Math.sin((a * Math.PI) / 4),
};
if (!v.scene.pick(p)) {
empty = p;
break;
}
}
empty ||= { x: centre.x + 400, y: centre.y + 300 };
return {
ids: picked.map((p) => String(p?.id?.id ?? p?.id ?? '')),
centre: { x: centre.x + box.left, y: centre.y + box.top },
empty: { x: empty.x + box.left, y: empty.y + box.top },
};
});
record(
'PICK: the centred marker picks as a GhostMaps entity',
probe.ids.some((id) => id.startsWith('ghostmaps:cip:')),
`${target} → [${probe.ids.slice(0, 3).join(', ')}]`,
);
const before = await page.evaluate(paintedOverlayPixels);
await page.mouse.click(probe.centre.x, probe.centre.y);
const painted = await page
.waitForFunction(`(${paintedOverlayPixels})() > ${before + 100}`, {
timeout: 10000,
polling: 250,
})
.then(
() => true,
() => false,
);
const after = await page.evaluate(paintedOverlayPixels);
record(
'PICK: clicking the marker paints its report card',
painted,
`${before} → ${after} pixels`,
);
await page.screenshot({ path: path.join(SHOTS_DIR, 'ghostmaps-card.png') });
const cardState = () =>
page.evaluate((id) => {
const d = window.__gevWorldOverlay?.getDiagnostics?.();
return {
entries: d?.entriesBySource?.[id] ?? null,
painted: d?.paintedBySource?.[id] ?? null,
};
}, LAYER_ID);
const selectedState = await cardState();
record(
'PICK: the overlay host holds and paints exactly one card',
selectedState.entries === 1 && selectedState.painted === 1,
JSON.stringify(selectedState),
);
await page.mouse.click(probe.empty.x, probe.empty.y);
// The overlay canvas is `desynchronized`, so headless read-back can
// return a stale buffer; the host's own model is the authority here.
const cleared = await page
.waitForFunction(
(id) => {
const d = window.__gevWorldOverlay.getDiagnostics();
return (
d.entriesBySource?.[id] === 0 && !(d.paintedBySource?.[id] > 0)
);
},
{ timeout: 10000, polling: 250 },
LAYER_ID,
)
.then(
() => true,
() => false,
);
record(
'PICK: clicking empty ground clears the card',
cleared,
JSON.stringify(await cardState()),
);
// ---- (vii) FAR SIDE ---------------------------------------------------
// Pins skip the depth test; with Google 3D tiles nothing else hides the
// far side. A pin clearly behind the planet (sphere test with margin) must
// be hidden, and pins facing the camera must still show.
const horizonCounts = (lon, lat) =>
page.evaluate(
async (id, lo, la) => {
const gev = window.__godsEyeView;
const d2r = Math.PI / 180;
try {
gev.viewer.camera.cancelFlight();
} catch {
/* no flight */
}
gev.viewer.camera.setView({
destination:
gev.viewer.scene.globe.ellipsoid.cartographicToCartesian({
longitude: lo * d2r,
latitude: la * d2r,
height: 18_000_000,
}),
orientation: { heading: 0, pitch: -Math.PI / 2, roll: 0 },
});
gev.viewer.scene.requestRender?.();
await new Promise((r) => setTimeout(r, 1200));
const c = gev.viewer.camera.positionWC;
const norm = (v) => Math.hypot(v.x, v.y, v.z);
let far = 0;
let nearShown = 0;
for (let i = 0; i < gev.viewer.dataSources.length; i++) {
const ds = gev.viewer.dataSources.get(i);
if (!ds.name?.startsWith(`${id}:`)) continue;
for (const e of ds.entities.values) {
if (!e.billboard) continue;
const p = e.position.getValue(gev.viewer.clock.currentTime);
// Angle from the camera's nadir to the pin, against the
// geometric horizon angle; the cull's 1 km margin shows pins up
// to about 1° past it, so "clearly behind" is beyond 2°.
const angle = Math.acos(
(p.x * c.x + p.y * c.y + p.z * c.z) / (norm(p) * norm(c)),
);
const horizon = Math.acos(norm(p) / norm(c));
const margin = (2 * Math.PI) / 180;
if (e.show && angle > horizon + margin) far++;
if (e.show && angle < horizon - margin) nearShown++;
}
}
return { far, nearShown };
},
LAYER_ID,
lon,
lat,
);
const fromIndianOcean = await horizonCounts(80, -30);
record(
'FAR SIDE: pins behind the planet are hidden',
fromIndianOcean.far === 0,
JSON.stringify(fromIndianOcean),
);
await page.screenshot({
path: path.join(SHOTS_DIR, 'ghostmaps-far-side.png'),
});
const fromAmerica = await horizonCounts(-98, 39);
record(
'FAR SIDE: pins facing the camera show again',
fromAmerica.far === 0 && fromAmerica.nearShown > 100,
JSON.stringify(fromAmerica),
);
// ---- (iv) CHIPS -------------------------------------------------------
const clickChip = async (id) => {
// Row controls render on the next frame after the layer settles.
await page.waitForSelector(
`[data-layer-id="${LAYER_ID}"] .data-toggle-chip[data-chip-id="${id}"]`,
{ timeout: 15000 },
);
return page.evaluate(
(layer, chip) =>
document
.querySelector(
`[data-layer-id="${layer}"] .data-toggle-chip[data-chip-id="${chip}"]`,
)
?.click(),
LAYER_ID,
id,
);
};
await clickChip('kinetic-30d');
await page.waitForFunction(
(id) =>
!window.__godsEyeView.dataManager.layers
.get(id)
.module.getStats()
.products.includes('kinetic-30d'),
{ timeout: 15000 },
LAYER_ID,
);
const without = await sources(page);
record(
'CHIPS: turning a product off removes only its data source',
without.length === 1 && without[0].name === `${LAYER_ID}:cip`,
without.map((s) => s.name).join(', '),
);
await page.reload({ waitUntil: 'domcontentloaded' });
await page.waitForFunction(() => window.__godsEyeView?.dataManager, {
timeout: TIMEOUT_MS,
});
await sleep(3000);
await enableAndSettle(page);
const kept = await stats(page);
record(
'CHIPS: the product choice survives a reload',
kept.products.join() === 'cip',
kept.products.join(', '),
);
await showRow(page);
await clickChip('kinetic-30d');
await page.waitForFunction(
(id) =>
window.__godsEyeView.dataManager.layers
.get(id)
.module.getStats()
.products.includes('kinetic-30d'),
{ timeout: 30000 },
LAYER_ID,
);
record(
'CHIPS: turning it back on restores it',
(await sources(page)).length === 2,
);
// ---- (v) DISABLE ------------------------------------------------------
await page.evaluate(
(id) => window.__godsEyeView.dataManager.setEnabled(id, false),
LAYER_ID,
);
await sleep(500);
record(
'DISABLE: every GhostMaps data source leaves the viewer',
(await sources(page)).length === 0,
);
await page.close();
// ---- (iii) PUSH (synthetic) ----------------------------------------------
const push = await browser.newPage();
await push.evaluateOnNewDocument(() => {
localStorage.clear();
// A controllable stand-in for the real stream.
class QaEventSource {
constructor(url) {
this.url = url;
this.listeners = new Set();
(window.__qaStreams ||= []).push(this);
}
addEventListener(type, listener) {
if (type === 'catalog') this.listeners.add(listener);
}
removeEventListener(type, listener) {
this.listeners.delete(listener);
}
close() {
this.closed = true;
}
emit(catalog) {
for (const listener of this.listeners)
listener({ data: JSON.stringify(catalog) });
}
}
window.EventSource = QaEventSource;
});
await boot(push);
await enableAndSettle(push);
const identity = () =>
push.evaluate((id) => {
const { dataSources } = window.__godsEyeView.viewer;
window.__qaIds ||= new WeakMap();
window.__qaNext ||= 1;
const out = {};
for (let i = 0; i < dataSources.length; i++) {
const ds = dataSources.get(i);
if (!ds.name?.startsWith(`${id}:`)) continue;
if (!window.__qaIds.has(ds))
window.__qaIds.set(ds, window.__qaNext++);
out[ds.name] = window.__qaIds.get(ds);
}
return out;
}, LAYER_ID);
const first = await identity();
const pushed = Date.now();
await push.evaluate(async (id) => {
const catalog = await fetch('/api/ghostmaps/catalog').then((r) =>
r.json(),
);
const kinetic = catalog.products.find((p) => p.id === 'kinetic-30d');
kinetic.version = 'f'.repeat(40);
catalog.message = 'QA push';
window.__qaStreams
.filter((s) => !s.closed)
.forEach((s) => s.emit(catalog));
}, LAYER_ID);
await push.waitForFunction(
(id) => {
const layer = window.__godsEyeView.dataManager.layers.get(id).module;
return (
!layer.getStats().loading &&
layer.getRowControls().info.includes('QA push')
);
},
{ timeout: 20000, polling: 100 },
LAYER_ID,
);
await sleep(500);
const second = await identity();
record(
'PUSH: a new edition reloads only that product',
Object.keys(second).length === 2 &&
second[`${LAYER_ID}:kinetic-30d`] !==
first[`${LAYER_ID}:kinetic-30d`] &&
second[`${LAYER_ID}:cip`] === first[`${LAYER_ID}:cip`],
`${JSON.stringify(first)} → ${JSON.stringify(second)} in ${Date.now() - pushed} ms`,
);
await push.evaluate(async () => {
const catalog = await fetch('/api/ghostmaps/catalog').then((r) =>
r.json(),
);
catalog.products = catalog.products.filter((p) => p.id !== 'kinetic-30d');
window.__qaStreams
.filter((s) => !s.closed)
.forEach((s) => s.emit(catalog));
});
await sleep(1000);
const third = await identity();
record(
'PUSH: a product leaving the catalog leaves the globe',
Object.keys(third).join() === `${LAYER_ID}:cip`,
Object.keys(third).join(', '),
);
await push.close();
// ---- (vi) VIEWPORT ----------------------------------------------------
const phone = await browser.newPage();
await phone.setViewport({ width: 390, height: 844, isMobile: true });
await phone.evaluateOnNewDocument(() => localStorage.clear());
await boot(phone);
await enableAndSettle(phone);
await showRow(phone);
const fit = await phone.evaluate((id) => {
const row = document.querySelector(`[data-layer-id="${id}"]`);
const panel = document.getElementById('data-panel');
const controls = row?.querySelector('.data-toggle-controls');
return {
row: Boolean(row),
overflow: controls ? controls.scrollWidth - controls.clientWidth : -1,
pageOverflow:
document.documentElement.scrollWidth -
document.documentElement.clientWidth,
panelRight: panel?.getBoundingClientRect().right,
width: window.innerWidth,
};
}, LAYER_ID);
record(
'VIEWPORT: chips fit the phone-width panel',
fit.row && fit.overflow <= 1 && fit.pageOverflow <= 0,
JSON.stringify(fit),
);
await phone.screenshot({
path: path.join(SHOTS_DIR, 'ghostmaps-phone.png'),
});
await phone.close();
} finally {
await browser.close();
}
const failed = results.filter((r) => !r.ok);
console.log(
`\n${results.length - failed.length}/${results.length} passed. Screenshots: ${SHOTS_DIR}`,
);
process.exit(failed.length ? 1 : 0);
}
main().catch((error) => {
console.error(error);
process.exit(1);
});