/** * E2E: character level + rename from the status menu (the Phase 7 * cross-check closed the `setCharacterLevel` / `changeName` gaps vs the * reference `SetCharacterLevelMenu`). Drives the real UI and asserts the * server round-trip re-renders on the tab. */ import { test, expect } from '../helpers/table.js'; test('a player can set a character level and rename it', async ({ table }) => { const p1 = (await table.newTab()).tab; await p1.open(table.server.url); await p1.addCharacter('Hatchet'); // Open the status (stat) menu by tapping the row's name. const dlg = await p1.openStatusMenu('Hatchet'); // Level pills 1..N are present; level 1 (the add default) is the current // one, so its pill is highlighted and disabled. await expect(dlg.locator('button.pill', { hasText: /^1$/ })).toBeDisabled(); await expect(dlg.locator('button.pill', { hasText: /^1$/ })).toHaveClass(/pill--on/); // Set level 2: the server round-trip re-renders and the level-2 pill // becomes the highlighted current one. await dlg.locator('button.pill', { hasText: /^2$/ }).click(); await expect(dlg.locator('button.pill', { hasText: /^2$/ })).toHaveClass(/pill--on/); await expect(dlg.locator('button.pill', { hasText: /^2$/ })).toBeDisabled(); await expect(dlg.locator('button.pill', { hasText: /^1$/ })).toBeEnabled(); // Rename via the name field: submit on Enter, the row re-renders with the // new display name. (Use a name with no overlap with "Hatchet" so the // substring-matched row helpers read the old and new names distinctly.) const name = dlg.locator('input.search'); await name.fill('Molly'); await name.press('Enter'); await expect(p1.row('Molly')).toBeVisible(); await expect(p1.row('Hatchet')).toHaveCount(0); });