mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 10:42:00 +03:00
9ab9c0c70d
Co-authored-by: Alex Yang <himself65@outlook.com>
30 lines
740 B
TypeScript
30 lines
740 B
TypeScript
import type { Page } from '@playwright/test';
|
|
|
|
interface CreateWorkspaceParams {
|
|
name: string;
|
|
}
|
|
|
|
export async function openWorkspaceListModal(page: Page) {
|
|
const workspaceName = page.getByTestId('workspace-name');
|
|
await workspaceName.click();
|
|
}
|
|
|
|
export async function createWorkspace(
|
|
params: CreateWorkspaceParams,
|
|
page: Page
|
|
) {
|
|
await openWorkspaceListModal(page);
|
|
|
|
// open create workspace modal
|
|
await page.getByTestId('new-workspace').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({
|
|
delay: 500,
|
|
});
|
|
}
|