test: add Playwright E2E test suite (30 tests)
Add browser-level end-to-end tests covering public pages, Keycloak OAuth authentication flow, dashboard interactions, providers config, developer section, organization pages, and sidebar navigation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
24
e2e/auth.setup.ts
Normal file
24
e2e/auth.setup.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { test as setup, expect } from "@playwright/test";
|
||||
|
||||
const AUTH_FILE = "e2e/.auth/user.json";
|
||||
|
||||
setup("authenticate via Keycloak", async ({ page }) => {
|
||||
// Navigate to a protected route to trigger the auth redirect chain:
|
||||
// /dashboard -> /auth (Axum) -> Keycloak login page
|
||||
await page.goto("/dashboard");
|
||||
|
||||
// Wait for Keycloak login form to appear
|
||||
await page.waitForSelector("#username", { timeout: 15_000 });
|
||||
|
||||
// Fill Keycloak credentials
|
||||
await page.fill("#username", process.env.TEST_USER ?? "admin@certifai.local");
|
||||
await page.fill("#password", process.env.TEST_PASSWORD ?? "admin");
|
||||
await page.click("#kc-login");
|
||||
|
||||
// Wait for redirect back to the app dashboard
|
||||
await page.waitForURL("**/dashboard", { timeout: 15_000 });
|
||||
await expect(page.locator(".sidebar")).toBeVisible();
|
||||
|
||||
// Persist authenticated state (cookies + localStorage)
|
||||
await page.context().storageState({ path: AUTH_FILE });
|
||||
});
|
||||
Reference in New Issue
Block a user