b41c1d2501
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61) Co-authored-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com> Co-committed-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
46 lines
2.1 KiB
TypeScript
46 lines
2.1 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
test("health endpoint returns status ok", async ({ request }) => {
|
|
const res = await request.get("/api/health");
|
|
expect(res.status()).toBe(200);
|
|
const body = (await res.json()) as { status: string };
|
|
expect(body.status).toBe("ok");
|
|
});
|
|
|
|
test("unauthenticated root redirects to signin", async ({ request }) => {
|
|
// Use HTTP-level request rather than page.goto: on the QNAP runner Chromium
|
|
// intermittently raises ERR_CONNECTION_REFUSED on this exact navigation
|
|
// even when curl on the same URL returns 307 milliseconds earlier and
|
|
// every other smoke test (api/health, /auth/signin, login flow) works
|
|
// against the same container. The spec semantically verifies the redirect
|
|
// wiring; checking the response code + Location header is equivalent and
|
|
// not subject to the Chromium-only flake.
|
|
const res = await request.get("/", { maxRedirects: 0 });
|
|
expect(res.status()).toBe(307);
|
|
expect(res.headers()["location"] ?? "").toMatch(/\/auth\/signin/);
|
|
});
|
|
|
|
test("signin page renders credential inputs and submit button", async ({ page }) => {
|
|
await page.goto("/auth/signin");
|
|
await expect(page.locator('input[type="email"]')).toBeVisible();
|
|
await expect(page.locator('input[type="password"]')).toBeVisible();
|
|
await expect(page.locator('button[type="submit"]')).toBeVisible();
|
|
});
|
|
|
|
test("admin login succeeds and redirects away from signin", async ({ page }) => {
|
|
await page.goto("/auth/signin");
|
|
await page.fill('input[type="email"]', "admin@nexus.dev");
|
|
await page.fill('input[type="password"]', "admin123");
|
|
await page.click('button[type="submit"]');
|
|
await expect(page).not.toHaveURL(/\/auth\/signin/, { timeout: 15_000 });
|
|
});
|
|
|
|
test("authenticated user sees app shell nav", async ({ page }) => {
|
|
await page.goto("/auth/signin");
|
|
await page.fill('input[type="email"]', "admin@nexus.dev");
|
|
await page.fill('input[type="password"]', "admin123");
|
|
await page.click('button[type="submit"]');
|
|
await expect(page).not.toHaveURL(/\/auth\/signin/, { timeout: 15_000 });
|
|
await expect(page.locator("nav").first()).toBeVisible({ timeout: 10_000 });
|
|
});
|