From 57ca3fb27fd2495a5ba67e0741aa42a29606eaa0 Mon Sep 17 00:00:00 2001 From: zizi Date: Fri, 12 Jun 2026 14:46:13 +0000 Subject: [PATCH] =?UTF-8?q?fix(wanglanmei-ref):=20e2e=E5=8F=8C=E5=BC=80?= =?UTF-8?q?=E4=B8=80=E8=87=B4=E6=80=A7=E6=94=B9=E5=90=8C=E5=AD=98=E6=A1=A3?= =?UTF-8?q?=E6=80=81=E5=AF=B9=E6=AF=94=E2=80=94=E2=80=94=E4=BA=8C=E5=BC=80?= =?UTF-8?q?=E7=BB=A7=E6=89=BF=E9=A6=96=E8=88=AA=E5=AD=98=E6=A1=A3=E5=A4=9A?= =?UTF-8?q?=E7=94=BB=E7=BB=A7=E7=BB=AD=E6=8C=89=E9=92=AE=E8=87=B4=E5=93=88?= =?UTF-8?q?=E5=B8=8C=E5=BC=82(=E6=AD=A3=E7=A1=AE=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA=E9=9D=9E=E7=BC=BA=E9=99=B7),=E6=B8=85?= =?UTF-8?q?=E6=A1=A3=E9=87=8D=E8=BD=BD=E5=90=8E=E5=86=8D=E6=AF=94;waitRefB?= =?UTF-8?q?oot=E6=8A=BD=E5=85=AC=E5=85=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- .../games/wanglanmei-ref/test/e2e-input.cdp.cjs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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');