32a20b3498
Four real surfaces backed by live tenant-registry data:
/[slug]/settings read-only tenant identity + plan + status
+ lifecycle dates with badge for status
/[slug]/settings/api-keys full CRUD: list active + revoked keys,
create form, plaintext-shown-once banner,
revoke action
/[slug]/audit paginated table with cursor-based next-page
navigation, action+actor_id GET filters,
formatRelative timestamps, metadata
preview
/[slug]/products live entitlements (filtered to enabled),
trial expiry chip, links to catalog when
empty
Five remaining surfaces upgraded to milestone-aware empty states
(projects / users / integrations / billing / support) with CTAs where
useful — billing links to catalog, support points at oncall@.
ShellEmpty component grew a 'details' string and a 'cta' ReactNode
slot so the empty pages don't all look identical.
Library additions:
src/lib/format.ts formatRelative, formatDateTime, truncate
src/lib/tenant-registry fetchAPIKeys, createAPIKey, revokeAPIKey,
fetchAudit — typed result shapes so server
actions can branch cleanly
Tests:
src/lib/format.test.ts 12 cases, 100% coverage
src/lib/tenant-registry.test +14 cases for new client methods,
100% line+branch+function
tests/e2e/surfaces.spec.ts one canary per of 10 customer-area
routes (signed-out → 403)
CI all green: lint / typecheck / test / build.
Refs: M10.1
27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
// One canary per shell surface — confirms the route mounts and renders
|
|
// SOMETHING the user can see (heading or 403 gate) without OIDC.
|
|
// All run signed-out, so role-gated routes land on the NotAuthorized 403.
|
|
|
|
test.describe("customer-area surfaces @needs-stack", () => {
|
|
const surfaces = [
|
|
{ path: "/products", expected: "403" },
|
|
{ path: "/projects", expected: "403" },
|
|
{ path: "/catalog", expected: "403" },
|
|
{ path: "/settings", expected: "403" },
|
|
{ path: "/settings/users", expected: "403" },
|
|
{ path: "/settings/api-keys", expected: "403" },
|
|
{ path: "/settings/integrations", expected: "403" },
|
|
{ path: "/billing", expected: "403" },
|
|
{ path: "/audit", expected: "403" },
|
|
{ path: "/support", expected: "403" },
|
|
];
|
|
for (const { path, expected } of surfaces) {
|
|
test(`acme${path} renders signed-out`, async ({ page }) => {
|
|
await page.goto(path);
|
|
await expect(page.getByRole("heading", { name: new RegExp(expected, "i") })).toBeVisible();
|
|
});
|
|
}
|
|
});
|