P12: persistent live session across navigation
- Player room connection lifted out of the /play route to an app-level hook (usePlayerConnection in RootLayout), keyed by a persisted joinIntent — so a player stays connected while browsing their sheet, the compendium, anywhere, and a reload reconnects automatically. - Header "● Live: CODE · Leave" badge (PlayerSessionBadge); leaving is explicit (leaveRoom clears intent + disconnects). /play renders the table from the store. - Realtime e2e: player navigates away, badge persists, returns to a synced table. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,14 @@ test('GM hosts a session; a player on another device sees live combat', async ({
|
||||
// enemy exact HP must NOT be shown to players
|
||||
await expect(player.getByText('7/7')).toHaveCount(0);
|
||||
|
||||
// Player navigates away — the live connection persists (badge stays) and
|
||||
// returning still shows the synced table.
|
||||
await player.getByLabel('Primary').getByRole('link', { name: 'Dice' }).click();
|
||||
await expect(player.getByTestId('player-live')).toBeVisible();
|
||||
await expect(player.getByTestId('player-live')).toContainText(code);
|
||||
await player.getByTestId('player-live').getByRole('link').click();
|
||||
await expect(player.getByText('Lia the Brave').first()).toBeVisible();
|
||||
|
||||
await gmCtx.close();
|
||||
await playerCtx.close();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user