test: isolate disabled battle load fixture
This commit is contained in:
@@ -297,6 +297,21 @@ try {
|
|||||||
await waitForMapMenuVisibility(page, false);
|
await waitForMapMenuVisibility(page, false);
|
||||||
await page.waitForTimeout(80);
|
await page.waitForTimeout(80);
|
||||||
|
|
||||||
|
await page.evaluate(() => {
|
||||||
|
const battleId =
|
||||||
|
window.__HEROS_DEBUG__?.battle()?.battleId;
|
||||||
|
if (!battleId) {
|
||||||
|
throw new Error(
|
||||||
|
'Cannot prepare the unavailable-load keyboard fixture.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const baseKey = `heros-web:battle:${battleId}`;
|
||||||
|
window.localStorage.removeItem(`${baseKey}:slot-1`);
|
||||||
|
window.localStorage.removeItem(baseKey);
|
||||||
|
window.localStorage.removeItem(
|
||||||
|
'heros-web:first-battle-state'
|
||||||
|
);
|
||||||
|
});
|
||||||
await page.keyboard.press('KeyM');
|
await page.keyboard.press('KeyM');
|
||||||
await waitForMapMenuVisibility(page, true);
|
await waitForMapMenuVisibility(page, true);
|
||||||
state = await readBattleState(page);
|
state = await readBattleState(page);
|
||||||
@@ -1036,7 +1051,6 @@ function assertMapMenuFocus(keyboard, expectedId) {
|
|||||||
boundsInside(item.bounds, keyboard.bounds) &&
|
boundsInside(item.bounds, keyboard.bounds) &&
|
||||||
boundsInsideViewport(item.bounds)
|
boundsInsideViewport(item.bounds)
|
||||||
) &&
|
) &&
|
||||||
keyboard.items.some(({ available }) => available === false) &&
|
|
||||||
keyboard.focusedItem?.available === true &&
|
keyboard.focusedItem?.available === true &&
|
||||||
matchingItem?.focused === true &&
|
matchingItem?.focused === true &&
|
||||||
keyboard.items.filter(({ focused }) => focused).length === 1 &&
|
keyboard.items.filter(({ focused }) => focused).length === 1 &&
|
||||||
|
|||||||
Reference in New Issue
Block a user