multica/e2e/navigation.spec.ts
Jiayuan Zhang 6dfc61fa86 test: add comprehensive test suite (Go unit/integration, Vitest, Playwright E2E)
- 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>
2026-03-22 11:50:25 +08:00

43 lines
1.4 KiB
TypeScript

import { test, expect } from "@playwright/test";
import { loginAsDefault, openWorkspaceMenu } from "./helpers";
test.describe("Navigation", () => {
test.beforeEach(async ({ page }) => {
await loginAsDefault(page);
});
test("sidebar navigation works", async ({ page }) => {
// Click Inbox
await page.locator("nav a", { hasText: "Inbox" }).click();
await page.waitForURL("**/inbox");
await expect(page).toHaveURL(/\/inbox/);
// Click Agents
await page.locator("nav a", { hasText: "Agents" }).click();
await page.waitForURL("**/agents");
await expect(page).toHaveURL(/\/agents/);
// Click Issues
await page.locator("nav a", { hasText: "Issues" }).click();
await page.waitForURL("**/issues");
await expect(page).toHaveURL(/\/issues/);
});
test("settings page loads via workspace menu", async ({ page }) => {
// Settings is inside the workspace dropdown menu
await openWorkspaceMenu(page);
await page.locator("text=Settings").click();
await page.waitForURL("**/settings");
await expect(page.locator("text=Workspace")).toBeVisible();
await expect(page.locator("text=Members")).toBeVisible();
});
test("agents page shows agent list", async ({ page }) => {
await page.locator("nav a", { hasText: "Agents" }).click();
await page.waitForURL("**/agents");
// Should show "Agents" heading
await expect(page.locator("text=Agents").first()).toBeVisible();
});
});