Fix equip coverage after the item-action refactor
The item action buttons derived their focus key from the visible label, so
the bag's Equip button became "Equip-<id>" when 9b01ee3 replaced the panel's
own lowercase "equip-<id>" button with itemControls. Slugify the label so the
key stays stable when a button is reworded, and point the progression spec at
the item-action endpoint the refactor moved equip onto -- it still polled the
websocket intents, which no longer carry equip.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,8 @@ test('progression and signed permanent titles render in game, account, and admin
|
||||
await page.route('**/api/control?*', route => route.fulfill({ json: { worlds, characters: [record], commands: [], provisioningEnabled: false, characterLimit: 500, auditLimit: 100 } }));
|
||||
let sendSnapshot: () => void = () => {};
|
||||
const intents: { op: string; target: string; slot: string }[] = [];
|
||||
const itemActions: { op: string; item: string; slot: string }[] = [];
|
||||
await page.route('**/api/item-action', route => { itemActions.push(route.request().postDataJSON()); route.fulfill({ json: { id: 'item-action-fixture', message: 'Equipped Trial Ring.', returned: {} } }); });
|
||||
await page.routeWebSocket('**/ws', socket => {
|
||||
socket.onMessage(raw => { const intent = JSON.parse(String(raw)); if (intent.op !== 'move') intents.push(intent); });
|
||||
sendSnapshot = () => {
|
||||
@@ -40,7 +42,7 @@ test('progression and signed permanent titles render in game, account, and admin
|
||||
sendSnapshot();
|
||||
await expect(page.getByLabel('Ring slot for Trial Ring')).toHaveValue('ring8');
|
||||
await page.locator('[data-focus-key="equip-ring-fixture"]').click();
|
||||
await expect.poll(() => intents.at(-1)).toMatchObject({ op: 'equip', target: 'ring-fixture', slot: 'ring8' });
|
||||
await expect.poll(() => itemActions.at(-1)).toMatchObject({ op: 'equip', item: 'ring-fixture', slot: 'ring8' });
|
||||
character.equipment.ring8 = 'ring-fixture'; sendSnapshot();
|
||||
await page.getByRole('navigation', { name: 'Character menus' }).getByRole('button', { name: 'Equipment', exact: true }).click();
|
||||
await expect(page.locator('.equipment-slot')).toHaveCount(21);
|
||||
|
||||
Reference in New Issue
Block a user