Files
ttrpg_manager/e2e/smoke.spec.ts
T
NilsBriggen 379b79e6c4 Phase 2: full compendium across all categories + PF2e data
- Scraped PF2e reference from Archives of Nethys ES into public/data/pf2e/
  (spells, creatures, feats, equipment, weapons, armor, ancestries, heritages,
  backgrounds, archetypes, actions, conditions, deities) via scripts/fetch_pf2e.ts
- Registry-driven compendium: system toggle + per-category nav + generic filters
- 5e expanded: weapons, armor, feats, conditions added alongside spells/monsters/items
- PF2e data served as static assets (fetched, not bundled) for fast native parse
- Cross-links: add spell->spellbook / item->inventory to a campaign character;
  add monster/creature -> open encounter
- Condition tooltips in combat sourced from the conditions glossary
- Tests: registry filter unit tests, compendium e2e (browse + cross-link)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 01:00:40 +02:00

60 lines
2.7 KiB
TypeScript

import { test, expect } from '@playwright/test';
// Each test starts from a clean IndexedDB so runs are deterministic.
test.beforeEach(async ({ page }) => {
await page.goto('/');
await page.evaluate(async () => {
indexedDB.deleteDatabase('ttrpg-manager');
localStorage.clear();
});
await page.reload();
});
test('full core flow: campaign → character → dice → combat → compendium', async ({ page }) => {
// --- Campaign ---
await expect(page.getByRole('heading', { name: 'Campaigns' })).toBeVisible();
await page.getByRole('button', { name: '+ New campaign' }).first().click();
await page.getByLabel('').first().waitFor(); // modal open
await page.locator('input[data-autofocus]').fill('Curse of Strahd');
await page.getByRole('button', { name: 'Create' }).click();
// Card appears and becomes active
await expect(page.getByRole('heading', { name: 'Curse of Strahd' })).toBeVisible();
// --- Character ---
await page.getByRole('link', { name: 'Characters' }).click();
await expect(page.getByRole('heading', { name: 'Characters' })).toBeVisible();
await page.getByRole('button', { name: '+ New character' }).first().click();
await page.locator('input[data-autofocus]').fill('Ireena');
await page.getByRole('button', { name: 'Create' }).click();
await page.getByRole('link', { name: /Ireena/ }).click();
// On the sheet: set STR to 16 and expect +3 modifier
await page.getByLabel('STR score').fill('16');
await expect(page.getByText('+3').first()).toBeVisible();
// --- Dice ---
await page.getByRole('link', { name: 'Dice' }).click();
await page.getByRole('button', { name: 'Roll' }).click();
// a result total renders (1..20 for default 1d20)
await expect(page.locator('text=/= \\d+/')).toBeVisible();
// --- Combat ---
await page.getByRole('link', { name: 'Combat' }).click();
await page.getByRole('button', { name: '+ New encounter' }).first().click();
await page.locator('input[data-autofocus]').fill('Ambush');
await page.getByRole('button', { name: 'Create' }).click();
await page.getByLabel('Name').fill('Goblin');
await page.getByRole('button', { name: 'Add', exact: true }).click();
await expect(page.getByText('Goblin')).toBeVisible();
await page.getByRole('button', { name: 'Start combat' }).click();
await expect(page.getByText(/Round 1/)).toBeVisible();
// --- Compendium ---
await page.getByRole('link', { name: 'Compendium' }).click();
await expect(page.getByText(/results/)).toBeVisible();
await page.getByPlaceholder('Search bestiary…').fill('goblin');
await page.getByRole('button', { name: /^Goblin/ }).first().click();
await expect(page.getByRole('heading', { name: 'Goblin', exact: true })).toBeVisible();
});