test: use live new-game bounds in release flow
This commit is contained in:
@@ -73,6 +73,47 @@ async function clickSceneBounds(page, sceneKey, bounds) {
|
||||
await page.mouse.click(point.x, point.y);
|
||||
}
|
||||
|
||||
async function clickTitleNewGame(page) {
|
||||
const newGameItem = await page.evaluate(() => {
|
||||
const state =
|
||||
window.__HEROS_DEBUG__
|
||||
?.scene('TitleScene')
|
||||
?.getDebugState?.();
|
||||
return (
|
||||
state?.focus?.scope === 'main'
|
||||
? state.focus.items.find(
|
||||
(item) =>
|
||||
item.id === 'new-game' &&
|
||||
item.enabled === true
|
||||
)
|
||||
: undefined
|
||||
) ?? null;
|
||||
});
|
||||
assert(
|
||||
newGameItem?.bounds,
|
||||
`Expected an enabled title new-game control: ${JSON.stringify(
|
||||
newGameItem
|
||||
)}`
|
||||
);
|
||||
await clickSceneBounds(
|
||||
page,
|
||||
'TitleScene',
|
||||
newGameItem.bounds
|
||||
);
|
||||
await page.waitForFunction(() => {
|
||||
const activeScenes =
|
||||
window.__HEROS_DEBUG__?.activeScenes() ?? [];
|
||||
const state =
|
||||
window.__HEROS_DEBUG__
|
||||
?.scene('TitleScene')
|
||||
?.getDebugState?.();
|
||||
return (
|
||||
state?.navigating === true ||
|
||||
activeScenes.includes('StoryScene')
|
||||
);
|
||||
}, undefined, { timeout: 10000 });
|
||||
}
|
||||
|
||||
async function clickTitleContinue(page, slot = 1) {
|
||||
const continueItem = await page.evaluate(() => {
|
||||
const state =
|
||||
@@ -253,7 +294,7 @@ try {
|
||||
assert(!emptySave.current && !emptySave.slot1, `Expected first run without campaign save: ${JSON.stringify(emptySave)}`);
|
||||
|
||||
const freshStoryRequestStartIndex = requestedResourceUrls.length;
|
||||
await clickLegacyUi(page, 962, 240);
|
||||
await clickTitleNewGame(page);
|
||||
await waitForStoryReady(page);
|
||||
await setDebugQueryParam(page, 'debugOrderCommandReady', '1');
|
||||
const initialStoryProgress = await page.evaluate(() => window.__HEROS_DEBUG__?.scene('StoryScene')?.getDebugState?.());
|
||||
|
||||
Reference in New Issue
Block a user