import { test, expect } from '../support/cross-app-fixtures';

/**
 * Visual Parity Smoke Tests
 *
 * Uses Playwright's built-in toHaveScreenshot for CI-friendly
 * visual regression. On first run, creates baseline screenshots.
 * Subsequent runs compare against baselines.
 *
 * These are lightweight checks — the full multi-viewport comparison
 * pipeline (pnpm compare:visual) is more thorough.
 */

const ROUTES = [
  { name: 'onlineboard-start', path: 'onlineboard' },
  { name: 'schedule-start', path: 'schedule' },
  { name: 'error-404', path: '../error/404' },
] as const;

for (const route of ROUTES) {
  test(`visual-parity: ${route.name}`, async ({ page, app, localePath }) => {
    await page.goto(localePath(route.path));
    await page.waitForLoadState('networkidle');
    await page.waitForTimeout(1000);

    await expect(page).toHaveScreenshot(`${route.name}-${app}.png`, {
      fullPage: true,
      maxDiffPixelRatio: 0.02,
    });
  });
}
