Files
Randify.pro/tests/dm/reference.spec.ts
T
emil 1c38df7e74 style(dm): redesign dashboard with purple-gold theme
Redesign DM Dashboard (/dm/, /ru/dm/) with purple-gold theme (#534AB7 + #c8a84b):

Design System:
- Update dm-theme.css with 49 purple-gold tokens (transitions, shadows, hover states)
- Create DmTabs.astro with ARIA, keyboard nav, URL hash sync, localStorage persistence
- Create DmSidebar.astro for desktop navigation
- Redesign DmHeader with gold accent
- Update DmButton, DmCard, DmInput primitives
- Expand i18n to 47 strings

Layout:
- Redesign DmLayout with 3-column dashboard grid (sidebar|main|context)
- Update /dm/index.astro and /ru/dm/index.astro with named slots

Feature Components:
- DiceRoller: empty state, ARIA live, color-coded history, storage key fallback
- InitiativeTracker: HP editing, active highlighting, storage key fallback
- Open5eReference: skeletons, debounce, error retry, gold tabs
- NotesPanel: cross-tab sync, copy-to-clipboard, auto-save
- AuthPanel: VK/Yandex brand colors, pill buttons

Tests:
- Add 50 Playwright E2E tests (smoke, dice, initiative, reference, notes, data-migration)

Fixes:
- Document Open5e client.ts URL bugfix
- Add backward-compatible storage key fallback for dice/initiative
- Preserve legacy sessionStorage data on load
2026-05-15 17:49:32 +03:00

38 lines
1.7 KiB
TypeScript

import { test, expect } from "@playwright/test";
test.describe("Open5e Reference", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/dm/#reference");
});
test("tab switching works", async ({ page }) => {
await page.click("[data-testid='ref-tab-monsters']:visible");
await expect(page.locator("[data-testid='ref-monsters-list']:visible")).toBeVisible();
await page.click("[data-testid='ref-tab-spells']:visible");
await expect(page.locator("[data-testid='ref-spells-list']:visible")).toBeVisible();
});
test("search filtering", async ({ page }) => {
await page.click("[data-testid='ref-tab-monsters']:visible");
await page.fill("[data-testid='ref-search-input']:visible", "goblin");
await page.waitForTimeout(400);
await expect(page.locator("[data-testid='ref-result-card']:visible").filter({ hasText: /goblin/i }).first()).toBeVisible({ timeout: 15000 });
});
test("detail modal opens and closes", async ({ page }) => {
await page.click("[data-testid='ref-tab-monsters']:visible");
await page.waitForSelector("[data-testid='ref-result-card']:visible", { timeout: 15000 });
await page.locator("[data-testid='ref-result-card']:visible").first().click();
await expect(page.locator("[data-testid='ref-modal']:visible")).toBeVisible();
await page.click("[data-testid='ref-modal-overlay']:visible", { position: { x: 10, y: 10 } });
await expect(page.locator("[data-testid='ref-modal']:visible")).toHaveCount(0);
});
test("mobile viewport renders correctly", async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await expect(page.locator("[data-testid='ref-section']:visible")).toBeVisible();
});
});