multica/e2e/helpers.ts
Jiayuan Zhang 1ba0fb071a fix(web): fix stale state bugs, add real-time updates, and build verification pipeline
- Fix kanban board columns not adapting to available width (w-64 → flex-1)
- Fix workspace name not updating in sidebar after save in settings
- Fix comments leaking across issues when navigating between issue details
- Fix duplicate issue appearing on create (race between callback and WebSocket)
- Add real-time WebSocket listeners for agents and inbox pages
- Add `make check` one-click verification pipeline (typecheck + tests + E2E)
- Add E2E test fixtures for self-contained test data setup/teardown
- Add settings E2E test and updateWorkspace unit test
- Make `make start/setup` reuse existing PostgreSQL if already running
- Update CLAUDE.md with AI agent verification loop and E2E test patterns

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 12:44:49 +08:00

37 lines
1.2 KiB
TypeScript

import { type Page } from "@playwright/test";
import { TestApiClient } from "./fixtures";
/**
* 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.
*/
/**
* Create a TestApiClient logged in as the default seeded user.
* Call api.cleanup() in afterEach to remove test data created during the test.
*/
export async function createTestApi(): Promise<TestApiClient> {
const api = new TestApiClient();
await api.login("jiayuan@multica.ai", "Jiayuan Zhang");
const workspaces = await api.getWorkspaces();
if (workspaces.length > 0) {
api.setWorkspaceId(workspaces[0].id);
}
return api;
}
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" });
}