test: align camp qa with auto scout flow
This commit is contained in:
@@ -146,6 +146,7 @@ try {
|
||||
await page.evaluate(async () => {
|
||||
await window.__HEROS_DEBUG__.goToCamp();
|
||||
});
|
||||
await suppressFirstPursuitAutoEntryForJournalQa(page);
|
||||
await waitForCampJournalReady(page);
|
||||
|
||||
const runtime = await readRuntimeProbe(page, 'CampScene');
|
||||
@@ -289,6 +290,85 @@ async function waitForDebugApi(page) {
|
||||
);
|
||||
}
|
||||
|
||||
async function suppressFirstPursuitAutoEntryForJournalQa(page) {
|
||||
let result;
|
||||
try {
|
||||
const handle = await page.waitForFunction(
|
||||
() => {
|
||||
const debug = window.__HEROS_DEBUG__;
|
||||
const camp = debug?.camp?.();
|
||||
if (
|
||||
!debug?.activeScenes?.().includes('CampScene') ||
|
||||
camp?.firstPursuitAutoEntry?.cueVisible !== true
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const loop = window.__HEROS_GAME__?.loop;
|
||||
const scene = debug.scene('CampScene');
|
||||
if (
|
||||
!loop ||
|
||||
typeof loop.sleep !== 'function' ||
|
||||
typeof loop.wake !== 'function' ||
|
||||
typeof scene?.debugSuppressFirstPursuitAutoEntry !==
|
||||
'function'
|
||||
) {
|
||||
return {
|
||||
suppressed: false,
|
||||
reason: 'Required debug suppression controls are unavailable.'
|
||||
};
|
||||
}
|
||||
|
||||
loop.sleep();
|
||||
try {
|
||||
return {
|
||||
suppressed:
|
||||
scene.debugSuppressFirstPursuitAutoEntry(),
|
||||
reason: null
|
||||
};
|
||||
} finally {
|
||||
loop.wake();
|
||||
}
|
||||
},
|
||||
undefined,
|
||||
{ timeout: 90000 }
|
||||
);
|
||||
result = await handle.jsonValue();
|
||||
} catch (error) {
|
||||
const diagnostic = await page.evaluate(() => ({
|
||||
activeScenes:
|
||||
window.__HEROS_DEBUG__?.activeScenes?.() ?? [],
|
||||
camp: window.__HEROS_DEBUG__?.camp?.() ?? null
|
||||
}));
|
||||
throw new Error(
|
||||
`First-pursuit automatic entry could not be held for ` +
|
||||
`campaign journal QA: ${JSON.stringify(diagnostic)}`,
|
||||
{ cause: error }
|
||||
);
|
||||
}
|
||||
|
||||
assert.equal(
|
||||
result?.suppressed,
|
||||
true,
|
||||
`${renderer}: failed to hold the first-victory camp for ` +
|
||||
`campaign journal QA: ${JSON.stringify(result)}`
|
||||
);
|
||||
await page.waitForFunction(
|
||||
() => {
|
||||
const debug = window.__HEROS_DEBUG__;
|
||||
const autoEntry =
|
||||
debug?.camp?.()?.firstPursuitAutoEntry;
|
||||
return (
|
||||
debug?.activeScenes?.().includes('CampScene') &&
|
||||
autoEntry?.cueVisible === false &&
|
||||
autoEntry?.suppressedForDebug === true
|
||||
);
|
||||
},
|
||||
undefined,
|
||||
{ timeout: 30000 }
|
||||
);
|
||||
}
|
||||
|
||||
async function seedFirstVictoryCamp(page) {
|
||||
return page.evaluate(async (battleId) => {
|
||||
const campaignModule = await import(
|
||||
|
||||
Reference in New Issue
Block a user