From 396051f5c00833f2e3706acbbcb8fbab377f1071 Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Sun, 19 Apr 2026 14:14:18 -0600 Subject: [PATCH] test(e2e): add solo modifier indicator smoke guard Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- .sisyphus/notepads/polish-t2/learnings.md | 15 ++++++++ packages/chess/e2e/solo-smoke.spec.ts | 44 ++++++++++++++++++++++- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/.sisyphus/notepads/polish-t2/learnings.md b/.sisyphus/notepads/polish-t2/learnings.md index 086f2f6..617166d 100644 --- a/.sisyphus/notepads/polish-t2/learnings.md +++ b/.sisyphus/notepads/polish-t2/learnings.md @@ -69,3 +69,18 @@ Probable file: add test to `solo-smoke.spec.ts` (T2 added it as the canary) or e - Added optional `baseAttr?: ChessAttrKey` to `ModifierDescriptor` and set `hp-bonus` to `baseAttr: "Hp"`. - Removed hardcoded `HpBonus`/`RangeBonus` aliasing from `getModifierSource`; source matching now uses `descriptor.baseAttr ?? descriptor.attrName` directly. + +## [2026-04-19 14:03] Task: commit-4 solo modifier indicator e2e + +- Added a solo-smoke e2e that seeds one custom profile in localStorage, selects it in the lobby picker, enters solo mode, and asserts a `modifier-indicator-*` node renders. +- Guarded lobby navigation by opening the rules drawer only when `profile-picker` is initially hidden, matching existing T2 lobby interaction patterns. + +## [2026-04-19 14:07] Task: solo indicator test fixture correction + +- Initial fixture used `color: "white"` and no `layoutId`; the option did not appear in the lobby picker during full e2e. +- Corrected fixture to mirror known-good T2 shape (`layoutId: "classic"`, `color: "both"`), which allows picker selection and solo badge assertion. + +## [2026-04-19 14:09] Task: solo indicator test storage key mismatch + +- Root cause of missing picker option: seeded localStorage key used `paratype-chess:modifier-profiles:v1`, but runtime library key is `houserules:modifier-profiles:v1`. +- Updating the key fixed profile loading in the lobby picker for the solo smoke regression. diff --git a/packages/chess/e2e/solo-smoke.spec.ts b/packages/chess/e2e/solo-smoke.spec.ts index 906ec8d..25b2e2c 100644 --- a/packages/chess/e2e/solo-smoke.spec.ts +++ b/packages/chess/e2e/solo-smoke.spec.ts @@ -35,6 +35,49 @@ test.describe('Solo-play smoke (T2 preview tests)', () => { await expect(page.locator('[data-square="e2"] [data-piece]')).toHaveCount(0); }); + test('solo play with modifier profile renders modifier-indicator dots', async ({ page }) => { + const LIBRARY_KEY = 'houserules:modifier-profiles:v1'; + const entry = { + id: 'solo-smoke-indicator', + name: 'Solo Smoke Indicator', + profile: { + id: 'solo-smoke-indicator', + name: 'Solo Smoke Indicator', + description: '', + layoutId: 'classic', + perType: [ + { kind: 'hp-bonus', pieceType: 'pawn', color: 'both', value: 1 }, + ], + perInstance: [], + version: 1, + source: 'custom', + }, + starred: false, + updatedAt: Date.now(), + }; + + await page.goto('/'); + await page.evaluate( + ({ key, e }) => localStorage.setItem(key, JSON.stringify([e])), + { key: LIBRARY_KEY, e: entry }, + ); + await page.reload(); + + const picker = page.getByTestId('profile-picker'); + if (!(await picker.isVisible())) { + await page.locator('[data-action="open-rules-drawer"]').click(); + } + await expect(picker).toBeVisible(); + await picker.selectOption('solo-smoke-indicator'); + + await page.locator('[data-action="play-solo"]').click(); + await page.waitForURL('**/game', { timeout: 5000 }); + + await expect(page.locator('[data-testid^="modifier-indicator-"]').first()).toBeVisible({ + timeout: 3000, + }); + }); + test('can play multiple moves in sequence (4-ply)', async ({ page }) => { await page.locator('[data-action="play-solo"]').click(); await page.waitForURL('**/game'); @@ -167,4 +210,3 @@ test.describe('Solo-play smoke (T2 preview tests)', () => { }); }); }); -