Files
portal/tests/e2e/tenant.spec.ts
T
sharang 3310a942f2
ci / shared (push) Successful in 5s
ci / test (push) Successful in 33s
ci / e2e (push) Has been skipped
ci / image (push) Has been skipped
fix(test): assert real shipped behaviour for signed-out /products
Caught during live local-smoke run.

Refs: M4.2/M5.3
2026-05-19 15:09:01 +00:00

29 lines
1.3 KiB
TypeScript

import { expect, test } from "@playwright/test";
// Tenant subdomain tests — no OIDC click-through (Keycloak in headless mode
// is flaky); we just assert the SIGNED-OUT view of each protected route
// renders the expected gate. Once the realm grows a service-account flow
// for testing (M5.x), we'll bolt on a signed-in suite.
test.describe("tenant subdomain @needs-stack", () => {
test("acme dashboard renders the Sign-in button when signed out", async ({ page }) => {
await page.goto("/dashboard");
await expect(page.getByRole("heading", { name: /Sign in to acme/i })).toBeVisible();
await expect(page.getByRole("button", { name: /Sign in with Keycloak/i })).toBeVisible();
});
test("acme /products is gated when signed out", async ({ page }) => {
await page.goto("/products");
// Signed-out session means canSee(null, "products") is false, so the
// page renders the 'NotAuthorized' component. The dashboard route is
// the only place that surfaces the Sign-in button today — we'll add
// a redirect-to-sign-in in M10.1 once the surface set firms up.
await expect(page.getByRole("heading", { name: /403/i })).toBeVisible();
});
test("unknown tenant slug 404s", async ({ page }) => {
const resp = await page.goto("http://nope-nope.localhost:3000/dashboard");
expect(resp?.status()).toBe(404);
});
});