import { expect, test } from "@playwright/test"; test.describe("Authentication flows", () => { test("login form validates required fields", async ({ page }) => { await page.goto("/login"); await page.click('button[type="submit"]'); await expect(page.locator("text=required")).toBeVisible({ timeout: 5000 }); }); test("login with invalid credentials shows error", async ({ page }) => { await page.goto("/login"); await page.fill('input[name="username"]', "nonexistent"); await page.fill('input[name="password"]', "wrongpassword"); await page.click('button[type="submit"]'); await expect(page.locator("text=invalid")).toBeVisible({ timeout: 5000 }); }); test("register page has password confirmation field", async ({ page }) => { await page.goto("/register"); await expect(page.locator('input[name="confirmPassword"]')).toBeVisible(); }); test("register form validates password match", async ({ page }) => { await page.goto("/register"); await page.fill('input[name="password"]', "Password123!"); await page.fill('input[name="confirmPassword"]', "DifferentPass123!"); await page.click('button[type="submit"]'); await expect(page.locator("text=match|komen overeen|kloppen")).toBeVisible({ timeout: 5000, }); }); });