1
0
Fork 0
polaris-task-force/tests/e2e/minigame-leaderboards.e2e.spec.ts
Z8MB1E e59e16344e test(minigames): e2e smoke for the leaderboards page and document periods
Phase 8 of the minigame periods feature:

- e2e smoke: the unified leaderboards page shows the period boards, the Core
  game tabs and the achievements section; switching to All-Time reveals the
  cardtable games; a game page shows its anchored period standings card.
  (Passes with the bundled Chromium via E2E_BROWSER_PATH; Vivaldi crashes under
  automation, as the root guide warns.)
- Integration coverage already added alongside each phase: entry recording,
  the close pipeline and awards, month/year windows, the registry, the read
  model and the in-app notifications, plus a pure bot renderer test.
- Document the periods, achievements and registry invariants in the minigames
  AGENTS guide.
2026-10-11 17:06:52 -04:00

48 lines
2 KiB
TypeScript

import { expect, test } from "@playwright/test";
/**
* Smoke coverage for the unified minigames leaderboards: the period view, the
* All-Time switch (which also reveals the cardtable games) and the inline period
* standings card on a game page.
*/
test.describe("Minigame leaderboards", () => {
test.beforeEach(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 });
});
test("shows the period boards, game tabs and achievements", async ({ page }) => {
await page.goto("/minigames/leaderboards");
await expect(
page.getByRole("heading", { level: 1, name: "Minigame Leaderboards" }),
).toBeVisible();
await expect(page.getByRole("tab", { name: "Flight Simulator" })).toBeVisible();
await expect(page.getByRole("tab", { name: "OPORD Recall" })).toBeVisible();
// Cardtable games are not period-scored, so they only appear All-Time.
await expect(page.getByRole("tab", { name: "Poker" })).toHaveCount(0);
await expect(page.getByText("Achievements", { exact: true })).toBeVisible();
});
test("switching to All-Time surfaces every registered game", async ({ page }) => {
await page.goto("/minigames/leaderboards");
await page.getByRole("combobox").click();
await page.getByRole("option", { name: /All-Time/ }).click();
await expect(page.getByRole("tab", { name: "Poker" })).toBeVisible({ timeout: 15_000 });
await expect(page.getByRole("tab", { name: "Blackjack" })).toBeVisible();
});
test("a game page shows its anchored period standings card", async ({ page }) => {
await page.goto("/minigames/flappy");
await expect(
page.getByRole("heading", { level: 2, name: "Anchored period standings" }),
).toBeVisible();
await expect(page.getByRole("link", { name: "All boards" })).toBeVisible();
});
});