forked from phenom/healer-man
54 lines
2.1 KiB
JavaScript
54 lines
2.1 KiB
JavaScript
// Routine live QA defaults to the one-boss Stockade slice. The selected boss
|
|
// is seeded by each dungeon run, so callers must record its observed identity.
|
|
const DEFAULT_TEST_DUNGEON_ID = 'bite-sized-stormwind-stockade';
|
|
const DEFAULT_TEST_DUNGEON_TITLE = 'Stormwind Stockade: Cellblock Rush';
|
|
const DEFAULT_TEST_DUNGEON_CATEGORY = 'Bite-Sized';
|
|
|
|
// Full-campaign fixtures are separate and must be selected explicitly.
|
|
const FULL_STOCKADE_DUNGEON_ID = 'stormwind-stockade';
|
|
const FULL_STOCKADE_DUNGEON_TITLE = 'Stormwind Stockade';
|
|
const FULL_STOCKADE_BOSS = 'Hamhock';
|
|
|
|
// Boss Testing is an isolated single-boss mode, not a dungeon-run default.
|
|
const DEFAULT_BOSS_TEST_BOSS = 'Hamhock';
|
|
|
|
async function selectDungeon(page, category, title) {
|
|
await page.locator('.dungeon-category-tab').filter({ hasText: category }).click();
|
|
await page.locator('.dungeon-select-row').filter({
|
|
has: page.getByText(title, { exact: true }),
|
|
}).click();
|
|
}
|
|
|
|
async function selectDefaultTestDungeon(page) {
|
|
await selectDungeon(page, DEFAULT_TEST_DUNGEON_CATEGORY, DEFAULT_TEST_DUNGEON_TITLE);
|
|
}
|
|
|
|
async function selectFullStockadeDungeon(page) {
|
|
await selectDungeon(page, 'WoW', FULL_STOCKADE_DUNGEON_TITLE);
|
|
}
|
|
|
|
async function openSelectedDungeonRoles(page) {
|
|
const download = page.getByRole('button', { name: 'Download and continue', exact: true });
|
|
const role = page.locator('.dungeon-role-option').first();
|
|
// Selecting an uninstalled pack may open its confirmation immediately.
|
|
// Installed selections expose Choose Role without that modal.
|
|
if (await download.isVisible()) await download.click();
|
|
else if (!await role.isVisible()) await page.getByRole('button', { name: /choose role/i }).click();
|
|
await role.or(download).first().waitFor({ timeout: 180_000 });
|
|
if (await download.isVisible()) await download.click();
|
|
await role.waitFor({ timeout: 180_000 });
|
|
}
|
|
|
|
module.exports = Object.freeze({
|
|
DEFAULT_TEST_DUNGEON_ID,
|
|
DEFAULT_TEST_DUNGEON_TITLE,
|
|
DEFAULT_TEST_DUNGEON_CATEGORY,
|
|
DEFAULT_BOSS_TEST_BOSS,
|
|
FULL_STOCKADE_DUNGEON_ID,
|
|
FULL_STOCKADE_DUNGEON_TITLE,
|
|
FULL_STOCKADE_BOSS,
|
|
selectDefaultTestDungeon,
|
|
selectFullStockadeDungeon,
|
|
openSelectedDungeonRoles,
|
|
});
|