Solidify campaign progression state
This commit is contained in:
@@ -13,6 +13,8 @@ try {
|
||||
const page = await browser.newPage({ viewport: { width: 1280, height: 720 } });
|
||||
|
||||
await page.goto(targetUrl, { waitUntil: 'networkidle' });
|
||||
await page.evaluate(() => window.localStorage.clear());
|
||||
await page.reload({ waitUntil: 'networkidle' });
|
||||
await page.waitForSelector('canvas');
|
||||
await page.waitForFunction(() => window.__HEROS_GAME__ !== undefined);
|
||||
await page.waitForFunction(() => window.__HEROS_DEBUG__ !== undefined);
|
||||
@@ -161,6 +163,19 @@ try {
|
||||
throw new Error(`Expected camp dialogue to award bond exp: ${JSON.stringify(campStateAfterDialogue)}`);
|
||||
}
|
||||
|
||||
const campaignSaveAfterDialogue = await page.evaluate(() => {
|
||||
const raw = window.localStorage.getItem('heros-web:campaign-state');
|
||||
return raw ? JSON.parse(raw) : undefined;
|
||||
});
|
||||
if (
|
||||
!campaignSaveAfterDialogue ||
|
||||
campaignSaveAfterDialogue.step !== 'first-camp' ||
|
||||
!campaignSaveAfterDialogue.completedCampDialogues?.length ||
|
||||
Object.keys(campaignSaveAfterDialogue.inventory ?? {}).length === 0
|
||||
) {
|
||||
throw new Error(`Expected campaign save to persist camp progress: ${JSON.stringify(campaignSaveAfterDialogue)}`);
|
||||
}
|
||||
|
||||
await page.evaluate(() => window.__HEROS_DEBUG__?.goToBattle());
|
||||
await page.waitForFunction(() => {
|
||||
const state = window.__HEROS_DEBUG__?.battle();
|
||||
|
||||
Reference in New Issue
Block a user