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('homebrew: create a custom monster and find it in the compendium', async ({ page }) => { await page.getByRole('button', { name: '+ New campaign' }).first().click(); await page.locator('input[data-autofocus]').fill('Brew'); await page.getByRole('button', { name: 'Create' }).click(); await page.getByRole('link', { name: 'Dashboard' }).click(); await page.getByLabel('Primary').getByRole('link', { name: 'Homebrew' }).click(); // Create a homebrew monster and name it await page.getByRole('button', { name: /New monster/ }).click(); const nameInput = page.getByLabel('Homebrew name'); await nameInput.fill('Dire Frog'); await page.getByLabel('Hit Points').fill('22'); // It shows up in the compendium bestiary with an HB badge await page.getByRole('link', { name: 'Compendium' }).click(); await page.getByPlaceholder(/Search bestiary/i).fill('Dire Frog'); await page.getByRole('button', { name: /Dire Frog/ }).first().click(); await expect(page.getByText(/Homebrew monster/)).toBeVisible(); await expect(page.getByText('HB').first()).toBeVisible(); });