tests: Playwright spec for explorer URL state round-trip (closes #209)#214
tests: Playwright spec for explorer URL state round-trip (closes #209)#214rdhyee wants to merge 1 commit into
Conversation
…plesorg#209) CI-safe spec set extracted from `tests/playwright/url_roundtrip_investigation.js` (which remains as a manual diagnostic). Five tests covering the URL state contract slices fixed in PRs isamplesorg#203, isamplesorg#205, isamplesorg#210, isamplesorg#212: 1. **Point-mode deep-link with `mode=point` enters point mode** — regression for Bug B fix in isamplesorg#203 (when heading is omitted, the URL must still hydrate into point mode). 2. **Low-alt deep-link WITHOUT `mode=point` enters point mode** — regression for isamplesorg#207 item 4 (boot should enter point mode based on altitude alone, not just the URL's mode flag). 3. **Sub-threshold pan updates URL hash via `moveEnd`** — regression for isamplesorg#205 (Cesium's `camera.changed` suppresses small moves below `percentageChanged` threshold; `moveEnd` is the backstop). 4. **URL round-trips across browser contexts** — combined regression for isamplesorg#203 + isamplesorg#205. Context A pans + zooms after settle, captures URL; Context B opens the captured URL and arrives at the same camera + mode within tight tolerance. 5. **`h3` hashchange with invalid cell clears `_globeState.selectedH3`** — regression for isamplesorg#207 item 6 (asymmetry between boot and hashchange null-result branches). Search-result row click selection (isamplesorg#207 item 8) deferred — needs working FTS data and depends on substrate the spec shouldn't have to set up. Tests use `waitForPointModeSettled` (waits for the phase message's "Click one for details." text) instead of `waitForMode` for the no-`mode=point` cases — `waitForMode` can match a transient mode flip during the boot transition (the dual-mode-state anomaly being addressed structurally in isamplesorg#208). `test.setTimeout(360000)` per describe block — cold-cache point-mode boot can take 60–90s per isamplesorg#190, and the round-trip test opens multiple fresh contexts each paying the cost. Verified: all 5 tests pass against localhost in ~1m 24s. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2c97398 to
3b3555b
Compare
Codex review — round 1Self-contained Codex review (no shared context with our session). Pasting verbatim per the iterative-review pattern. SummaryThe specs are useful, but I would not approve this as-is if the PR title/body says Per-ask response1. h3 hashchange spec assertion strength
Stronger version: start with a known valid h3, wait until await page.goto(`${EXPLORER_PATH}#v=1&lat=${LAT}&lng=${LNG}&alt=${ALT_CLUSTER}&h3=${VALID_H3}`);
await waitForMode(page, 'cluster');
await page.waitForFunction(async () => {
const v = await window._ojs.ojsConnector.mainModule.value('viewer');
return !!v._globeState.selectedH3;
});
await page.evaluate((badH3) => {
const params = new URLSearchParams(location.hash.slice(1));
params.set('h3', badH3);
params.set('heading', '5.0');
location.hash = '#' + params.toString();
}, '0baadbeeffffffff');
await page.waitForFunction(async () => {
const v = await window._ojs.ojsConnector.mainModule.value('viewer');
return v._globeState.selectedH3 === null;
});That would actually catch a regression in the 2.
|
Closes #209. CI-safe Playwright specs covering the URL state contract slices fixed by PRs #203, #205, #210, #212.
What this adds
New file:
tests/playwright/url-roundtrip.spec.js. Five tests:mode=pointenters point modemode=pointenters point modemoveEndpercentageChangedsuppressed events)h3hashchange with invalid cell clears_globeState.selectedH3What's intentionally NOT covered
tests/playwright/url_roundtrip_investigation.jsremains as a manual diagnostic — too slow and network-sensitive for CI. The new spec covers the same surface against the Quarto preview.?sources=,?material=, etc.). Separate UX path; could be a follow-up spec.Notes on the implementation
waitForPointModeSettled(waits for the phase message's "Click one for details." text) instead ofwaitForModefor the no-mode=pointcases —waitForModealone can match a transient mode flip during boot (the dual-mode-state anomaly being addressed structurally in explorer: refactor URL/mode state management (centralize writers, collapse dual mode) #208).test.setTimeout(360000)per describe block — cold-cache point-mode boot can take 60–90s per explorer: 60–90 s 'no dots' window on cold-cache deep-link to point mode (DuckDB-WASM 1.24.0 falls back to full HTTP read) #190, and the round-trip test opens multiple fresh contexts each paying the cost.waitForMode,waitForPointModeSettled,snapshot) are inlined in the spec file rather than shared withexplorer-helper.spec.js. They overlap a bit; a future spec consolidation could DRY them up but the cost is small and the helpers are simple.Verification
All 5 tests pass against localhost (Quarto preview of current
main) in ~1m 24s on this machine. Output:Risks
localhost:5860by default (viaTEST_URLenv). Same convention as the existing specs; no CI-config changes needed.🤖 Generated with Claude Code