nxtgauge-admin-solid/tests/e2e/accessibility.spec.ts

22 lines
875 B
TypeScript
Raw Normal View History

import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";
test.describe("Accessibility Tests", () => {
test("login page should have no accessibility violations", async ({ page }) => {
await page.goto("/admin/login");
const results = await new AxeBuilder({ page }).analyze();
expect(results.violations).toEqual([]);
});
test("dashboard page should be accessible after login", async ({ page }) => {
// Mock login (or use real credentials via env)
await page.goto("/admin/login");
await page.fill('input[type="email"]', "admin@example.com");
await page.fill('input[type="password"]', "password");
await page.click('button[type="submit"]');
await expect(page).toHaveURL("/admin");
const results = await new AxeBuilder({ page }).analyze();
expect(results.violations).toEqual([]);
});
});