test(verify-play): gate 9 asserts session loss lands on bnet_login with the reason

This commit is contained in:
troytt 2026-10-01 12:11:27 +00:00
parent e623e992dc
commit aa6d109010
1 changed files with 9 additions and 3 deletions

View File

@ -17,7 +17,7 @@
* Gate 7. Dockable Packet Inspector live packet capture, filtering, row selection, and all 4 `.d2cap` fixtures * Gate 7. Dockable Packet Inspector live packet capture, filtering, row selection, and all 4 `.d2cap` fixtures
* replay with 0 `UnknownS2c` events * replay with 0 `UnknownS2c` events
* Gate 8. Server host validation (`bare_ip_on_https` rejection) & `localStorage` (`d2web.settings.v1`) persistence across `Page.reload` * 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' import { spawn } from 'node:child_process'
@ -1017,12 +1017,14 @@ async function main(): Promise<void> {
throw new Error(`Gate 8b failed: ${JSON.stringify(gate8b)}`) 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<{ const gate9 = await cdp.evaluate<{
phase: string phase: string
reason: string | null reason: string | null
overlayVisible: boolean overlayVisible: boolean
bannerVisible: boolean bannerVisible: boolean
stage: string
loginError: string | null
}>(`(async () => { }>(`(async () => {
const app = window.__d2Play; const app = window.__d2Play;
await app.simulateDisconnect('Test disconnect: connection reset by peer'); await app.simulateDisconnect('Test disconnect: connection reset by peer');
@ -1033,6 +1035,8 @@ async function main(): Promise<void> {
reason: app.session.disconnectReason, reason: app.session.disconnectReason,
overlayVisible: overlay ? overlay.style.display !== 'none' : false, overlayVisible: overlay ? overlay.style.display !== 'none' : false,
bannerVisible: banner ? !banner.hidden : false, bannerVisible: banner ? !banner.hidden : false,
stage: app.flowState.stage,
loginError: app.flowState.loginError,
}; };
})()`) })()`)
console.log('[verify-play] Gate 9 (Graceful disconnect recovery):', gate9) console.log('[verify-play] Gate 9 (Graceful disconnect recovery):', gate9)
@ -1040,7 +1044,9 @@ async function main(): Promise<void> {
gate9.phase !== 'disconnected' || gate9.phase !== 'disconnected' ||
!gate9.reason?.includes('Test disconnect') || !gate9.reason?.includes('Test disconnect') ||
!gate9.overlayVisible || !gate9.overlayVisible ||
!gate9.bannerVisible !gate9.bannerVisible ||
gate9.stage !== 'bnet_login' ||
!gate9.loginError?.includes('Test disconnect')
) { ) {
throw new Error(`Gate 9 failed: ${JSON.stringify(gate9)}`) throw new Error(`Gate 9 failed: ${JSON.stringify(gate9)}`)
} }