import { test, expect } from '../fixtures'; import { AdminLoginPage } from '../pages/AdminLoginPage'; import { BUDGET_MS, expectWithinBudget } from '../timing-budgets'; import { DEFAULT_ADMIN_BASE_URL } from '../env-defaults'; /** * FastAPI-admin UI smoke: core review workflows load without error. * Uses E2E_API_USERNAME/PASSWORD (admin FastAPI user — not NextAuth viewer creds). */ test.describe('admin review pages @smoke', () => { const adminBaseUrl = process.env.PLAYKIT_ADMIN_BASE_URL || DEFAULT_ADMIN_BASE_URL; test('identify, auto-match, and approve pages load for admin', async ({ page, timings, }) => { const username = process.env.E2E_API_USERNAME || ''; const password = process.env.E2E_API_PASSWORD || ''; test.skip(!username || !password, 'E2E_API_USERNAME/PASSWORD required for admin UI'); const login = new AdminLoginPage(page, adminBaseUrl); await timings.measure('admin_login', async () => { await login.openLogin(); await login.signIn(username, password); await expect(page.getByRole('heading', { name: /Home Page/i })).toBeVisible({ timeout: 20_000, }); }); expectWithinBudget(timings, 'admin_login', BUDGET_MS.uiLogin); await timings.measure('admin_identify', async () => { await page.goto(`${adminBaseUrl}/identify`); await expect(page.getByRole('heading', { name: /Identify/i })).toBeVisible(); await expect(page.getByRole('button', { name: /Identify Faces/i })).toBeVisible(); }); expectWithinBudget(timings, 'admin_identify', BUDGET_MS.uiAction); await timings.measure('admin_auto_match', async () => { await page.goto(`${adminBaseUrl}/auto-match`); await expect(page.getByRole('heading', { name: /Auto-Match/i })).toBeVisible(); await expect(page.getByRole('button', { name: /Run Auto-Match/i })).toBeVisible(); }); expectWithinBudget(timings, 'admin_auto_match', BUDGET_MS.uiAction); await timings.measure('admin_approve', async () => { await page.goto(`${adminBaseUrl}/approve-identified`); await expect(page.getByRole('heading', { name: /Approve Identified/i })).toBeVisible(); await expect( page.getByText(/Total pending identifications/i).or(page.getByText(/Loading identified people/i)), ).toBeVisible({ timeout: 20_000 }); }); expectWithinBudget(timings, 'admin_approve', BUDGET_MS.uiAction); }); });