fix(ui): F8-12 — settle e2e regressions from the polish PR (#55)
Tests · UI / test (push) Has been cancelled
Tests · UI / test (pull_request) Successful in 3m25s

* state-binding.ts: normalise planet size by the engine's typical
  mid-range (`SIZE_NORMALIZER = 100`) so legacy fixtures recording
  Size in the hundreds do not blow up the world-unit disc and start
  overlapping neighbouring planets. The cube-root growth stays;
  Size-800 reads twice as big as Size-100.
* cargo-routes.spec.ts: retire the selection-ring CirclePrim from
  the expected primitive count (4 planets + 3 cargo arrow lines = 7).
* map-toggles.spec.ts: bombing-rings → planet outlines (the high-bit
  0xc… range is permanently empty); planet-names persist test waits
  for the renderer's debug providers and for the IndexedDB write to
  flush before reload.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Ilia Denisov
2026-05-28 00:14:14 +02:00
parent 680ebac919
commit 75a4211373
3 changed files with 38 additions and 17 deletions
+18 -6
View File
@@ -268,10 +268,12 @@ test("gear popover toggles a planet kind off and cascades onto its markers", asy
await openGame(page);
// Baseline — every planet shows up, plus the battle X-cross (2
// LinePrim) and the bombing ring on the foreign planet.
// LinePrim). F8-12 / #30 retired the bombing CirclePrim; the
// visual cue is now a planet outline drawn outside the primitive
// surface, so the high-bit 0xc… range stays empty by construction.
expect(await visiblePlanets(page)).toEqual([1, 2, 3, 4, 5]);
expect(await visibleHighBitCount(page, 0xa0000000)).toBe(2);
expect(await visibleHighBitCount(page, 0xc0000000)).toBe(1);
expect(await visibleHighBitCount(page, 0xc0000000)).toBe(0);
await page.getByTestId("map-toggles-trigger").click();
await expect(page.getByTestId("map-toggles-surface")).toBeVisible();
@@ -293,7 +295,6 @@ test("gear popover toggles a planet kind off and cascades onto its markers", asy
expect(await visiblePlanets(page)).toEqual([1, 2, 4, 5]);
expect(await visibleHighBitCount(page, 0xa0000000)).toBe(0);
expect(await visibleHighBitCount(page, 0xc0000000)).toBe(0);
});
test("visibility fog toggles between the LOCAL-planet circle list and an empty overlay", async ({
@@ -385,15 +386,26 @@ test("planet-names toggle persists across a page reload (F8-12 / #29)", async ({
true,
);
await page.getByTestId("map-toggles-planet-names").click();
expect(await page.getByTestId("map-toggles-planet-names").isChecked()).toBe(
false,
);
await expect
.poll(() =>
page
.getByTestId("map-toggles-planet-names")
.isChecked(),
)
.toBe(false);
// Wait for the IndexedDB write to flush so the reload observes the
// persisted blob instead of the pre-flip defaults.
await page.waitForTimeout(200);
await page.reload({ waitUntil: "commit" });
await expect(page.getByTestId("active-view-map")).toHaveAttribute(
"data-status",
"ready",
);
await page.waitForFunction(() => {
const prims = window.__galaxyDebug?.getMapPrimitives?.() ?? [];
return prims.length > 0;
});
await page.getByTestId("map-toggles-trigger").click();
expect(await page.getByTestId("map-toggles-planet-names").isChecked()).toBe(
false,