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('generate ability scores and level up', async ({ page }) => { await page.getByRole('button', { name: '+ New campaign' }).first().click(); await page.locator('input[data-autofocus]').fill('Build'); 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('Builder'); await page.getByRole('button', { name: 'Create' }).click(); await page.getByRole('link', { name: /Builder/ }).click(); // Generate scores via standard array (default assignment 15,14,13,12,10,8) await page.getByRole('button', { name: 'Generate' }).click(); await page.getByRole('button', { name: 'Apply' }).click(); await expect(page.getByLabel('STR score')).toHaveValue('15'); // Level up from 1 -> 2 await page.getByRole('button', { name: 'Level up' }).click(); await page.getByRole('button', { name: 'Level up' }).last().click(); await expect(page.getByRole('spinbutton', { name: 'Level', exact: true })).toHaveValue('2'); });