feat(ui): modifier profile editor shell + rules drawer entry
Adds ModifierProfileEditor modal shell with 3 placeholder panels (T21 catalog / T22 board preview / T23 profile list). Esc closes the modal via a window keydown listener active only while isOpen. Wires a 'Modifier Profiles' button into the RulesDrawer footer that opens the editor. Adds e2e/modifier-profiles.spec.ts with 2 tests: open-from-drawer and esc-to-close.
This commit is contained in:
parent
29a5ecfd3f
commit
e23e69e0d0
3 changed files with 156 additions and 4 deletions
55
packages/chess/e2e/modifier-profiles.spec.ts
Normal file
55
packages/chess/e2e/modifier-profiles.spec.ts
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* E2E — Modifier Profile Editor shell (T18).
|
||||
*
|
||||
* Verifies:
|
||||
* 1. The editor modal opens from the Rules drawer.
|
||||
* 2. Pressing Escape closes the editor.
|
||||
*
|
||||
* Runs against the local dev server (no WS server needed — solo play only).
|
||||
*/
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('Modifier Profiles', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
// Clear any stale autosave so Play Solo starts a fresh game.
|
||||
await page.evaluate(() => {
|
||||
for (let i = localStorage.length - 1; i >= 0; i--) {
|
||||
const key = localStorage.key(i);
|
||||
if (key !== null && key.startsWith('paratype-chess:v2:autosave:')) {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
}
|
||||
localStorage.removeItem('paratype-chess:v1:autosave');
|
||||
});
|
||||
|
||||
// Navigate into the game view.
|
||||
await page.locator('[data-action="play-solo"]').click();
|
||||
await page.waitForURL('**/game');
|
||||
|
||||
// Open the rules drawer so the modifier editor button is accessible.
|
||||
await page.locator('[data-action="open-rules-drawer"]').click();
|
||||
await expect(page.getByTestId('rules-drawer')).toBeVisible();
|
||||
});
|
||||
|
||||
test('editor opens from rules drawer', async ({ page }) => {
|
||||
await page.click('[data-testid="open-modifier-editor"]');
|
||||
await expect(
|
||||
page.locator('[data-testid="modifier-editor-modal"]'),
|
||||
).toBeVisible({ timeout: 1000 });
|
||||
});
|
||||
|
||||
test('esc closes modifier editor', async ({ page }) => {
|
||||
await page.click('[data-testid="open-modifier-editor"]');
|
||||
await expect(
|
||||
page.locator('[data-testid="modifier-editor-modal"]'),
|
||||
).toBeVisible();
|
||||
|
||||
await page.keyboard.press('Escape');
|
||||
|
||||
await expect(
|
||||
page.locator('[data-testid="modifier-editor-modal"]'),
|
||||
).not.toBeVisible({ timeout: 500 });
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue