0.2.4-dev: round-29 community fixes and the official shared card pool
- Shared card pool and item stock as in the official mode (the owner's request, from the 路标档案馆 video and public notes): solo low-tier exceptions, co-op operators x2, shared item stock with special-item exceptions, normal / advanced occupancy 1 / 2, re-check on buy, 机变 exhaustion, release on consume / destroy / elimination; 整备 never exceeds stock; invariant held <= cap. - 突袭: one taunt-first reselect right after a revive (the owner's rule); ordinary polls and redeploys keep the 0.2.3 rule; a revive on an enemy's tile stays. #475: online boss / hidden-boss Raid may land on the empty half (owner-limited scope). - 浊心斯卡蒂 S1 x 坚守 no longer bounce redirected damage, and the two shares conserve the hit (idea of PR #464 by @HappyTanuki). - Operator fixes adapted from PRs by @Xinglan233 (#459 哈洛德 S2 elemental trigger, #460 涤火杰西卡 shield on the four adjacent tiles, #461 家族徽章 first hit after stealth, #462 松果 S2 regrow per deploy); 克莱门莎 S2 splash 1.1 / 100% ATK and air auto-trigger (#467); 白面 copying 歌蕾蒂娅 / 余 skips the three-member condition (#473, the owner's video). - 香槟炸弹 is not chosen by friendly auras / heals (PR #468 / #476 by @Siornya); 琳琅诗怀雅 coin balance (PR #450 by @IceCodeNew); Touch prep display (PR #451 by @YinqiMargatroid); lobby header (PR #471 by @YuriRestia); Japanese UI terms (PR #448 by @scutkane). - AI-only boss countdown grace, render-failure cache / recovery without restarting a battle, device units kept on a same-field re-entry, DIY detail / skill previews, large-text result buttons. - golden: battle families equal 0.2.3 except diy-135 / diy-136 (克莱门莎); all 18 release matches move through the shared pool, every flip named in docs/history/0.2.4.md §29.12; two coverage scenarios added.
This commit is contained in:
1 parent
1db8e51023
commit
6bfc08270c
129 files changed
+3477
-1011
No files matched your search
@@ -503,7 +503,8 @@ describe('createAssets store', () => {
|
||||
|
||||
test('image cache + preload progress (failures resolve to null)', async () => {
|
||||
const loaded = [];
|
||||
const a = createAssets({ manifest: M, loadImage: async (u) => { loaded.push(u); if (u.includes('bad')) throw new Error('x'); return { src: u }; } });
|
||||
let fail = true;
|
||||
const a = createAssets({ manifest: M, loadImage: async (u) => { loaded.push(u); if (u.includes('bad') && fail) throw new Error('x'); return { src: u }; } });
|
||||
const progress = [];
|
||||
const r = await a.preload(['/a.png', '/bad.png', '/a.png', null, ''], (d, t) => progress.push([d, t]));
|
||||
assert.deepEqual(r, { ok: 1, failed: 1, total: 2 });
|
||||
@@ -513,6 +514,11 @@ describe('createAssets store', () => {
|
||||
assert.equal(loaded.filter((u) => u === '/a.png').length, 1, 'cached');
|
||||
assert.equal(a.imageNow('/a.png').src, '/a.png');
|
||||
assert.equal(await a.image(null), null);
|
||||
fail = false;
|
||||
assert.equal(await a.image('/bad.png'), null, 'ordinary consumers retain the remembered failure');
|
||||
assert.equal((await a.image('/bad.png', { retry: true })).src, '/bad.png');
|
||||
assert.equal(loaded.filter((u) => u === '/bad.png').length, 2, 'explicit board retry performs a new load');
|
||||
assert.equal((await a.image('/bad.png')).src, '/bad.png');
|
||||
});
|
||||
|
||||
test('spine acquire/release through the store with an injected loader', async () => {
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
buildBoard, classifyStage, heightOf, AREAS, areaFor, unionAreas, objToBoard, boxProjectUV, tube, Geom, uvAt, ROWS, COLS,
|
||||
} from '../../public/js/render/board3d/layout.js';
|
||||
import { BoardScene, gatePulse, DIR_TURNS, boxData, LIGHTING } from '../../public/js/render/board3d/scene.js';
|
||||
import { loadBoardPack, resetBoardPack, PACK_IMAGES } from '../../public/js/render/board3d/load.js';
|
||||
import { loadBoardPack, loadThree, resetBoardPack, PACK_IMAGES } from '../../public/js/render/board3d/load.js';
|
||||
import { parseStage } from '../../public/js/render/tiles.js';
|
||||
import { TILE_H } from '../../public/js/render/style.js';
|
||||
import { presetCamera, syncThreeCamera } from '../../public/js/render/projection.js';
|
||||
@@ -303,6 +303,30 @@ describe('BoardScene (three.js scene graph, stub renderer)', () => {
|
||||
});
|
||||
|
||||
describe('asset pack loader (fake store)', () => {
|
||||
test('resetBoardPack lets a later three.js import try again after three failures', async () => {
|
||||
resetBoardPack();
|
||||
const missing = new URL('./no-such-three.mjs', import.meta.url).href;
|
||||
for (let i = 0; i < 3; i++) assert.equal(await loadThree(missing), null);
|
||||
assert.equal(await loadThree(missing), null, 'three failures stop further imports');
|
||||
resetBoardPack();
|
||||
const mod = await loadThree(new URL('./fake-three.mjs', import.meta.url).href);
|
||||
assert.equal(typeof mod?.WebGLRenderer, 'function');
|
||||
resetBoardPack();
|
||||
});
|
||||
test('a transient diffuse-image failure is retried by the next mount instead of cached as permanent 2D', async () => {
|
||||
resetBoardPack();
|
||||
let calls = 0;
|
||||
const store = { local: async () => ({ groups: {} }), localUrl: (g, n) => n === 'TX_autochessi_D' ? '/test/atlas.png' : null,
|
||||
image: async () => ++calls === 1 ? null : { width: 8, height: 8 } };
|
||||
const original = globalThis.fetch;
|
||||
globalThis.fetch = async () => ({ ok: false });
|
||||
try {
|
||||
assert.equal(await loadBoardPack(store), null);
|
||||
const pack = await loadBoardPack(store);
|
||||
assert.ok(pack?.images.D); assert.equal(calls, 2);
|
||||
assert.equal(await loadBoardPack(store), pack, 'successful pack remains shared');
|
||||
} finally { globalThis.fetch = original; resetBoardPack(); }
|
||||
});
|
||||
test('loads images through the store and meshes through fetch; null without the diffuse atlas', async () => {
|
||||
resetBoardPack();
|
||||
const manifest = { groups: {} };
|
||||
|
||||
@@ -73,6 +73,85 @@ describe('render engine in headless Chrome', { skip }, () => {
|
||||
});
|
||||
}
|
||||
|
||||
test('Swire coins from a real snapshot remain separate from the elemental gauge', async () => {
|
||||
const { makeBattle } = await import('../helpers/battleHarness.js');
|
||||
const h = makeBattle({ autoFinish: false, units: [{ uid: 1, chessId: 'chess_char_3_04_a', row: 10, col: 4, skillIndex: 1 }] });
|
||||
h.step(); const u = h.unit(1); u.mem.coins = 1;
|
||||
h.b.dealDamage(null, u, { type: 'element', element: 'burn', amount: 300 });
|
||||
const { page, problems } = await open('scene=prep&panel=0', 1600, 900);
|
||||
try {
|
||||
await page.evaluate(({ meta, snap }) => {
|
||||
window.__demo.pause(); const v = window.__demo.view;
|
||||
v.enterBattle(meta); v.pushSnapshot(snap);
|
||||
}, { meta: h.b.fieldMeta(), snap: h.b.snapshot() });
|
||||
await page.waitForFunction(id => window.__demo.view.debug.views.get(id)?.coinHud?.root.visible, {}, u.id);
|
||||
const bounds = await page.evaluate(id => {
|
||||
const v = window.__demo.view.debug.views.get(id), coins = v.coinHud.root.getBounds(), elem = v._elBar.root.getBounds();
|
||||
return { label: v.coinHud.text.text, coinBottom: coins.bottom, elementTop: elem.top };
|
||||
}, u.id);
|
||||
assert.equal(bounds.label, `1/${u.skill.bb.sp}`);
|
||||
assert.ok(bounds.coinBottom <= bounds.elementTop, JSON.stringify(bounds));
|
||||
await page.screenshot({ path: path.join(OUT, 'swire-coins-element.png') });
|
||||
assert.deepEqual(problems, []);
|
||||
} finally { await page.close(); }
|
||||
});
|
||||
|
||||
test('外勤医疗 reserve medic is visible but not draggable in normal and right boss preparation', async () => {
|
||||
const { page, problems } = await open('scene=prep&panel=0', 1600, 900);
|
||||
const first = await page.evaluate(() => {
|
||||
const v = window.__demo.view;
|
||||
const st = JSON.parse(JSON.stringify(window.__demo.scene.state));
|
||||
st.prepMapChars = [{ id: -1, uid: -1, kind: 'token', side: 'ally', ownerId: 'p_0',
|
||||
defId: 'char_605_cmedic', name: '预备干员-医疗', spine: 'char_605_cmedic', avatar: 'char_605_cmedic',
|
||||
area: 'board', x: 2, y: 10, dir: 'RIGHT', facing: 1, maxHp: 1202 }];
|
||||
window.__touchPrepChar = st.prepMapChars[0];
|
||||
v.setPrep(st, { editable: true });
|
||||
const medic = v.debug.views.get('m:-1');
|
||||
const p = v.tileScreen(10, 2), rect = v.debug.app.view.getBoundingClientRect();
|
||||
const out = { exists: !!medic, id: medic?.info.defId, x: medic?.x, y: medic?.y,
|
||||
draggable: !!v.debug.pick.pieceAt(p.x - rect.left, p.y - rect.top) };
|
||||
return out;
|
||||
});
|
||||
await wait(500);
|
||||
await page.screenshot({ path: path.join(OUT, 'touch-prep-normal.png') });
|
||||
const boss = await page.evaluate(() => {
|
||||
const v = window.__demo.view;
|
||||
v.setCamera('bossPrep', { side: 'R', instant: true });
|
||||
const mirrored = v.debug.views.get('m:-1');
|
||||
return [mirrored?.x, mirrored?.y, mirrored?.dir];
|
||||
});
|
||||
await wait(500);
|
||||
await page.screenshot({ path: path.join(OUT, 'touch-prep-boss-right.png') });
|
||||
const removed = await page.evaluate(() => {
|
||||
const v = window.__demo.view;
|
||||
const st = JSON.parse(JSON.stringify(window.__demo.scene.state));
|
||||
st.prepMapChars = [];
|
||||
v.setPrep(st, { editable: true });
|
||||
return !v.debug.views.has('m:-1');
|
||||
});
|
||||
const fallback = await page.evaluate(async () => {
|
||||
const { createFallbackView } = await import('/js/ui/fallbackField.js');
|
||||
const host = document.createElement('div');
|
||||
host.style.cssText = 'position:absolute;width:800px;height:600px';
|
||||
document.body.appendChild(host);
|
||||
const ff = createFallbackView(host, { data: { get: () => null, lookup: () => null } });
|
||||
ff.setPrep({ board: [], hand: [], temp: [], prepMapChars: [window.__touchPrepChar] }, { editable: true });
|
||||
await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve)));
|
||||
const el = host.querySelector('.ff-piece--map-char');
|
||||
const out = { exists: !!el, name: el?.title, pointerEvents: el ? getComputedStyle(el).pointerEvents : null,
|
||||
movableId: el?.dataset.uid ?? null };
|
||||
ff.destroy(); host.remove();
|
||||
return out;
|
||||
});
|
||||
await page.close();
|
||||
assert.deepEqual(problems, []);
|
||||
assert.deepEqual(first, { exists: true, id: 'char_605_cmedic', x: 2, y: 10,
|
||||
draggable: false });
|
||||
assert.deepEqual(boss, [18, 3, 'LEFT']);
|
||||
assert.equal(removed, true);
|
||||
assert.deepEqual(fallback, { exists: true, name: '预备干员-医疗', pointerEvents: 'none', movableId: null });
|
||||
});
|
||||
|
||||
test('fx gallery: every sim fx kind, projectile and status renders without errors; board art in use', async () => {
|
||||
const { page, problems } = await open('scene=fx&panel=0', 1280, 720);
|
||||
// cycle through the whole FX_KINDS table (one kind every 0.5 game s = 0.25 real s), watching the FX system: shots
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export function WebGLRenderer() {}
|
||||
@@ -30,6 +30,35 @@ const tuple = (id, hp = 1000, extra = {}) => [id, 5, 10, hp, 1000, extra.sp ?? 0
|
||||
const view = (info = {}, extra = {}) => new UnitView(fakeViewCtx(fake.P, { cam, ...extra }),
|
||||
{ id: 1, side: 'ally', kind: 'op', defId: 'char_x', tier: 3, x: 5, y: 10, maxHp: 1000, dir: 'RIGHT', ...info });
|
||||
const sample = (o = {}) => ({ x: 5, y: 10, hp: 1000, maxHp: 1000, sp: 0, spMax: 0, flags: 0, anim: 0, vx: 0, vy: 0, ...o });
|
||||
|
||||
test('Swire purse snapshots include zero and the selected skill cap; death removes the readout', () => {
|
||||
for (const skillIndex of [0, 1, 2]) {
|
||||
const h = makeBattle({ autoFinish: false, units: [{ uid: 1, chessId: 'chess_char_3_04_a', row: 10, col: 4, skillIndex }] });
|
||||
h.b.start(); const u = h.unit(1); const cap = u.skill.bb.sp;
|
||||
assert.deepEqual(h.b.snapshot().coins, [[u.id, u.mem.coins, cap]]);
|
||||
u.mem.coins = 0; assert.deepEqual(h.b.snapshot().coins, [[u.id, 0, cap]]);
|
||||
h.b.retreat(u, { reason: 'test' }); assert.equal(h.b.snapshot().coins, undefined);
|
||||
}
|
||||
});
|
||||
|
||||
test('coin balance is snapshot-owned: preserves zero, rejects malformed entries and clears when absent', () => {
|
||||
const first = normalizeSnapshot({ t: 0, units: [tuple(1)], coins: [[1, 0, 10], [2, 3, 10], [1, -1, 10], [1, 3.5, 10]] });
|
||||
assert.deepEqual([...first.coins], [[1, [0, 10]]]);
|
||||
const b = new SnapshotBuffer();
|
||||
b.push({ t: 0, units: [tuple(1)], coins: [[1, 3, 10]] });
|
||||
b.push({ t: 1, units: [tuple(1)] });
|
||||
assert.deepEqual(b.sample(0).get(1).coins, [3, 10]);
|
||||
assert.equal(b.sample(1).get(1).coins, null);
|
||||
});
|
||||
|
||||
test('the coin HUD shows balance/cap and does not leave a stale label when its snapshot entry disappears', () => {
|
||||
const v = view();
|
||||
try {
|
||||
v.sync(sample({ coins: [0, 10] }), 0); v.update(0.02, cam(), 0);
|
||||
assert.equal(v.coinHud?.text.text, '0/10'); assert.equal(v.coinHud.root.visible, true);
|
||||
v.sync(sample(), 1); v.update(0.02, cam(), 1); assert.equal(v.coinHud.root.visible, false);
|
||||
} finally { v.destroy(); }
|
||||
});
|
||||
const frames = (v, n = 2) => { for (let i = 0; i < n; i++) v.update(1 / 60, cam(), i / 60); };
|
||||
const barWidth = (v) => v.hpBg.width - 2;
|
||||
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
import { test, describe, before, after } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { existsSync, mkdirSync } from 'node:fs';
|
||||
|
||||
const CHROME = process.env.CHROME_PATH || '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
|
||||
const enabled = process.env.RENDER_E2E === '1' && existsSync(CHROME);
|
||||
const art = existsSync(new URL('../../public/assets/local/map/autochess/TX_autochessi_D.png', import.meta.url));
|
||||
describe('renderer recovery after transient resource failures', { skip: !enabled }, () => {
|
||||
let srv, browser, serverRun = false;
|
||||
before(async () => {
|
||||
const { startServer } = await import('../../server/index.js');
|
||||
const { Match } = await import('../../server/match/Match.js');
|
||||
class RecoveryMatch extends Match { constructor(opts) { super({ ...opts, clientCombat: !serverRun }); } }
|
||||
srv = await startServer({ port: 0, host: '127.0.0.1', quiet: true, MatchClass: RecoveryMatch, seedFn: () => 123 });
|
||||
const P = (await import('puppeteer-core')).default;
|
||||
browser = await P.launch({ executablePath: CHROME, headless: true,
|
||||
args: ['--no-first-run', '--use-angle=metal', '--enable-gpu', '--ignore-gpu-blocklist'] });
|
||||
mkdirSync(new URL('../e2e/out/', import.meta.url), { recursive: true });
|
||||
});
|
||||
after(async () => { await browser?.close(); await srv?.close(); });
|
||||
|
||||
for (const streamed of [false, true]) test(`a live ${streamed ? 'server' : 'local'} battle survives renderer replacement with current enemy metadata`, { timeout: 45000 }, async () => {
|
||||
serverRun = streamed;
|
||||
const context = await browser.createBrowserContext(), page = await context.newPage(); let failing = true;
|
||||
try {
|
||||
await page.setRequestInterception(true);
|
||||
page.on('request', req => {
|
||||
if (failing && new URL(req.url()).pathname === '/vendor/pixi.min.js') void req.abort('failed'); else void req.continue();
|
||||
});
|
||||
await page.evaluateOnNewDocument(() => { localStorage.setItem('sp.name', 'Recovery'); sessionStorage.setItem('sp.entered', '1'); });
|
||||
await page.goto(`http://127.0.0.1:${srv.port}/?board=2d`);
|
||||
await page.waitForFunction(() => window.__SP__?.store.get().connection.status === 'online');
|
||||
const send = (type, args = {}) => page.evaluate(async (t, a) => (await import('/js/net.js')).net.request(t, a), type, args);
|
||||
await send('room.create', { mode: 'solo', difficulty: 'FUNNY' }); await send('room.start');
|
||||
await page.waitForFunction(() => window.__SP__.store.get().match.public?.phase === 'INFO_CHECK');
|
||||
await send('g.infoReady', { setupRevision: 0 });
|
||||
await page.waitForFunction(() => window.__SP__.store.get().match.public?.phase === 'BAND_DRAFT');
|
||||
await send('g.band', { bandId: 'band_bldsk' });
|
||||
await page.waitForFunction(() => window.__SP__.store.get().match.public?.phase === 'PREP');
|
||||
await page.waitForFunction(() => window.__SP_VIEW__?.kind === 'fallback');
|
||||
await send('g.ready', { ready: true });
|
||||
await page.waitForSelector('.ff-unit.is-enemy:not(.ff-pen__enemy)');
|
||||
const code = await page.evaluate(() => window.__SP__.store.get().room.code);
|
||||
const match = srv.lobby.rooms.get(code).match;
|
||||
const serverBattle = streamed ? match.fields[0].battle : null;
|
||||
const serverTime = serverBattle?.time;
|
||||
const enemies = streamed ? match.fields[0].battle.enemies.filter(e => e.alive).map(e => [e.id, e.defId])
|
||||
: await page.evaluate(async () => {
|
||||
const runner = (await import('/js/battle/runner.js')).battleRunner;
|
||||
const entry = [...runner._entries.values()].find(e => e.battle && !e.done);
|
||||
window.__originalBattle = entry.battle; window.__originalTime = entry.battle.time;
|
||||
return entry.battle.enemies.filter(e => e.alive).map(e => [e.id, e.defId]);
|
||||
});
|
||||
assert.ok(enemies.length > 0, 'enemies spawned after the original field metadata');
|
||||
failing = false; await page.evaluate(() => window.dispatchEvent(new Event('online')));
|
||||
await page.waitForFunction(() => window.__SP_VIEW__?.kind === 'engine', { timeout: 15000 });
|
||||
await page.waitForFunction(([id, defId]) => {
|
||||
const v = window.__SP_VIEW__.raw;
|
||||
return v.stats().mode === 'battle' && v.debug.views.get(id)?.info.defId === defId;
|
||||
}, { timeout: 7000 }, enemies[0]);
|
||||
assert.equal(srv.lobby.rooms.get(code).match, match, 'renderer recovery never restarts the match');
|
||||
if (streamed) {
|
||||
assert.equal(match.fields[0].battle, serverBattle); assert.ok(serverBattle.time >= serverTime);
|
||||
} else {
|
||||
assert.equal(await page.evaluate(async () => {
|
||||
const runner = (await import('/js/battle/runner.js')).battleRunner;
|
||||
return [...runner._entries.values()].some(e => e.battle === window.__originalBattle && e.battle.time >= window.__originalTime);
|
||||
}), true, 'the same local simulation continues from its current clock');
|
||||
}
|
||||
await send('g.leave');
|
||||
} finally { await context.close(); }
|
||||
});
|
||||
|
||||
for (const forced of [false, true]) test(`field hook retries a failed Pixi download; forced fallback=${forced}`, async () => {
|
||||
const page = await browser.newPage(); let pixiRequests = 0, failing = true;
|
||||
try {
|
||||
await page.setRequestInterception(true);
|
||||
page.on('request', req => {
|
||||
const pixi = new URL(req.url()).pathname === '/vendor/pixi.min.js';
|
||||
if (pixi) pixiRequests++;
|
||||
if (pixi && failing) void req.abort('failed'); else void req.continue();
|
||||
});
|
||||
await page.goto(`http://127.0.0.1:${srv.port}/?${forced ? 'render=fallback&' : ''}board=2d`);
|
||||
await page.evaluate(async () => {
|
||||
const { render, h } = await import('/vendor/preact.module.js');
|
||||
const { useRef, useEffect } = await import('/vendor/hooks.module.js');
|
||||
const { useFieldView } = await import('/js/ui/fieldHost.js');
|
||||
const { data } = await import('/js/data.js');
|
||||
await data.loadAll('stages', 'chess', 'assets', 'local');
|
||||
function Harness() {
|
||||
const host = useRef(null), state = useFieldView(host);
|
||||
useEffect(() => {
|
||||
if (!state.view) return;
|
||||
state.view.setStage(data.lookup('stages', 'act2autochess_m01'));
|
||||
state.view.setPrep({ playerId: 'p', board: [], hand: [] });
|
||||
}, [state.view]);
|
||||
return h('div', { ref: host, id: 'recovery-host', style: 'width:100vw;height:100vh' });
|
||||
}
|
||||
render(h(Harness), document.getElementById('app'));
|
||||
window.__unmount = () => render(null, document.getElementById('app'));
|
||||
});
|
||||
await page.waitForFunction(() => window.__SP_VIEW__?.kind === 'fallback');
|
||||
const before = pixiRequests; failing = false;
|
||||
await page.evaluate(() => {
|
||||
window.__firstView = window.__SP_VIEW__;
|
||||
for (let i = 0; i < 5; i++) window.dispatchEvent(new Event('online'));
|
||||
});
|
||||
if (forced) {
|
||||
assert.equal(await page.evaluate(() => window.__SP_VIEW__ === window.__firstView), true);
|
||||
assert.equal(pixiRequests, before, 'explicit fallback never requests an engine retry');
|
||||
} else {
|
||||
await page.waitForFunction(() => window.__SP_VIEW__?.kind === 'engine', { timeout: 20000 });
|
||||
assert.equal(pixiRequests, before + 1, 'one successful retry after the failed prefetch and initialization');
|
||||
const result = await page.evaluate(() => {
|
||||
const view = window.__SP_VIEW__;
|
||||
for (let i = 0; i < 5; i++) document.dispatchEvent(new Event('visibilitychange'));
|
||||
return { same: view === window.__SP_VIEW__, canvases: document.querySelectorAll('#recovery-host canvas').length,
|
||||
field: view.raw.stats().mode };
|
||||
});
|
||||
assert.deepEqual(result, { same: true, canvases: 1, field: 'prep' });
|
||||
}
|
||||
await page.evaluate(() => window.__unmount());
|
||||
assert.equal(await page.evaluate(() => window.__SP_VIEW__), null, 'unmount releases the recovery view');
|
||||
} finally { await page.close(); }
|
||||
});
|
||||
|
||||
for (const resource of ['atlas', 'three']) test(`${resource} download can recover the 3D board on visibility`, { skip: !art }, async () => {
|
||||
const page = await browser.newPage(); let failing = true, requests = 0;
|
||||
try {
|
||||
await page.setRequestInterception(true);
|
||||
page.on('request', req => {
|
||||
const p = new URL(req.url()).pathname;
|
||||
const selected = resource === 'atlas' ? /\/TX_autochessi_D\.(?:png|webp)$/.test(p) : p === '/vendor/three.module.js';
|
||||
if (selected) requests++;
|
||||
if (selected && failing) void req.abort('failed'); else void req.continue();
|
||||
});
|
||||
await page.setViewport({ width: 1280, height: 720 });
|
||||
await page.goto(`http://127.0.0.1:${srv.port}/dev/render-demo.html?scene=prep&stage=act2autochess_m01&board=3d&panel=0`);
|
||||
await page.waitForFunction(() => window.__demo?.ready, { timeout: 30000 });
|
||||
assert.equal(await page.evaluate(() => window.__demo.stats().board3d.on), false);
|
||||
const before = requests; failing = false;
|
||||
await page.evaluate(() => document.dispatchEvent(new Event('visibilitychange')));
|
||||
await page.waitForFunction(() => window.__demo.stats().board3d.on, { timeout: 15000 });
|
||||
assert.ok(requests > before, 'the failed resource is actually requested again');
|
||||
assert.equal(await page.evaluate(() => window.__demo.view.debug.app.view.parentNode.querySelectorAll('canvas').length), 2);
|
||||
await page.screenshot({ path: new URL(`../e2e/out/recovery-${resource}.png`, import.meta.url).pathname });
|
||||
} finally { await page.close(); }
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
// test/render/token-models.browser.test.js — the 39 summon models only the local client has (tools/local-extract/
|
||||
// test/render/token-models.browser.test.js — the 40 original summon models extracted from the local client (tools/local-extract/
|
||||
// extract.py TOKEN_SPINES → data/assets.json tokens[id].spineLocal, docs/ASSETS.md "Token models from the local client")
|
||||
// drawn on the prep board of the dev render demo (public/dev/render-demo.html) in headless Chrome: every summon placed on
|
||||
// a board tile draws its official model (the local entry, not the avatar diamond), on its own idle clip (the mapped ones
|
||||
|
||||
Reference in new issue
Block a user