diff --git a/game-runtime/games/wanglanmei-ref/test/e2e-input.cdp.cjs b/game-runtime/games/wanglanmei-ref/test/e2e-input.cdp.cjs index fa432328..54dda993 100644 --- a/game-runtime/games/wanglanmei-ref/test/e2e-input.cdp.cjs +++ b/game-runtime/games/wanglanmei-ref/test/e2e-input.cdp.cjs @@ -64,13 +64,18 @@ async function connectRef(url) { }); try { await cdp.send('Emulation.setTouchEmulationEnabled', { enabled: true, maxTouchPoints: 1 }); } catch { /* 老版无此法可忽略 */ } await cdp.send('Page.navigate', { url }); - // 参考件 boot 含 13 图装载+2 首 mp3 解码,给 25s(host-dev 的 12s 不够裕量)。 + await waitRefBoot(cdp); + return cdp; +} + +/** 等参考件引导完成(__refBooted/__refHost;boot 含 13 图装载+2 首 mp3 解码,给 25s 裕量)。 */ +async function waitRefBoot(session) { const deadline = Date.now() + 25000; await delay(900); for (;;) { - const st = await cdp.evaluate('({ b: !!window.__refBooted, e: window.__refBootError || null, h: !!window.__refHost })'); + const st = await session.evaluate('({ b: !!window.__refBooted, e: window.__refBootError || null, h: !!window.__refHost })'); if (st && st.e) throw new Error('参考件引导失败:' + st.e); - if (st && st.b && st.h) return cdp; + if (st && st.b && st.h) return; if (Date.now() > deadline) throw new Error('等 __refBooted 超时'); await delay(300); } @@ -296,6 +301,11 @@ async function shot(name, withHash) { /* 门 B 续:同参第二开,菜单帧哈希须一致(确定性) */ const cdp2 = await connectRef(URL_EVIDENCE); try { + // 双开一致须在同等存档态:首开=无存档首航;二开继承首航存档会在标题屏多画「继续」按钮 + // (computeZones hasSave 分支,run4/6 实翻 3fa1ff9a)——清档重载后再比。这是游戏正确行为,非缺陷。 + await cdp2.evaluate('(function(){ try { localStorage.clear(); } catch (e) {} return 1; })()'); + await cdp2.send('Page.navigate', { url: URL_EVIDENCE }); + await waitRefBoot(cdp2); await waitAssets(cdp2); // 与首开同口径:资产稳态后再截帧 await cdp2.evaluate(`(function(){ window.__refHost.stepFrames(5); return 1; })()`); const img2 = await H.captureImageData(cdp2, 'canvas');