// frontend/playwright/a11y.spec.ts
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";

for (const theme of ["light", "dark"] as const) {
  test(`axe — ${theme} 테마 대시보드 위반 0건`, async ({ page }) => {
    await page.goto("/dashboard");
    if (theme === "dark") {
      await page.getByLabel("테마 전환").click();
      await expect(page.locator("html")).toHaveAttribute("data-theme", "dark");
    }
    const results = await new AxeBuilder({ page }).withTags(["wcag2a", "wcag2aa"]).analyze();
    expect(results.violations).toEqual([]);
  });
}
