- Add JWT middleware unit tests (8 tests covering all auth edge cases) - Add WebSocket hub tests (5 tests for client lifecycle and broadcast) - Add full HTTP integration tests (12 tests through real Chi router with DB) - Add frontend component tests for login, issues, and issue detail pages - Add auth context unit tests (9 tests for login/logout/name resolution) - Add Playwright E2E tests for auth, issues, comments, and navigation - Configure Vitest with jsdom, React plugin, and path aliases Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { test, expect } from "@playwright/test";
|
|
import { loginAsDefault, openWorkspaceMenu } from "./helpers";
|
|
|
|
test.describe("Authentication", () => {
|
|
test("login page renders correctly", async ({ page }) => {
|
|
await page.goto("/login");
|
|
|
|
await expect(page.locator("h1")).toContainText("Multica");
|
|
await expect(page.locator('input[placeholder="Email"]')).toBeVisible();
|
|
await expect(page.locator('input[placeholder="Name"]')).toBeVisible();
|
|
await expect(page.locator('button[type="submit"]')).toContainText(
|
|
"Sign in",
|
|
);
|
|
});
|
|
|
|
test("login and redirect to /issues", async ({ page }) => {
|
|
await loginAsDefault(page);
|
|
|
|
await expect(page).toHaveURL(/\/issues/);
|
|
await expect(page.locator("text=All Issues")).toBeVisible();
|
|
});
|
|
|
|
test("unauthenticated user is redirected to /login", async ({ page }) => {
|
|
await page.goto("/login");
|
|
await page.evaluate(() => {
|
|
localStorage.removeItem("multica_token");
|
|
localStorage.removeItem("multica_workspace_id");
|
|
});
|
|
|
|
await page.goto("/issues");
|
|
await page.waitForURL("**/login", { timeout: 10000 });
|
|
});
|
|
|
|
test("logout redirects to /login", async ({ page }) => {
|
|
await loginAsDefault(page);
|
|
|
|
// Open the workspace dropdown menu
|
|
await openWorkspaceMenu(page);
|
|
|
|
// Click Sign out
|
|
await page.locator("text=Sign out").click();
|
|
|
|
await page.waitForURL("**/login", { timeout: 10000 });
|
|
await expect(page).toHaveURL(/\/login/);
|
|
});
|
|
});
|