Check the photoreal paths in the browser on a synthetic 3D Tiles set

A generated tileset (a plate at ellipsoid level, 50 m and 200 m blocks and
a pitched roof, 27 KB) replaces Google's tiles when a QA page passes
?qaTileset=/path; only a root-relative path on the page origin is
accepted, and the Google credit is not shown for it. The strict harness
serves the set from disk, so nothing reaches Google.

qa-tiles-fixture checks on both engines that sampleHeight reads the block
at 50 m, clampToHeight lands on the roof, tiles and terrain drapes draw
where they should, tilesLoaded turns true, surface points land on the
roof within their budget, and pick renders per pass stay within it.
This commit is contained in:
German Khokhlov committed 2026-11-10 15:49:52 +04:00
1 parent a90407d547
commit e9ba5e9859
17 files changed
+1855 -20

No files matched your search

+39 -4
View File
@@ -93,10 +93,45 @@ export async function assertPreviewPortAvailable(href, request = fetch) {
/** Check the running page before any scenario touches its layers. */
export async function assertKeylessPreview(page) {
await page.evaluate(() => {
if (window.__godsEyeView.tileset || window.__GOOGLE_MAPS_API_KEY__)
throw new Error('Keyless preview required');
});
await page.evaluate(
(fixturePath) => {
const app = window.__godsEyeView;
const source = app.engine?.maps?.current()?.photoreal;
const fixture =
new URLSearchParams(location.search).get('qaTileset') === fixturePath &&
source?.tilesetUrl === fixturePath &&
(!source.tileset ||
new URL(source.tileset.resource?.url, location.href).href ===
location.origin + fixturePath);
if (
window.__GOOGLE_MAPS_API_KEY__ ||
(app.tileset && (!fixture || app.tileset !== source.tileset)) ||
((source || app.engine?.maps?.photorealActive()) && !fixture)
)
throw new Error('Keyless preview required');
},
TILES_FIXTURE_PATH,
);
}
export const TILES_FIXTURE_PATH = '/__qa/tiles3d/tileset.json';
// CDP serves these exact same-origin URLs, including requests from workers.
// Keeping them in scripts/ avoids shipping fixture assets in normal builds.
export function tilesFixtureRoutes(origin) {
return ['tileset.json', 'plate.glb', 'block50.glb', 'block200.glb', 'roof.glb'].map(
(name) => ({
pattern: new URL(`/__qa/tiles3d/${name}`, origin).href,
respond: () => ({
contentType: name.endsWith('.json')
? 'application/json'
: 'model/gltf-binary',
body: fs.readFileSync(
new URL(`./fixtures/tiles3d/${name}`, import.meta.url),
),
}),
}),
);
}
/** The URL with no remote IP: fulfilled by a fixture or a cache, or a data URL. */