Files
Kordant/web/e2e/critical-flows.spec.ts
2026-05-27 10:30:23 -04:00

63 lines
1.9 KiB
TypeScript

import { test, expect } from "@playwright/test";
test.describe("Critical User Journeys", () => {
test("landing page loads", async ({ page }) => {
await page.goto("/");
await expect(page).toHaveTitle(/Kordant/i);
});
test("navigation works", async ({ page }) => {
await page.goto("/");
await page.getByRole("link", { name: /features/i }).click();
await expect(page).toHaveURL(/features/);
});
test("login page accessible", async ({ page }) => {
await page.goto("/login");
await expect(page.locator("form")).toBeVisible();
});
test("signup page accessible", async ({ page }) => {
await page.goto("/signup");
await expect(page.locator("form")).toBeVisible();
});
test("dashboard loads for authenticated user", async ({ page }) => {
// This test requires authentication setup
// For now, just verify the route exists
await page.goto("/dashboard");
// May redirect to login, which is expected
await expect(page).toBeURL(/(dashboard|login)/);
});
});
test.describe("Accessibility", () => {
test("no color contrast issues", async ({ page }) => {
await page.goto("/");
const contrasts = await page.evaluate(() => {
const elements = document.querySelectorAll("*");
const issues: string[] = [];
for (const el of Array.from(elements)) {
const style = window.getComputedStyle(el);
const color = style.color;
const bgColor = style.backgroundColor;
if (color && bgColor) {
// Basic contrast check
issues.push(`${color} on ${bgColor}`);
}
}
return issues;
});
expect(contrasts).toBeDefined();
});
test("all images have alt text", async ({ page }) => {
await page.goto("/");
const images = await page.locator("img").all();
for (const img of images) {
const alt = await img.getAttribute("alt");
expect(alt).toBeDefined();
}
});
});