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>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
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('compendium: browse 5e categories, switch to PF2e, cross-link a spell', async ({ page }) => {
|
||||
// Set up a 5e campaign + character to receive a spell
|
||||
await page.getByRole('button', { name: '+ New campaign' }).first().click();
|
||||
await page.locator('input[data-autofocus]').fill('Saltmarsh');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
await page.getByRole('link', { name: 'Characters' }).click();
|
||||
await page.getByRole('button', { name: '+ New character' }).first().click();
|
||||
await page.locator('input[data-autofocus]').fill('Wizard Wendy');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
// Compendium → 5e categories exist (Feats is a new one)
|
||||
await page.getByRole('link', { name: 'Compendium' }).click();
|
||||
await expect(page.getByRole('button', { name: 'Feats' })).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Conditions' }).click();
|
||||
await expect(page.getByText(/results/)).toBeVisible();
|
||||
|
||||
// Spells → add one to the character
|
||||
await page.getByRole('button', { name: 'Spells', exact: true }).click();
|
||||
await page.getByPlaceholder(/Search spells/i).fill('fireball');
|
||||
await page.getByRole('button', { name: /Fireball/ }).first().click();
|
||||
await page.getByLabel('Add spell to character').selectOption({ label: 'Wizard Wendy' });
|
||||
await expect(page.getByText(/Added to Wizard Wendy/)).toBeVisible();
|
||||
|
||||
// Switch to PF2e — bestiary loads from the static dataset
|
||||
await page.getByRole('button', { name: 'Pathfinder 2e' }).click();
|
||||
await page.getByRole('button', { name: 'Bestiary' }).click();
|
||||
await expect.poll(async () => {
|
||||
const t = (await page.getByText(/results/).textContent()) ?? '';
|
||||
return parseInt(t.replace(/\D/g, ''), 10) || 0;
|
||||
}, { timeout: 15000 }).toBeGreaterThan(0);
|
||||
|
||||
// Verify the spell landed on the character sheet
|
||||
await page.getByRole('link', { name: 'Characters' }).click();
|
||||
await page.getByRole('link', { name: /Wizard Wendy/ }).click();
|
||||
await expect(page.getByText('Fireball')).toBeVisible();
|
||||
});
|
||||
+1
-1
@@ -84,7 +84,7 @@ test('compendium CR filter narrows the bestiary', async ({ page }) => {
|
||||
const countText = async () => (await page.getByText(/results/).textContent()) ?? '';
|
||||
const before = parseInt((await countText()).replace(/\D/g, ''), 10);
|
||||
|
||||
await page.getByLabel('Minimum CR').selectOption({ label: 'CR ≥ 10' });
|
||||
await page.getByLabel('Min CR').selectOption({ label: 'CR ≥ 10' });
|
||||
// wait for the count to update
|
||||
await expect.poll(async () => parseInt((await countText()).replace(/\D/g, ''), 10)).toBeLessThan(before);
|
||||
});
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ test('full core flow: campaign → character → dice → combat → compendium'
|
||||
// --- Compendium ---
|
||||
await page.getByRole('link', { name: 'Compendium' }).click();
|
||||
await expect(page.getByText(/results/)).toBeVisible();
|
||||
await page.getByPlaceholder('Search monsters…').fill('goblin');
|
||||
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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user