test: add workspace ref in e2e (#3217)

This commit is contained in:
Alex Yang
2023-07-13 20:41:46 +08:00
committed by GitHub
parent 64cf297399
commit d18df12951
18 changed files with 140 additions and 101 deletions
-24
View File
@@ -1,8 +1,4 @@
import type { Page } from '@playwright/test';
import { expect } from '@playwright/test';
import { clickCollaborationPanel } from './setting';
import { clickSideBarSettingButton } from './sidebar';
interface CreateWorkspaceParams {
name: string;
@@ -29,23 +25,3 @@ export async function createWorkspace(
// click create button
return page.getByRole('button', { name: 'Create' }).click();
}
export async function assertCurrentWorkspaceFlavour(
flavour: 'affine' | 'local',
page: Page
) {
// @ts-expect-error
const actual = await page.evaluate(() => globalThis.currentWorkspace.flavour);
expect(actual).toBe(flavour);
}
export async function enableAffineCloudWorkspace(page: Page) {
await clickSideBarSettingButton(page);
await page.waitForTimeout(50);
await clickCollaborationPanel(page);
await page.getByTestId('local-workspace-enable-cloud-button').click();
await page.getByTestId('confirm-enable-cloud-button').click();
await page.waitForSelector("[data-testid='member-length']", {
timeout: 20000,
});
}