test: follow current title navigation in prologue QA
This commit is contained in:
@@ -55,7 +55,7 @@ try {
|
||||
await waitForTitle(page);
|
||||
await assertDesktopViewport(page);
|
||||
|
||||
await clickLegacyTitleControl(page, 962, 240);
|
||||
await activateTitleControl(page, 'new-game');
|
||||
await waitForStoryReady(page);
|
||||
const opening = await readStory(page);
|
||||
assert.equal(opening.totalPages, 2, 'The playable prologue should retain only the two setup pages before control is handed over.');
|
||||
@@ -259,7 +259,7 @@ try {
|
||||
await page.reload({ waitUntil: 'domcontentloaded', timeout: 90000 });
|
||||
await waitForDebugApi(page);
|
||||
await page.waitForFunction(() => window.__HEROS_DEBUG__?.activeScenes?.().includes('TitleScene'));
|
||||
await clickLegacyTitleControl(page, 962, 310);
|
||||
await activateTitleControl(page, 'continue');
|
||||
await waitForVillageReady(page);
|
||||
await page.waitForTimeout(380);
|
||||
village = await readVillage(page);
|
||||
@@ -521,7 +521,7 @@ try {
|
||||
await page.waitForFunction(() =>
|
||||
window.__HEROS_DEBUG__?.activeScenes?.().includes('TitleScene')
|
||||
);
|
||||
await clickLegacyTitleControl(page, 962, 310);
|
||||
await activateTitleControl(page, 'continue');
|
||||
await waitForMilitiaCampReady(page);
|
||||
await page.waitForTimeout(380);
|
||||
militiaCamp = await readMilitiaCamp(page);
|
||||
@@ -668,7 +668,7 @@ try {
|
||||
await page.reload({ waitUntil: 'domcontentloaded', timeout: 90000 });
|
||||
await waitForDebugApi(page);
|
||||
await page.waitForFunction(() => window.__HEROS_DEBUG__?.activeScenes?.().includes('TitleScene'));
|
||||
await clickLegacyTitleControl(page, 962, 310);
|
||||
await activateTitleControl(page, 'continue');
|
||||
await waitForMilitiaCampReady(page);
|
||||
await page.waitForTimeout(380);
|
||||
militiaCamp = await readMilitiaCamp(page);
|
||||
@@ -1030,7 +1030,7 @@ try {
|
||||
await page.reload({ waitUntil: 'domcontentloaded', timeout: 90000 });
|
||||
await waitForDebugApi(page);
|
||||
await page.waitForFunction(() => window.__HEROS_DEBUG__?.activeScenes?.().includes('TitleScene'));
|
||||
await clickLegacyTitleControl(page, 962, 310);
|
||||
await activateTitleControl(page, 'continue');
|
||||
await waitForStoryReady(page);
|
||||
const legacyBridge = await readStory(page);
|
||||
assert.equal(legacyBridge.currentPageId, 'militia-rises');
|
||||
@@ -1136,8 +1136,15 @@ async function waitForTitle(page) {
|
||||
});
|
||||
}
|
||||
|
||||
async function clickLegacyTitleControl(page, x, y) {
|
||||
await page.mouse.click(x * 1.5, y * 1.5);
|
||||
async function activateTitleControl(page, itemId) {
|
||||
await page.waitForFunction((expectedItemId) => {
|
||||
const title = window.__HEROS_DEBUG__?.title?.();
|
||||
return (
|
||||
title?.focus?.scope === 'main' &&
|
||||
title.focus.itemId === expectedItemId
|
||||
);
|
||||
}, itemId, { timeout: 30000 });
|
||||
await page.keyboard.press('Enter');
|
||||
}
|
||||
|
||||
async function waitForStoryReady(page) {
|
||||
@@ -1149,6 +1156,7 @@ async function waitForStoryReady(page) {
|
||||
} catch (error) {
|
||||
const diagnostic = await page.evaluate(() => ({
|
||||
activeScenes: window.__HEROS_DEBUG__?.activeScenes?.() ?? [],
|
||||
title: window.__HEROS_DEBUG__?.title?.() ?? null,
|
||||
story: window.__HEROS_DEBUG__?.scene('StoryScene')?.getDebugState?.() ?? null,
|
||||
militiaCamp: window.__HEROS_DEBUG__?.militiaCamp?.() ?? null
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user