From aa6d109010ea6b69467f4de230c18f466cda7c0a Mon Sep 17 00:00:00 2001 From: troytt <47798984@qq.com> Date: Thu, 1 Oct 2026 12:11:27 +0000 Subject: [PATCH] test(verify-play): gate 9 asserts session loss lands on bnet_login with the reason --- tools/verify-play.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/verify-play.ts b/tools/verify-play.ts index 6931c0d..313488d 100644 --- a/tools/verify-play.ts +++ b/tools/verify-play.ts @@ -17,7 +17,7 @@ * Gate 7. Dockable Packet Inspector live packet capture, filtering, row selection, and all 4 `.d2cap` fixtures * replay with 0 `UnknownS2c` events * Gate 8. Server host validation (`bare_ip_on_https` rejection) & `localStorage` (`d2web.settings.v1`) persistence across `Page.reload` - * Gate 9. Graceful disconnect recovery to Battle.net lobby overlay with disconnect reason banner, 0 console/page errors. + * Gate 9. Session loss returns to the Battle.net login screen with the reason (loginError + banner), 0 console/page errors. */ import { spawn } from 'node:child_process' @@ -1017,12 +1017,14 @@ async function main(): Promise { throw new Error(`Gate 8b failed: ${JSON.stringify(gate8b)}`) } - // ─── Gate 9: Graceful Disconnect Recovery to Battle.net Lobby Overlay ── + // ─── Gate 9: Session Loss Returns to the Battle.net Login Screen With Reason ── const gate9 = await cdp.evaluate<{ phase: string reason: string | null overlayVisible: boolean bannerVisible: boolean + stage: string + loginError: string | null }>(`(async () => { const app = window.__d2Play; await app.simulateDisconnect('Test disconnect: connection reset by peer'); @@ -1033,6 +1035,8 @@ async function main(): Promise { reason: app.session.disconnectReason, overlayVisible: overlay ? overlay.style.display !== 'none' : false, bannerVisible: banner ? !banner.hidden : false, + stage: app.flowState.stage, + loginError: app.flowState.loginError, }; })()`) console.log('[verify-play] Gate 9 (Graceful disconnect recovery):', gate9) @@ -1040,7 +1044,9 @@ async function main(): Promise { gate9.phase !== 'disconnected' || !gate9.reason?.includes('Test disconnect') || !gate9.overlayVisible || - !gate9.bannerVisible + !gate9.bannerVisible || + gate9.stage !== 'bnet_login' || + !gate9.loginError?.includes('Test disconnect') ) { throw new Error(`Gate 9 failed: ${JSON.stringify(gate9)}`) }