test: follow current title navigation in prologue QA
This commit is contained in:
@@ -55,7 +55,7 @@ try {
|
|||||||
await waitForTitle(page);
|
await waitForTitle(page);
|
||||||
await assertDesktopViewport(page);
|
await assertDesktopViewport(page);
|
||||||
|
|
||||||
await clickLegacyTitleControl(page, 962, 240);
|
await activateTitleControl(page, 'new-game');
|
||||||
await waitForStoryReady(page);
|
await waitForStoryReady(page);
|
||||||
const opening = await readStory(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.');
|
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 page.reload({ waitUntil: 'domcontentloaded', timeout: 90000 });
|
||||||
await waitForDebugApi(page);
|
await waitForDebugApi(page);
|
||||||
await page.waitForFunction(() => window.__HEROS_DEBUG__?.activeScenes?.().includes('TitleScene'));
|
await page.waitForFunction(() => window.__HEROS_DEBUG__?.activeScenes?.().includes('TitleScene'));
|
||||||
await clickLegacyTitleControl(page, 962, 310);
|
await activateTitleControl(page, 'continue');
|
||||||
await waitForVillageReady(page);
|
await waitForVillageReady(page);
|
||||||
await page.waitForTimeout(380);
|
await page.waitForTimeout(380);
|
||||||
village = await readVillage(page);
|
village = await readVillage(page);
|
||||||
@@ -521,7 +521,7 @@ try {
|
|||||||
await page.waitForFunction(() =>
|
await page.waitForFunction(() =>
|
||||||
window.__HEROS_DEBUG__?.activeScenes?.().includes('TitleScene')
|
window.__HEROS_DEBUG__?.activeScenes?.().includes('TitleScene')
|
||||||
);
|
);
|
||||||
await clickLegacyTitleControl(page, 962, 310);
|
await activateTitleControl(page, 'continue');
|
||||||
await waitForMilitiaCampReady(page);
|
await waitForMilitiaCampReady(page);
|
||||||
await page.waitForTimeout(380);
|
await page.waitForTimeout(380);
|
||||||
militiaCamp = await readMilitiaCamp(page);
|
militiaCamp = await readMilitiaCamp(page);
|
||||||
@@ -668,7 +668,7 @@ try {
|
|||||||
await page.reload({ waitUntil: 'domcontentloaded', timeout: 90000 });
|
await page.reload({ waitUntil: 'domcontentloaded', timeout: 90000 });
|
||||||
await waitForDebugApi(page);
|
await waitForDebugApi(page);
|
||||||
await page.waitForFunction(() => window.__HEROS_DEBUG__?.activeScenes?.().includes('TitleScene'));
|
await page.waitForFunction(() => window.__HEROS_DEBUG__?.activeScenes?.().includes('TitleScene'));
|
||||||
await clickLegacyTitleControl(page, 962, 310);
|
await activateTitleControl(page, 'continue');
|
||||||
await waitForMilitiaCampReady(page);
|
await waitForMilitiaCampReady(page);
|
||||||
await page.waitForTimeout(380);
|
await page.waitForTimeout(380);
|
||||||
militiaCamp = await readMilitiaCamp(page);
|
militiaCamp = await readMilitiaCamp(page);
|
||||||
@@ -1030,7 +1030,7 @@ try {
|
|||||||
await page.reload({ waitUntil: 'domcontentloaded', timeout: 90000 });
|
await page.reload({ waitUntil: 'domcontentloaded', timeout: 90000 });
|
||||||
await waitForDebugApi(page);
|
await waitForDebugApi(page);
|
||||||
await page.waitForFunction(() => window.__HEROS_DEBUG__?.activeScenes?.().includes('TitleScene'));
|
await page.waitForFunction(() => window.__HEROS_DEBUG__?.activeScenes?.().includes('TitleScene'));
|
||||||
await clickLegacyTitleControl(page, 962, 310);
|
await activateTitleControl(page, 'continue');
|
||||||
await waitForStoryReady(page);
|
await waitForStoryReady(page);
|
||||||
const legacyBridge = await readStory(page);
|
const legacyBridge = await readStory(page);
|
||||||
assert.equal(legacyBridge.currentPageId, 'militia-rises');
|
assert.equal(legacyBridge.currentPageId, 'militia-rises');
|
||||||
@@ -1136,8 +1136,15 @@ async function waitForTitle(page) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function clickLegacyTitleControl(page, x, y) {
|
async function activateTitleControl(page, itemId) {
|
||||||
await page.mouse.click(x * 1.5, y * 1.5);
|
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) {
|
async function waitForStoryReady(page) {
|
||||||
@@ -1149,6 +1156,7 @@ async function waitForStoryReady(page) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
const diagnostic = await page.evaluate(() => ({
|
const diagnostic = await page.evaluate(() => ({
|
||||||
activeScenes: window.__HEROS_DEBUG__?.activeScenes?.() ?? [],
|
activeScenes: window.__HEROS_DEBUG__?.activeScenes?.() ?? [],
|
||||||
|
title: window.__HEROS_DEBUG__?.title?.() ?? null,
|
||||||
story: window.__HEROS_DEBUG__?.scene('StoryScene')?.getDebugState?.() ?? null,
|
story: window.__HEROS_DEBUG__?.scene('StoryScene')?.getDebugState?.() ?? null,
|
||||||
militiaCamp: window.__HEROS_DEBUG__?.militiaCamp?.() ?? null
|
militiaCamp: window.__HEROS_DEBUG__?.militiaCamp?.() ?? null
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user