06615020f6
Rebuilt CreationWizard to consume the structured ruleset data (Phase 7): - Class step: rich class cards (description, hit die, key ability, caster, playstyle tag) + subclass picker, plus "ready-made hero" quick-start templates that prefill class + abilities for instant play. - Origin step: searchable ancestry/race + background pickers with descriptions (auto speed/ancestry-HP where known). - Abilities: key-ability hints from the chosen class. Skills: choices from class data. - Spells step (casters only): searchable starting-spell picker → spellcasting.spells. - Review applies derived build + data-driven saves (esp. PF2e classes). - Updated the e2e helper + wizard spec to the new flow (class-card data-testid). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import { type Page } from '@playwright/test';
|
|
|
|
/**
|
|
* Walk the guided creation wizard and land on the new character's sheet.
|
|
* Picks the Barbarian class (a non-caster, so there's no Spells step) and the
|
|
* default standard array; selects the minimum required trained skills.
|
|
*/
|
|
export async function createCharacter(page: Page, name: string): Promise<void> {
|
|
await page.getByRole('button', { name: '+ New character' }).first().click();
|
|
await page.getByLabel('Name').fill(name);
|
|
// Class step: pick a class card (waits for the data-driven list to load).
|
|
await page.getByTestId('class-card').filter({ hasText: 'Barbarian' }).click();
|
|
await page.getByRole('button', { name: 'Next' }).click(); // → Origin
|
|
await page.getByRole('button', { name: 'Next' }).click(); // → Abilities (standard array valid)
|
|
await page.getByRole('button', { name: 'Next' }).click(); // → Skills
|
|
|
|
const next = page.getByRole('button', { name: 'Next' });
|
|
const boxes = page.locator('input[type="checkbox"]');
|
|
const count = await boxes.count();
|
|
for (let i = 0; i < count; i++) {
|
|
if (!(await next.isDisabled())) break;
|
|
await boxes.nth(i).check();
|
|
}
|
|
await next.click(); // → Review
|
|
await page.getByRole('button', { name: 'Create character' }).click();
|
|
}
|