feedback4: the real-browser e2e suites confirm the leftover-funds prompt on the Space path too (coop.e2e 4/4, real.e2e 2/2)

This commit is contained in:
sganggs committed 2026-10-05 14:28:47 +08:00
1 parent 8aa41d9c1c
commit bcd916eb61
2 files changed
+9 -4

No files matched your search

+2 -1
View File
@@ -600,7 +600,8 @@ async function ready(c, { key = false } = {}) {
if (!(await c.isEditable())) return;
const s = await c.st();
if (!s.canReady) { c.note(`temp not empty (${s.temp}) — ready blocked`); return; }
if (key) { await c.page.mouse.click(c.w / 2, c.h * 0.3); await c.page.keyboard.press('Space'); } else await c.click('.readybtn');
// Space asks about leftover funds like the button does (剩余资金, DESIGN §23.11); the button path confirms inside c.click
if (key) { await c.page.mouse.click(c.w / 2, c.h * 0.3); await c.page.keyboard.press('Space'); await c.confirmFundsLeft(); } else await c.click('.readybtn');
await c.waitFor((x) => x.ready || x.phase !== 'PREP', 'ready', 8000);
}
+7 -3
View File
@@ -413,14 +413,18 @@ class Client {
async ready() {
if (!(await this.isEditable())) return;
await this.click('.readybtn');
// 准备 with funds left asks first (剩余资金, DESIGN §23.11): confirm it, as a player who means to start the fight does
await this.confirmFundsLeft();
await this.waitFor((s) => s.ready || s.phase !== 'PREP', 'ready', 8000);
}
/** 准备 with funds left asks first (剩余资金, DESIGN §23.11): confirm it, as a player who means to start the fight does. */
async confirmFundsLeft() {
await sleep(250);
const asked = await this.page.evaluate(() => {
const t = document.querySelector('.modal__title');
return !!(t && t.textContent.includes('剩余资金'));
});
if (asked) await this.click('.modal__actions button', '准备就绪', { timeout: 4000 });
await this.waitFor((s) => s.ready || s.phase !== 'PREP', 'ready', 8000);
}
}
@@ -542,7 +546,7 @@ describe('real server + real browsers', { skip: !ENABLED && 'set SP_REAL_E2E=1 (
await c.deployFromHand(2);
const s2 = await c.st();
if (s2.temp > 0) c.note(`temp not empty (${s2.temp}) — ready blocked`);
if (c === guest) { await c.page.keyboard.press('Space'); await c.waitFor((x) => x.ready || x.phase !== 'PREP', 'ready (Space)', 8000); } else await c.ready();
if (c === guest) { await c.page.keyboard.press('Space'); await c.confirmFundsLeft(); await c.waitFor((x) => x.ready || x.phase !== 'PREP', 'ready (Space)', 8000); } else await c.ready();
}
} else if (hs.phase === 'SP_DRAFT') {
for (const c of both) {