# Instructions

- Following Playwright test failed.
- Explain why, be concise, respect Playwright best practices.
- Provide a snippet of code with the fix, if possible.

# Test info

- Name: cookie-reload.e2e.test.ts >> Cookie auto-login: login → reload → GameScene re-renders within 5s + chat works
- Location: test/e2e/cookie-reload.e2e.test.ts:15:1

# Error details

```
Error: expect(received).toBe(expected) // Object.is equality

Expected: "mvp-room"
Received: undefined
```

# Page snapshot

```yaml
- generic [active] [ref=e1]:
  - generic:
    - generic [ref=e5]: Press T or Enter to chat
    - generic: uat_a
    - generic: uat_a
    - generic: uat_a
    - generic: uat_a
    - generic: uat_a
    - generic: uat_a
    - generic: uat_a
    - generic: uat_a
    - generic: uat_a
    - generic: uat_b
    - generic: uat_a
    - generic: uat_a
    - generic: uat_a
    - generic: uat_b
    - generic: uat_a
    - generic: uat_a
```

# Test source

```ts
  1  | // apps/client/test/e2e/cookie-reload.e2e.test.ts
  2  | // [int->REQ-CLI-09] [int->REQ-CLI-04]
  3  | //
  4  | // Plan 06-15 Task 3 — Cookie auto-login reload regression test.
  5  | // UAT Finding #2 (D-25) reproducer: login via form, reload page, assert GameScene
  6  | // re-renders via the cookie auto-login fast-path (BootScene → LoginScene fast-path
  7  | // → GameScene with session_token threaded through).
  8  | //
  9  | // Assertions use window.__rebno deterministic test hook (D-35, exposed by 06-14
  10 | // Task 3 in dev/test mode only) — NOT WebGL canvas-pixel sampling.
  11 | // Room slug asserted as 'mvp-room' per D-30.
  12 | 
  13 | import { test, expect, loginAs, waitForGameReady } from './fixtures.js';
  14 | 
  15 | test('Cookie auto-login: login → reload → GameScene re-renders within 5s + chat works', async ({
  16 |   page,
  17 |   accountA,
  18 |   inviteSuffix,
  19 | }) => {
  20 |   // 1. Login via form and confirm game is ready.
  21 |   await loginAs(page, accountA, inviteSuffix);
  22 |   await waitForGameReady(page);
  23 | 
  24 |   // Confirm initial state via __rebno hook (D-35).
  25 |   const initialRoomId = await page.evaluate(
  26 |     () => (window as unknown as { __rebno?: { roomId?: string } }).__rebno?.roomId,
  27 |   );
> 28 |   expect(initialRoomId).toBe('mvp-room');
     |                         ^ Error: expect(received).toBe(expected) // Object.is equality
  29 | 
  30 |   // 2. Reload the page — this triggers the cookie auto-login fast-path.
  31 |   await page.reload();
  32 | 
  33 |   // 3. Re-assert game-ready within 5s — this is the D-25 regression assertion.
  34 |   //    If session_token is not threaded through BootScene → LoginScene → GameScene,
  35 |   //    GameScene.connect() silently early-returns and canvas never becomes ready.
  36 |   await expect(page.locator('canvas[data-game-ready="true"]')).toBeVisible({
  37 |     timeout: 5_000,
  38 |   });
  39 | 
  40 |   // 4. Confirm room ID and atlas texture are correct via __rebno hook (D-35 + D-30).
  41 |   const postReloadRoomId = await page.evaluate(
  42 |     () => (window as unknown as { __rebno?: { roomId?: string } }).__rebno?.roomId,
  43 |   );
  44 |   expect(postReloadRoomId).toBe('mvp-room');
  45 | 
  46 |   const loadedTextures = await page.evaluate(
  47 |     () =>
  48 |       (window as unknown as { __rebno?: { loadedTextures?: string[] } }).__rebno
  49 |         ?.loadedTextures ?? [],
  50 |   );
  51 |   // The 'mvp' atlas is loaded by BootScene on the cookie reload path (06-14).
  52 |   expect(loadedTextures).toContain('mvp');
  53 | 
  54 |   // 5. Chat round-trip: send a message and assert the chat line appears.
  55 |   await page.keyboard.press('Enter');
  56 |   await page.locator('[data-chat-input]').waitFor({ timeout: 5_000 });
  57 |   await page.fill('[data-chat-input]', 'hello-after-reload');
  58 |   await page.locator('[data-chat-input]').press('Enter');
  59 |   await expect(
  60 |     page.locator('[data-chat-line]').filter({ hasText: 'hello-after-reload' }),
  61 |   ).toBeVisible({ timeout: 5_000 });
  62 | });
  63 | 
```