import { expect, test } from "@playwright/test"; // Health checks — confirm the underlying services are reachable before the // stack-dependent tests run. Skips with a clear reason if anything is down, // so we don't waste 30s on a slow OIDC redirect when Keycloak isn't running. test.describe("dev stack health @needs-stack", () => { test("portal /api/auth/providers responds", async ({ request }) => { const r = await request.get("/api/auth/providers"); expect(r.status()).toBe(200); const data = await r.json(); expect(data).toHaveProperty("keycloak"); }); test("tenant-registry /healthz responds", async ({ request }) => { const url = process.env.PLAYWRIGHT_TENANT_REGISTRY_URL ?? "http://localhost:8090"; const r = await request.get(`${url}/healthz`); expect(r.status()).toBe(200); expect(await r.json()).toMatchObject({ status: "ok" }); }); test("keycloak realm metadata is exposed", async ({ request }) => { const url = process.env.PLAYWRIGHT_KEYCLOAK_URL ?? "http://localhost:8080/realms/breakpilot-dev"; const r = await request.get(`${url}/.well-known/openid-configuration`); expect(r.status()).toBe(200); const cfg = await r.json(); expect(cfg.issuer).toContain("breakpilot-dev"); }); });