multica/e2e/helpers.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

22 lines
768 B
TypeScript

import { type Page } from "@playwright/test";
/**
* Login as the seeded user (has workspace and issues).
*/
export async function loginAsDefault(page: Page) {
await page.goto("/login");
await page.fill('input[placeholder="Name"]', "Jiayuan Zhang");
await page.fill('input[placeholder="Email"]', "jiayuan@multica.ai");
await page.click('button[type="submit"]');
await page.waitForURL("**/issues", { timeout: 10000 });
}
/**
* Open the workspace switcher dropdown menu.
*/
export async function openWorkspaceMenu(page: Page) {
// Click the workspace switcher button (has ChevronDown icon)
await page.locator("aside button").first().click();
// Wait for dropdown to appear
await page.locator('[class*="popover"]').waitFor({ state: "visible" });
}