diff --git a/scripts/verify-prologue-village-browser.mjs b/scripts/verify-prologue-village-browser.mjs index 8faec3a..ccb4518 100644 --- a/scripts/verify-prologue-village-browser.mjs +++ b/scripts/verify-prologue-village-browser.mjs @@ -41,7 +41,15 @@ try { await waitForTitle(page); await assertDesktopViewport(page); await verifyReducedMotionExploration(page); - await page.evaluate(() => window.localStorage.clear()); + await page.addInitScript(() => { + const marker = + 'heros-web:qa:prologue-village-clean-start'; + if (window.sessionStorage.getItem(marker) === '1') { + return; + } + window.localStorage.clear(); + window.sessionStorage.setItem(marker, '1'); + }); await page.reload({ waitUntil: 'domcontentloaded', timeout: 90000 }); await waitForDebugApi(page); await waitForTitle(page); @@ -505,6 +513,8 @@ try { 'Militia camp arrival must not retrigger dialogue on a later update.' ); await advanceMilitiaCampDialogueUntilClosed(page); + const campPlayerBeforeReload = + (await readMilitiaCamp(page)).player; await page.reload({ waitUntil: 'domcontentloaded', timeout: 90000 }); await waitForDebugApi(page); @@ -520,19 +530,38 @@ try { false, 'The pointer-route smoke reload must not replay the one-time camp introduction.' ); + assert( + Math.abs( + militiaCamp.player.x - campPlayerBeforeReload.x + ) <= 1 && + Math.abs( + militiaCamp.player.y - campPlayerBeforeReload.y + ) <= 1 && + militiaCamp.player.direction === + campPlayerBeforeReload.direction, + `The militia checkpoint must restore the exact player position and direction: ${JSON.stringify( + { + before: campPlayerBeforeReload, + after: militiaCamp.player + } + )}` + ); const campPlayerBeforeMove = militiaCamp.player; - await page.keyboard.down('ArrowUp'); - await page.waitForTimeout(360); - await page.keyboard.up('ArrowUp'); await page.keyboard.down('ArrowLeft'); - await page.waitForTimeout(980); + await page.waitForTimeout(800); + await page.keyboard.up('ArrowLeft'); + await page.keyboard.down('ArrowDown'); + await page.waitForTimeout(1100); + await page.keyboard.up('ArrowDown'); + await page.keyboard.down('ArrowLeft'); + await page.waitForTimeout(350); await page.keyboard.up('ArrowLeft'); await page.waitForTimeout(80); const campAfterMove = await readMilitiaCamp(page); assert( - campPlayerBeforeMove.y - campAfterMove.player.y >= 70 && - campPlayerBeforeMove.x - campAfterMove.player.x >= 220, + campAfterMove.player.y - campPlayerBeforeMove.y >= 270 && + campPlayerBeforeMove.x - campAfterMove.player.x >= 270, `Expected keyboard traversal through the militia camp: ${JSON.stringify({ before: campPlayerBeforeMove, after: campAfterMove.player