fix(web): CI-owned wasm artifacts + e2e harness fixes #95

Merged
funman300 merged 3 commits from fix/web-ci-reproducible-and-e2e into master 2026-06-23 17:01:04 +00:00
2 changed files with 10 additions and 7 deletions
Showing only changes of commit 5b2b234c54 - Show all commits
@@ -136,7 +136,7 @@ test("new game button resets move history and score", async ({ page }) => {
test("timer stops accumulating while tab is hidden", async ({ page }) => {
// Install the fake clock before navigation so the game's setInterval is
// controlled by page.clock.tick() and won't fire on real wall-clock time.
// controlled by page.clock.runFor() and won't fire on real wall-clock time.
await page.clock.install();
await page.goto("/play-classic?seed=42");
@@ -144,7 +144,7 @@ test("timer stops accumulating while tab is hidden", async ({ page }) => {
await waitForBridge(page);
// Advance 3 fake seconds to get a non-zero timer reading.
await page.clock.tick(3_000);
await page.clock.runFor(3_000);
const timerAfter3s = await page.locator("#hud-timer").textContent();
expect(timerAfter3s).toBe("0:03");
@@ -152,7 +152,7 @@ test("timer stops accumulating while tab is hidden", async ({ page }) => {
await setTabHidden(page, true);
// Advance 10 fake seconds while hidden.
await page.clock.tick(10_000);
await page.clock.runFor(10_000);
const timerWhileHidden = await page.locator("#hud-timer").textContent();
expect(timerWhileHidden).toBe("0:03"); // must not have advanced
@@ -160,7 +160,7 @@ test("timer stops accumulating while tab is hidden", async ({ page }) => {
await setTabHidden(page, false);
// Advance 2 more fake seconds.
await page.clock.tick(2_000);
await page.clock.runFor(2_000);
const timerAfterResume = await page.locator("#hud-timer").textContent();
expect(timerAfterResume).toBe("0:05"); // only 3 + 2 visible seconds counted
});
@@ -182,11 +182,11 @@ test("timer does not restart while tab is visible during an auto-complete or won
// the snap state correctly gates the restart.
//
// Advance 2 s, then hide+show — timer should continue normally.
await page.clock.tick(2_000);
await page.clock.runFor(2_000);
await setTabHidden(page, true);
await page.clock.tick(5_000);
await page.clock.runFor(5_000);
await setTabHidden(page, false);
await page.clock.tick(2_000);
await page.clock.runFor(2_000);
const timerText = await page.locator("#hud-timer").textContent();
// 2 visible + 0 hidden + 2 visible = 4 total
+3
View File
@@ -986,6 +986,9 @@ window.__FERROUS_DEBUG__ = {
snapshot() {
return game ? game.debug_snapshot() : null;
},
serialize() {
return game ? game.serialize() : null;
},
applyLegalMove(index) {
if (!game) return { ok: false, error: "game_not_ready" };
const result = game.debug_apply_legal_move(index);