Files
healer-man/scripts/playtest-defaults.cjs
T
2026-10-04 22:51:21 -04:00

32 lines
1.3 KiB
JavaScript

// Routine test fixture selected by the project owner; see AGENTS.md.
const DEFAULT_TEST_DUNGEON_ID = 'stormwind-stockade';
const DEFAULT_TEST_DUNGEON_TITLE = 'Stormwind Stockade';
const DEFAULT_TEST_DUNGEON_BOSS = 'Hamhock';
async function selectDefaultTestDungeon(page) {
await page.locator('.dungeon-category-tab').filter({ hasText: 'WoW' }).click();
await page.locator('.dungeon-select-row').filter({
has: page.getByText(DEFAULT_TEST_DUNGEON_TITLE, { exact: true }),
}).click();
}
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_BOSS,
selectDefaultTestDungeon,
openSelectedDungeonRoles,
});