test: tolerate low-fps WebGL combat presentation
This commit is contained in:
@@ -500,15 +500,68 @@ try {
|
|||||||
(unitId) => {
|
(unitId) => {
|
||||||
const battle = window.__HEROS_DEBUG__?.battle();
|
const battle = window.__HEROS_DEBUG__?.battle();
|
||||||
return (
|
return (
|
||||||
battle?.actedUnitIds?.includes(unitId) &&
|
battle?.firstBattleTutorial?.active === false &&
|
||||||
|
battle.firstBattleTutorial.completion === 'completed' &&
|
||||||
battle.commandMenuKeyboard?.visible === false &&
|
battle.commandMenuKeyboard?.visible === false &&
|
||||||
battle.firstBattleTutorial?.active === false &&
|
(
|
||||||
battle.firstBattleTutorial.completion === 'completed'
|
battle.phase === 'animating' ||
|
||||||
|
battle.actedUnitIds?.includes(unitId)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
tutorialPath.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 completed = await page.evaluate((unitId) => {
|
||||||
const state = window.__HEROS_DEBUG__?.battle();
|
const state = window.__HEROS_DEBUG__?.battle();
|
||||||
|
|||||||
Reference in New Issue
Block a user