import { expect, test } from "@playwright/test"; /** * Smoke test for the shared minigame developer dock after the poker panel * migration: the old inline PokerDevPanel dialog is gone, and superusers get * the floating dock instead (collapsed Shield button -> Controls/State/Log * tabs). The dev login seeded by global-setup holds a superuser role doc, so * the dock must render for it; the dock's gating itself (server-side * isSuperuser checks on every action) is covered by * tests/int/minigame-dev-console-gating.int.spec.ts. */ test.describe("Minigame dev console (poker smoke)", () => { test("superuser sees the dock on a poker table and can open all three tabs", async ({ page, }) => { await page.goto("/login"); await page.getByLabel("Username").fill("dev"); await page.getByLabel("Password").fill("Test123"); await page.getByRole("button", { name: "Log in" }).click(); await page.waitForURL((url) => !url.pathname.startsWith("/login"), { timeout: 30_000 }); await page.goto("/minigames/poker"); await expect(page.getByRole("heading", { name: /poker/i }).first()).toBeVisible({ timeout: 60_000, }); await page.getByRole("button", { name: "Create table" }).click(); // Collapsed dock = the Shield button in the bottom-right corner. const dockButton = page.getByRole("button", { name: "Developer controls" }); await expect(dockButton).toBeVisible({ timeout: 30_000 }); await dockButton.click(); await expect(page.getByText("Poker dev console")).toBeVisible({ timeout: 10_000 }); await expect(page.getByRole("tab", { name: "Controls" })).toBeVisible(); // State tab: raw snapshot JSON inspector. await page.getByRole("tab", { name: "State" }).click(); await expect(page.getByText("Raw snapshot JSON")).toBeVisible(); await expect(page.getByText(/"tableId"/)).toBeVisible(); // Log tab: the dock logs every received snapshot version. await page.getByRole("tab", { name: /^Log/ }).click(); await expect(page.getByText(/poker: snapshot v\d+ received/).first()).toBeVisible({ timeout: 15_000, }); // Back to Controls: in the waiting room there is no live hand yet, so the // per-hand sections are absent; the tab itself must stay interactive. await page.getByRole("tab", { name: "Controls" }).click(); await expect(page.getByRole("tab", { name: "Controls" })).toHaveAttribute( "data-state", "active", ); }); });