Files
clawmates/frontend/tests/e2e/p0-shell.spec.ts
T
Omar SobhandClaude Fable 5 200bb56299 R5: marketing landing — light-theme public site at /
A new (marketing) route group with its own LIGHT layout (slate palette +
marketing coral #E95656 + periwinkle cards on near-white), the inverse of
the dark app. The middleware rewrites '/' → /marketing for logged-out
visitors (keyed on the session cookie / Clerk __session); authed users
fall through to the workspace app unchanged.

Built to the measured marketing system with OUR copy and honest claims —
NO SOC 2 / compliance badges: floating white pill nav, the 75px/800/-3px
display hero with a single coral keyword span, dual pill CTAs (coral
primary / white-bordered secondary), trust badges ('free credits',
'no credit card', 'self-hostable & air-gapped'), periwinkle feature
cards, a structural-security section (approval-gated, broker-held creds,
air-gappable — our real differentiators), an interactive FAQ accordion,
CTA band, and footer.

E2E (p7-marketing): renders for logged-out visitors, FAQ accordion works,
asserts NO SOC 2 claim, and an axe pass (coral CTAs sized to clear the
AA large-text threshold). p0-shell updated: logged-out '/' now shows
marketing with a Sign-in link to /login.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-06-10 20:13:09 -05:00

90 lines
3.3 KiB
TypeScript

import { expect, test } from "@playwright/test";
// P0 exit criterion (spec §17): an authenticated empty shell against the
// real backend. Seed data comes from clawmates-server's e2e mode.
const OWNER_EMAIL = "[email protected]";
const OWNER_PASSWORD = "e2e-password";
async function signIn(page: import("@playwright/test").Page) {
await page.goto("/login");
await page.getByLabel("Email").fill(OWNER_EMAIL);
await page.getByLabel("Password").fill(OWNER_PASSWORD);
await page.getByRole("button", { name: "Sign in" }).click();
await expect(page.getByRole("heading", { name: "Clawmates" })).toBeVisible();
}
test("unauthenticated visitors see the marketing landing", async ({ page }) => {
await page.goto("/");
// "/" rewrites to the public marketing site for logged-out visitors.
await expect(
page.getByRole("heading", { name: /AI coworkers/ }),
).toBeVisible();
// Sign-in is a link from the marketing nav.
await page.getByRole("link", { name: "Sign in" }).first().click();
await expect(page).toHaveURL(/\/login$/);
});
test("wrong password shows an error and stays on login", async ({ page }) => {
await page.goto("/login");
await page.getByLabel("Email").fill(OWNER_EMAIL);
await page.getByLabel("Password").fill("wrong-password");
await page.getByRole("button", { name: "Sign in" }).click();
// Next.js's route announcer is also role="alert"; scope to the form's.
await expect(
page.getByRole("alert").filter({ hasText: "Invalid" }),
).toHaveText("Invalid email or password.");
await expect(page).toHaveURL(/\/login$/);
});
test("signing in reveals the shell: rail, roster, and current user", async ({
page,
}) => {
await signIn(page);
const rail = page.getByRole("complementary");
await expect(rail.getByText("clawmates")).toBeVisible();
await expect(
rail.getByRole("list", { name: "Your claws" }).getByText("Scout"),
).toBeVisible();
await expect(
rail.getByRole("status", { name: "Scout is online" }),
).toBeVisible();
await expect(rail.getByText("Avery Owner")).toBeVisible();
});
test("team page lists workspace members from the real API", async ({
page,
}) => {
await signIn(page);
await page.getByRole("link", { name: "Team" }).click();
await expect(
page.getByRole("heading", { name: "Team", exact: true }),
).toBeVisible();
await expect(page.getByText("1 member in your workspace")).toBeVisible();
const row = page.getByRole("row").filter({ hasText: "Avery Owner" });
await expect(row.getByText(OWNER_EMAIL)).toBeVisible();
await expect(row.getByText("Owner", { exact: true })).toBeVisible();
});
test("credits page shows the seeded balance", async ({ page }) => {
await signIn(page);
await page.getByRole("link", { name: "Credits" }).click();
await expect(
page.getByRole("heading", { name: "Credits", exact: true }),
).toBeVisible();
await expect(page.getByTestId("credit-balance")).toHaveText("1,250");
});
test("signing out returns to login and revokes the session", async ({
page,
}) => {
await signIn(page);
await page.getByRole("button", { name: "Sign out" }).click();
await expect(page).toHaveURL(/\/login$/);
// Session revoked: "/" no longer shows the app, it shows marketing.
await page.goto("/");
await expect(
page.getByRole("heading", { name: /AI coworkers/ }),
).toBeVisible();
});