From 5f99f7d62833d0ece2a3709109202f32a669b700 Mon Sep 17 00:00:00 2001 From: Wickedness Date: Wed, 29 Jul 2026 09:21:40 +0900 Subject: [PATCH] test: tolerate low-fps WebGL combat presentation --- ...y-battle-keyboard-command-flow-browser.mjs | 61 +++++++++++++++++-- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/scripts/verify-battle-keyboard-command-flow-browser.mjs b/scripts/verify-battle-keyboard-command-flow-browser.mjs index b5dab3b..46fba6d 100644 --- a/scripts/verify-battle-keyboard-command-flow-browser.mjs +++ b/scripts/verify-battle-keyboard-command-flow-browser.mjs @@ -500,15 +500,68 @@ try { (unitId) => { const battle = window.__HEROS_DEBUG__?.battle(); return ( - battle?.actedUnitIds?.includes(unitId) && + battle?.firstBattleTutorial?.active === false && + battle.firstBattleTutorial.completion === 'completed' && battle.commandMenuKeyboard?.visible === false && - battle.firstBattleTutorial?.active === false && - battle.firstBattleTutorial.completion === 'completed' + ( + battle.phase === 'animating' || + battle.actedUnitIds?.includes(unitId) + ) ); }, tutorialPath.unitId, - { timeout: 30000 } + { timeout: 10000 } ); + try { + await page.waitForFunction( + (unitId) => { + const battle = window.__HEROS_DEBUG__?.battle(); + return ( + battle?.actedUnitIds?.includes(unitId) && + battle.commandMenuKeyboard?.visible === false && + battle.firstBattleTutorial?.active === false && + battle.firstBattleTutorial.completion === 'completed' + ); + }, + tutorialPath.unitId, + { timeout: 90000 } + ); + } catch (error) { + const diagnostic = await page.evaluate((unitId) => { + const battle = window.__HEROS_DEBUG__?.battle(); + const qa = window.__HEROS_KEYBOARD_COMMAND_QA__; + return { + expectedUnitId: unitId, + activeScenes: + window.__HEROS_DEBUG__?.activeScenes?.() ?? [], + phase: battle?.phase ?? null, + selectedUnitId: battle?.selectedUnitId ?? null, + actedUnitIds: battle?.actedUnitIds ?? [], + commandMenuKeyboard: + battle?.commandMenuKeyboard ?? null, + tutorial: + battle?.firstBattleTutorial ?? null, + lockedTargetPreview: + battle?.lockedTargetPreview ?? null, + combatExchangePreview: + battle?.combatExchangePreview ?? null, + pendingBattleEvents: + battle?.eventPresentation ?? null, + keyboardInputs: + qa?.keyboardInputs?.slice(-12) ?? [] + }; + }, tutorialPath.unitId); + await page + .screenshot({ + path: `dist/verification-battle-keyboard-attack-timeout-${renderer}.png`, + fullPage: true + }) + .catch(() => {}); + throw new Error( + `Timed out after confirming the tutorial attack: ${JSON.stringify(diagnostic)}`, + { cause: error } + ); + } const completed = await page.evaluate((unitId) => { const state = window.__HEROS_DEBUG__?.battle();