test: make Recent Imagery live gate panel-relative

This commit is contained in:
Kevin Rajan committed 2026-10-03 10:33:46 -05:00
1 parent aa16b7c3b0
commit de4c8343dd
1 file changed
+14 -8
+14 -8
View File
@@ -308,15 +308,21 @@ const CONTROLS = {
}; };
const measure = () => const measure = () =>
page.evaluate((controls) => { page.evaluate((controls) => {
const panel = document.getElementById('recent-imagery-panel');
const body = document.getElementById('recent-imagery-panel-body'); const body = document.getElementById('recent-imagery-panel-body');
const panelRect = panel?.getBoundingClientRect();
const out = { bodyScroll: body?.scrollTop ?? null, rects: {} }; const out = { bodyScroll: body?.scrollTop ?? null, rects: {} };
for (const [name, selector] of Object.entries(controls)) { for (const [name, selector] of Object.entries(controls)) {
const rect = document.querySelector(selector)?.getBoundingClientRect(); const rect = document.querySelector(selector)?.getBoundingClientRect();
out.rects[name] = rect out.rects[name] =
? [rect.left, rect.top, rect.width, rect.height].map( rect && panelRect
(v) => Math.round(v * 10) / 10, ? [
) rect.left - panelRect.left,
: null; rect.top - panelRect.top,
rect.width,
rect.height,
].map((v) => Math.round(v * 10) / 10)
: null;
} }
return out; return out;
}, CONTROLS); }, CONTROLS);
@@ -1042,13 +1048,13 @@ try {
) <= ) <=
target * 0.01, target * 0.01,
fitHeight, fitHeight,
2_000, 4_000,
); );
const zoomedHeight = await page.evaluate( const zoomedHeight = await page.evaluate(
() => window.__godsEyeView.viewer.camera.positionCartographic.height, () => window.__godsEyeView.viewer.camera.positionCartographic.height,
); );
check( check(
`ZOOM IN flies to ${Math.round(fitHeight / 1000)} km within 2 s`, `ZOOM IN lands at ${Math.round(fitHeight / 1000)} km`,
zoomed, zoomed,
`height=${Math.round(zoomedHeight)} target=${Math.round(fitHeight)}`, `height=${Math.round(zoomedHeight)} target=${Math.round(fitHeight)}`,
); );
@@ -1258,7 +1264,7 @@ try {
); );
await wait(100); await wait(100);
} }
const tail = (key) => new Set(samples.slice(8).map((s) => s[key])); const tail = (key) => new Set(samples.slice(-8).map((s) => s[key]));
return { return {
settled: tail('imagery').size === 1 && tail('cctv').size === 1, settled: tail('imagery').size === 1 && tail('cctv').size === 1,
detail: `imagery=${samples.map((s) => s.imagery).join(',')} cctv=${samples.map((s) => s.cctv).join(',')}`, detail: `imagery=${samples.map((s) => s.imagery).join(',')} cctv=${samples.map((s) => s.cctv).join(',')}`,