test(e2e): add solo modifier indicator smoke guard

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Joey Yakimowich-Payne 2026-04-19 14:14:18 -06:00
commit 396051f5c0
No known key found for this signature in database
2 changed files with 58 additions and 1 deletions

View file

@ -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.

View file

@ -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)', () => {
});
});
});