feedback5: merge feedback4 (9f93096) — W4C ported: the board canvas is a click target, so a phone tap on the back row stays on the tile (PR #149's fold button had pushed the bond discs over row 12); browser suites poll long waits in slices under the 90 s protocol timeout; golden unchanged

This commit is contained in:
sganggs committed 2026-10-06 17:53:19 +08:00
commit c50b406874
7 files changed
+144 -8

No files matched your search

+3 -3
View File
@@ -20,7 +20,7 @@ import { test, describe } from 'node:test';
import assert from 'node:assert/strict';
import { existsSync } from 'node:fs';
import path from 'node:path';
import { Client, ROOT, sleep, hasChrome, startRealServer, problemsOf } from '../e2e/client.mjs';
import { Client, ROOT, sleep, hasChrome, startRealServer, problemsOf, waitForFunctionLong } from '../e2e/client.mjs';
const ENABLED = process.env.SP_E2E === '1' && hasChrome() && existsSync(path.join(ROOT, 'public/assets'));
const ONLY = process.env.SP_P2_REAL || '';
@@ -252,8 +252,8 @@ describe('user playtest #2 item 6 — 前往查看 → 返回战场 in combat (r
await c.waitFor((s) => s.phase === 'COMBAT', 'combat', 60000);
await sleep(1500);
assertNoPen(await battleViewState(c), `R${s0.round} own battle`);
// own battle over while the AI's field still runs
const target = await c.page.waitForFunction(() => {
// own battle over while the AI's field still runs (sliced: longer than the browser's 90 s protocol timeout)
const target = await waitForFunctionLong(c.page, () => {
const s = globalThis.__SP__.store.get();
const r = globalThis.__SP_RUNNER__?.state?.();
const pub = s.match.public;
+11
View File
@@ -119,6 +119,17 @@ describe('8: the detail card never covers the selected unit\'s underframe', () =
assert.match(panels, /\.uframe__label\s*\{[^}]*white-space:\s*nowrap\s*;/, 'shortcut labels stay on one line');
});
// a finger's tap near a disc: the browser's touch adjustment moved it onto the nearest element that responds to clicks
// (the canvas's pointer listeners do not count), so with PR #149's 收起 toggle pushing the discs over the back row a tap
// on the row-12 unit at 844×390 opened the bond popup (test/render/models.browser.test.js #4.1 touch)
test('the field canvas is a click target of its own, so a tap on the board stays on the tile under the finger', async () => {
const { readFileSync } = await import('node:fs');
const app = readFileSync(new URL('../../public/js/render/app.js', import.meta.url), 'utf8');
assert.match(app, /\n {2}canvas\.addEventListener\('click', onTapTarget\);\n/, 'registered with the other canvas listeners');
assert.match(app, /\n {6}canvas\.removeEventListener\('click', onTapTarget\);\n/, 'dropped on destroy');
assert.match(app, /const onTapTarget = \(\) => \{\};/, 'a no-op: the press itself stays with the pointer events');
});
test('underframeRect covers the diamond and its buttons', () => {
const r = underframeRect({ x: 500, y: 600, s: 100 }, 100);
assert.ok(r.left <= 500 - 105 && r.right >= 500 + 105 && r.bottom === 600 + 105);
+4 -3
View File
@@ -30,7 +30,7 @@ import { test, describe } from 'node:test';
import assert from 'node:assert/strict';
import { existsSync } from 'node:fs';
import path from 'node:path';
import { Client, ROOT, sleep, hasChrome, startRealServer, problemsOf } from '../e2e/client.mjs';
import { Client, ROOT, sleep, hasChrome, startRealServer, problemsOf, waitForFunctionLong } from '../e2e/client.mjs';
const ENABLED = process.env.SP_E2E === '1' && hasChrome() && existsSync(path.join(ROOT, 'public/assets'));
const HOST_KIT = ['chess_char_1_10_a', 'chess_char_1_12_a']; // 古米 (坚守), 艾丝黛尔 (萨尔贡)
@@ -485,8 +485,9 @@ describe('DESIGN §20.15 — the bond strip shows the watched teammate\'s bonds
await sleep(1500);
for (const c of [host, guest]) if (!(await c.st()).ready) await c.click('.readybtn');
await host.waitFor((s) => s.phase === 'COMBAT', 'combat', 60000);
// the own battle over while a teammate's still runs
const target = await host.page.waitForFunction(() => {
// the own battle over while a teammate's still runs (at 1× it may last longer than the browser's 90 s protocol
// timeout, which cut a plain page.waitForFunction off with a bare "Waiting failed")
const target = await waitForFunctionLong(host.page, () => {
const s = globalThis.__SP__.store.get();
const pub = s.match.public;
if (pub?.phase !== 'COMBAT') return { gone: true };