AFFiNE/tests/libs/workspace-logic.ts
2023-02-08 17:48:03 +08:00

23 lines
640 B
TypeScript

import type { Page } from '@playwright/test';
interface CreateWorkspaceParams {
name: string;
}
export async function createWorkspace(
params: CreateWorkspaceParams,
page: Page
) {
// open workspace list modal
const workspaceName = page.getByTestId('workspace-name');
await workspaceName.click();
// open create workspace modal
await page.locator('.add-icon').click();
// input workspace name
await page.getByPlaceholder('Set a Workspace name').click();
await page.getByPlaceholder('Set a Workspace name').fill(params.name);
// click create button
return page.getByRole('button', { name: 'Create' }).click();
}