Adds a `withWorkspace` Playwright fixture plus composable helpers (permissions, sidebar, composer, agent-stream, settings) so specs read as user-level intent. Migrates workspace-lifecycle and settings-host-page to the new DSL as proof.
22 lines
778 B
TypeScript
22 lines
778 B
TypeScript
import { expect, type Page } from "@playwright/test";
|
|
|
|
function requireServerId(): string {
|
|
const serverId = process.env.E2E_SERVER_ID;
|
|
if (!serverId) {
|
|
throw new Error("E2E_SERVER_ID is not set (expected from Playwright globalSetup).");
|
|
}
|
|
return serverId;
|
|
}
|
|
|
|
export async function selectWorkspaceInSidebar(page: Page, workspaceId: string): Promise<void> {
|
|
const row = page.getByTestId(`sidebar-workspace-row-${requireServerId()}:${workspaceId}`);
|
|
await expect(row).toBeVisible({ timeout: 30_000 });
|
|
await row.click();
|
|
}
|
|
|
|
export async function expectWorkspaceListed(page: Page, name: string): Promise<void> {
|
|
await expect(
|
|
page.locator('[data-testid^="sidebar-workspace-row-"]').filter({ hasText: name }).first(),
|
|
).toBeVisible({ timeout: 30_000 });
|
|
}
|