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>
42 lines
1.8 KiB
TypeScript
42 lines
1.8 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('/');
|
|
await page.evaluate(async () => {
|
|
indexedDB.deleteDatabase('ttrpg-manager');
|
|
localStorage.clear();
|
|
});
|
|
await page.reload();
|
|
});
|
|
|
|
test('creation wizard builds a complete character (HP, skills, spells)', async ({ page }) => {
|
|
await page.getByRole('button', { name: '+ New campaign' }).first().click();
|
|
await page.locator('input[data-autofocus]').fill('Wizard Camp');
|
|
await page.getByRole('button', { name: 'Create' }).click();
|
|
await page.getByRole('link', { name: 'Characters' }).click();
|
|
await page.getByRole('button', { name: '+ New character' }).first().click();
|
|
|
|
// Class step: a level-3 Wizard (a caster, so a Spells step appears).
|
|
await page.getByLabel('Name').fill('Mira');
|
|
await page.getByLabel('Level', { exact: true }).fill('3');
|
|
await page.getByTestId('class-card').filter({ hasText: 'Wizard' }).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 boxes = page.locator('input[type="checkbox"]');
|
|
await boxes.nth(0).check();
|
|
await boxes.nth(1).check();
|
|
await page.getByRole('button', { name: 'Next' }).click(); // → Spells (Wizard is a caster)
|
|
|
|
await expect(page.getByPlaceholder('Search spells…')).toBeVisible();
|
|
await page.getByRole('button', { name: 'Next' }).click(); // → Review
|
|
|
|
await expect(page.getByText('Max HP')).toBeVisible();
|
|
await expect(page.getByText('Spell slots')).toBeVisible();
|
|
await page.getByRole('button', { name: 'Create character' }).click();
|
|
|
|
// Lands on the sheet with real derived HP, not the old 1/1.
|
|
await expect(page.getByText('Hit Points')).toBeVisible();
|
|
});
|