There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
test: add workspace ref in e2e (#3217)
Alex Yangd18df1295120
diff --git a/apps/electron/e2e/fixture.ts b/apps/electron/e2e/fixture.tsindex 75b95ee15c..1f8e9721a9 100644--- a/apps/electron/e2e/fixture.ts+++ b/apps/electron/e2e/fixture.ts@@ -26,10 +26,6 @@ export const test = base.extend<{appData: string;sessionData: string;};- workspace: {- // get current workspace- current: () => Promise<any>; // todo: type- };router: {goto: (path: RoutePath) => Promise<void>;};@@ -121,14 +117,4 @@ export const test = base.extend<{});await use(appInfo);},- workspace: async ({ page }, use) => {- await use({- current: async () => {- return await page.evaluate(async () => {- // @ts-expect-error- return globalThis.currentWorkspace;- });- },- });- },});diff --git a/tests/affine-local/e2e/invite-code-page.spec.ts b/tests/affine-local/e2e/invite-code-page.spec.tsdeleted file mode 100644index 17817ad170..0000000000--- a/tests/affine-local/e2e/invite-code-page.spec.ts+++ /dev/null@@ -1,8 +0,0 @@-import { test } from '@affine-test/kit/playwright';-import { expect } from '@playwright/test';--test('the link has expired', async ({ page }) => {- await page.goto('http://localhost:8080//invite/abc');- await page.waitForTimeout(1000);- expect(page.getByText('The link has expired')).not.toBeUndefined();-});diff --git a/tests/affine-local/e2e/local-first-avatar.spec.ts b/tests/affine-local/e2e/local-first-avatar.spec.tsindex 948382c45a..5d2286d7ed 100644--- a/tests/affine-local/e2e/local-first-avatar.spec.ts+++ b/tests/affine-local/e2e/local-first-avatar.spec.ts@@ -3,10 +3,12 @@ import { resolve } from 'node:path';import { rootDir, test } from '@affine-test/kit/playwright';import { openHomePage } from '@affine-test/kit/utils/load-page';import { newPage, waitEditorLoad } from '@affine-test/kit/utils/page-logic';-import { assertCurrentWorkspaceFlavour } from '@affine-test/kit/utils/workspace';import { expect } from '@playwright/test';-test('should create a page with a local first avatar', async ({ page }) => {+test('should create a page with a local first avatar', async ({+ page,+ workspace,+}) => {await openHomePage(page);await waitEditorLoad(page);await newPage(page);@@ -35,5 +37,7 @@ test('should create a page with a local first avatar', async ({ page }) => {.getAttribute('src');// out user uploaded avatarexpect(blobUrl).toContain('blob:');- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});diff --git a/tests/affine-local/e2e/local-first-collections-items.spec.ts b/tests/affine-local/e2e/local-first-collections-items.spec.tsindex 4d2b7ba42f..c0c3a32eff 100644--- a/tests/affine-local/e2e/local-first-collections-items.spec.ts+++ b/tests/affine-local/e2e/local-first-collections-items.spec.ts@@ -111,6 +111,7 @@ test('edit collection', async ({ page }) => {await page.waitForTimeout(100);expect(await first.textContent()).toBe('123');});+test('edit collection and change filter date', async ({ page }) => {await createAndPinCollection(page);const collections = page.getByTestId('collections');diff --git a/tests/affine-local/e2e/local-first-delete-page.spec.ts b/tests/affine-local/e2e/local-first-delete-page.spec.tsindex 51a8b7ecc9..857ff3894f 100644--- a/tests/affine-local/e2e/local-first-delete-page.spec.ts+++ b/tests/affine-local/e2e/local-first-delete-page.spec.ts@@ -5,11 +5,11 @@ import {newPage,waitEditorLoad,} from '@affine-test/kit/utils/page-logic';-import { assertCurrentWorkspaceFlavour } from '@affine-test/kit/utils/workspace';import { expect } from '@playwright/test';test('New a page , then delete it in all pages, permanently delete it', async ({page,+ workspace,}) => {await openHomePage(page);await waitEditorLoad(page);@@ -50,5 +50,7 @@ test('New a page , then delete it in all pages, permanently delete it', async ({'Tips: Click Add to Favorites/Trash and the page will appear here.')).not.toBeUndefined();- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});diff --git a/tests/affine-local/e2e/local-first-delete-workspace.spec.ts b/tests/affine-local/e2e/local-first-delete-workspace.spec.tsindex ee44efbbbb..ae000c1e02 100644--- a/tests/affine-local/e2e/local-first-delete-workspace.spec.ts+++ b/tests/affine-local/e2e/local-first-delete-workspace.spec.ts@@ -4,10 +4,9 @@ import { waitEditorLoad } from '@affine-test/kit/utils/page-logic';import { openWorkspaceSettingPanel } from '@affine-test/kit/utils/setting';import { openSettingModal } from '@affine-test/kit/utils/setting';import { clickSideBarCurrentWorkspaceBanner } from '@affine-test/kit/utils/sidebar';-import { assertCurrentWorkspaceFlavour } from '@affine-test/kit/utils/workspace';import { expect } from '@playwright/test';-test('Create new workspace, then delete it', async ({ page }) => {+test('Create new workspace, then delete it', async ({ page, workspace }) => {await openHomePage(page);await waitEditorLoad(page);await clickSideBarCurrentWorkspaceBanner(page);@@ -43,7 +42,9 @@ test('Create new workspace, then delete it', async ({ page }) => {expect(await page.getByTestId('workspace-name').textContent()).toBe('Demo Workspace');- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});test('Delete last workspace', async ({ page }) => {diff --git a/tests/affine-local/e2e/local-first-export-page.spec.ts b/tests/affine-local/e2e/local-first-export-page.spec.tsindex ed056f0bd1..aac4ea06c7 100644--- a/tests/affine-local/e2e/local-first-export-page.spec.ts+++ b/tests/affine-local/e2e/local-first-export-page.spec.ts@@ -6,10 +6,12 @@ import {newPage,waitEditorLoad,} from '@affine-test/kit/utils/page-logic';-import { assertCurrentWorkspaceFlavour } from '@affine-test/kit/utils/workspace';import { expect } from '@playwright/test';-test.skip('New a page ,then open it and export html', async ({ page }) => {+test.skip('New a page ,then open it and export html', async ({+ page,+ workspace,+}) => {await openHomePage(page);await waitEditorLoad(page);await newPage(page);@@ -37,9 +39,15 @@ test.skip('New a page ,then open it and export html', async ({ page }) => {expect(download.suggestedFilename()).toBe('this is a new page to export html content.html');+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});-test.skip('New a page ,then open it and export markdown', async ({ page }) => {+test.skip('New a page ,then open it and export markdown', async ({+ page,+ workspace,+}) => {await newPage(page);await getBlockSuiteEditorTitle(page).click();await page@@ -64,5 +72,7 @@ test.skip('New a page ,then open it and export markdown', async ({ page }) => {expect(download.suggestedFilename()).toBe('this is a new page to export markdown content.md');- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});diff --git a/tests/affine-local/e2e/local-first-favorite-page.spec.ts b/tests/affine-local/e2e/local-first-favorite-page.spec.tsindex a05ca4a4b4..48e1007f82 100644--- a/tests/affine-local/e2e/local-first-favorite-page.spec.ts+++ b/tests/affine-local/e2e/local-first-favorite-page.spec.ts@@ -7,10 +7,12 @@ import {waitEditorLoad,} from '@affine-test/kit/utils/page-logic';import { waitForLogMessage } from '@affine-test/kit/utils/utils';-import { assertCurrentWorkspaceFlavour } from '@affine-test/kit/utils/workspace';import { expect } from '@playwright/test';-test('New a page and open it ,then favorite it', async ({ page }) => {+test('New a page and open it ,then favorite it', async ({+ page,+ workspace,+}) => {await openHomePage(page);await waitEditorLoad(page);await newPage(page);@@ -26,7 +28,9 @@ test('New a page and open it ,then favorite it', async ({ page }) => {await clickPageMoreActions(page);const favoriteBtn = page.getByTestId('editor-option-menu-favorite');await favoriteBtn.click();- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});test('Export to html, markdown and png', async ({ page }) => {@@ -74,7 +78,7 @@ test.skip('Export to pdf', async ({ page }) => {}});-test('Cancel favorite', async ({ page }) => {+test('Cancel favorite', async ({ page, workspace }) => {await openHomePage(page);await waitEditorLoad(page);await newPage(page);@@ -115,5 +119,7 @@ test('Cancel favorite', async ({ page }) => {'Tips: Click Add to Favorites/Trash and the page will appear here.')).not.toBeUndefined();- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});diff --git a/tests/affine-local/e2e/local-first-favorites-items.spec.ts b/tests/affine-local/e2e/local-first-favorites-items.spec.tsindex d89063fe71..e2bd320927 100644--- a/tests/affine-local/e2e/local-first-favorites-items.spec.ts+++ b/tests/affine-local/e2e/local-first-favorites-items.spec.ts@@ -9,7 +9,7 @@ import {} from '@affine-test/kit/utils/page-logic';import { expect } from '@playwright/test';-test('Show favorite items in sidebar', async ({ page }) => {+test('Show favorite items in sidebar', async ({ page, workspace }) => {await openHomePage(page);await waitEditorLoad(page);await newPage(page);@@ -32,9 +32,12 @@ test('Show favorite items in sidebar', async ({ page }) => {expect(await favoriteListItemInSidebar.textContent()).toBe('this is a new page to favorite');+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});-test('Show favorite reference in sidebar', async ({ page }) => {+test('Show favorite reference in sidebar', async ({ page, workspace }) => {await openHomePage(page);await waitEditorLoad(page);await newPage(page);@@ -69,10 +72,14 @@ test('Show favorite reference in sidebar', async ({ page }) => {await expect(page.locator('[data-type="favorite-list-item"] >> text=Another page')).toBeVisible();+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});test("Deleted page's reference will not be shown in sidebar", async ({page,+ workspace,}) => {await openHomePage(page);await waitEditorLoad(page);@@ -116,4 +123,7 @@ test("Deleted page's reference will not be shown in sidebar", async ({);await expect(collapseButton).not.toBeVisible();+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});diff --git a/tests/affine-local/e2e/local-first-new-page.spec.ts b/tests/affine-local/e2e/local-first-new-page.spec.tsindex 4791877f95..11a75330e2 100644--- a/tests/affine-local/e2e/local-first-new-page.spec.ts+++ b/tests/affine-local/e2e/local-first-new-page.spec.ts@@ -5,20 +5,24 @@ import {newPage,waitEditorLoad,} from '@affine-test/kit/utils/page-logic';-import { assertCurrentWorkspaceFlavour } from '@affine-test/kit/utils/workspace';import { expect } from '@playwright/test';-test('click btn new page', async ({ page }) => {+test('click btn new page', async ({ page, workspace }) => {await openHomePage(page);await waitEditorLoad(page);const originPageId = page.url().split('/').reverse()[0];await newPage(page);const newPageId = page.url().split('/').reverse()[0];expect(newPageId).not.toBe(originPageId);- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});-test('click btn bew page and find it in all pages', async ({ page }) => {+test('click btn bew page and find it in all pages', async ({+ page,+ workspace,+}) => {await openHomePage(page);await waitEditorLoad(page);await newPage(page);@@ -27,5 +31,7 @@ test('click btn bew page and find it in all pages', async ({ page }) => {await page.getByTestId('all-pages').click();const cell = page.getByRole('cell', { name: 'this is a new page' });expect(cell).not.toBeUndefined();- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});diff --git a/tests/affine-local/e2e/local-first-openpage-newtab.spec.ts b/tests/affine-local/e2e/local-first-openpage-newtab.spec.tsindex 81b06a783e..eaebd1b3ae 100644--- a/tests/affine-local/e2e/local-first-openpage-newtab.spec.ts+++ b/tests/affine-local/e2e/local-first-openpage-newtab.spec.ts@@ -5,10 +5,9 @@ import {newPage,waitEditorLoad,} from '@affine-test/kit/utils/page-logic';-import { assertCurrentWorkspaceFlavour } from '@affine-test/kit/utils/workspace';import { expect } from '@playwright/test';-test('click btn bew page and open in tab', async ({ page }) => {+test('click btn bew page and open in tab', async ({ page, workspace }) => {await openHomePage(page);await waitEditorLoad(page);await newPage(page);@@ -30,5 +29,7 @@ test('click btn bew page and open in tab', async ({ page }) => {]);expect(newTabPage.url()).toBe(newPageUrl);- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});diff --git a/tests/affine-local/e2e/local-first-restore-page.spec.ts b/tests/affine-local/e2e/local-first-restore-page.spec.tsindex b9edde0497..a28bfcabb0 100644--- a/tests/affine-local/e2e/local-first-restore-page.spec.ts+++ b/tests/affine-local/e2e/local-first-restore-page.spec.ts@@ -5,11 +5,11 @@ import {newPage,waitEditorLoad,} from '@affine-test/kit/utils/page-logic';-import { assertCurrentWorkspaceFlavour } from '@affine-test/kit/utils/workspace';import { expect } from '@playwright/test';test('New a page , then delete it in all pages, restore it', async ({page,+ workspace,}) => {await openHomePage(page);await waitEditorLoad(page);@@ -52,5 +52,7 @@ test('New a page , then delete it in all pages, restore it', async ({name: 'this is a new page to restore',});expect(restoreCell).not.toBeUndefined();- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});diff --git a/tests/affine-local/e2e/local-first-show-delete-modal.spec.ts b/tests/affine-local/e2e/local-first-show-delete-modal.spec.tsindex d52cd2f991..c58fdebd68 100644--- a/tests/affine-local/e2e/local-first-show-delete-modal.spec.ts+++ b/tests/affine-local/e2e/local-first-show-delete-modal.spec.ts@@ -6,10 +6,12 @@ import {newPage,waitEditorLoad,} from '@affine-test/kit/utils/page-logic';-import { assertCurrentWorkspaceFlavour } from '@affine-test/kit/utils/workspace';import { expect } from '@playwright/test';-test('New a page ,then open it and show delete modal', async ({ page }) => {+test('New a page ,then open it and show delete modal', async ({+ page,+ workspace,+}) => {await openHomePage(page);await waitEditorLoad(page);await newPage(page);@@ -27,11 +29,14 @@ test('New a page ,then open it and show delete modal', async ({ page }) => {await deleteBtn.click();const confirmTip = page.getByText('Delete page?');expect(confirmTip).not.toBeUndefined();- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});test('New a page ,then go to all pages and show delete modal', async ({page,+ workspace,}) => {await openHomePage(page);await waitEditorLoad(page);@@ -54,5 +59,7 @@ test('New a page ,then go to all pages and show delete modal', async ({await deleteBtn.click();const confirmTip = page.getByText('Delete page?');expect(confirmTip).not.toBeUndefined();- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});diff --git a/tests/affine-local/e2e/local-first-trash-page.spec.ts b/tests/affine-local/e2e/local-first-trash-page.spec.tsindex e1f9b44096..72ff4b482f 100644--- a/tests/affine-local/e2e/local-first-trash-page.spec.ts+++ b/tests/affine-local/e2e/local-first-trash-page.spec.ts@@ -5,11 +5,11 @@ import {newPage,waitEditorLoad,} from '@affine-test/kit/utils/page-logic';-import { assertCurrentWorkspaceFlavour } from '@affine-test/kit/utils/workspace';import { expect } from '@playwright/test';test('New a page , then delete it in all pages, finally find it in trash', async ({page,+ workspace,}) => {await openHomePage(page);await waitEditorLoad(page);@@ -39,5 +39,7 @@ test('New a page , then delete it in all pages, finally find it in trash', asyncexpect(page.getByRole('cell', { name: 'this is a new page to delete' })).not.toBeUndefined();- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});diff --git a/tests/affine-local/e2e/local-first-workspace-list.spec.ts b/tests/affine-local/e2e/local-first-workspace-list.spec.tsindex 96684c1320..6dfb9891dd 100644--- a/tests/affine-local/e2e/local-first-workspace-list.spec.ts+++ b/tests/affine-local/e2e/local-first-workspace-list.spec.ts@@ -8,7 +8,10 @@ import {} from '@affine-test/kit/utils/workspace';import { expect } from '@playwright/test';-test('just one item in the workspace list at first', async ({ page }) => {+test('just one item in the workspace list at first', async ({+ page,+ workspace,+}) => {await openHomePage(page);await waitEditorLoad(page);const workspaceName = page.getByTestId('workspace-name');@@ -19,9 +22,15 @@ test('just one item in the workspace list at first', async ({ page }) => {.filter({ hasText: 'AFFiNE TestLocal WorkspaceAvailable Offline' }).nth(3)).not.toBeNull();+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});-test('create one workspace in the workspace list', async ({ page }) => {+test('create one workspace in the workspace list', async ({+ page,+ workspace,+}) => {await openHomePage(page);await waitEditorLoad(page);const newWorkspaceNameStr = 'New Workspace';@@ -48,9 +57,15 @@ test('create one workspace in the workspace list', async ({ page }) => {const pageList1 = page.locator('[data-testid=page-list-item]');const result1 = await pageList1.count();expect(result1).toBe(0);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});-test('create multi workspace in the workspace list', async ({ page }) => {+test('create multi workspace in the workspace list', async ({+ page,+ workspace,+}) => {await openHomePage(page);await waitEditorLoad(page);await createWorkspace({ name: 'New Workspace 2' }, page);@@ -71,8 +86,9 @@ test('create multi workspace in the workspace list', async ({ page }) => {await page.getByTestId('draggable-item').nth(1).click();await page.waitForTimeout(500);- // @ts-expect-error- const currentId: string = await page.evaluate(() => currentWorkspace.id);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');await openWorkspaceListModal(page);const sourceElement = page.getByTestId('draggable-item').nth(2);@@ -122,7 +138,7 @@ test('create multi workspace in the workspace list', async ({ page }) => {await page.getByTestId('draggable-item').nth(2).click();await workspaceChangePromise;- // @ts-expect-error- const nextId: string = await page.evaluate(() => currentWorkspace.id);- expect(currentId).toBe(nextId);+ const nextWorkspace = await workspace.current();++ expect(currentWorkspace.id).toBe(nextWorkspace.id);});diff --git a/tests/affine-local/e2e/local-first-workspace.spec.ts b/tests/affine-local/e2e/local-first-workspace.spec.tsindex d754f27600..446af6ac0e 100644--- a/tests/affine-local/e2e/local-first-workspace.spec.ts+++ b/tests/affine-local/e2e/local-first-workspace.spec.ts@@ -1,25 +1,20 @@import { test } from '@affine-test/kit/playwright';import { openHomePage } from '@affine-test/kit/utils/load-page';import { waitEditorLoad } from '@affine-test/kit/utils/page-logic';-import { assertCurrentWorkspaceFlavour } from '@affine-test/kit/utils/workspace';import { expect } from '@playwright/test';-test('preset workspace name', async ({ page }) => {+test('preset workspace name', async ({ page, workspace }) => {await openHomePage(page);await waitEditorLoad(page);const workspaceName = page.getByTestId('workspace-name');await page.waitForTimeout(1000);expect(await workspaceName.textContent()).toBe('Demo Workspace');- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});-// test('default workspace avatar', async ({ page }) => {-// const workspaceAvatar = page.getByTestId('workspace-avatar');-// expect(-// await workspaceAvatar.locator('img').getAttribute('src')-// ).not.toBeNull();-// });-test('Open language switch menu', async ({ page }) => {+test('Open language switch menu', async ({ page, workspace }) => {await openHomePage(page);await waitEditorLoad(page);const editorOptionMenuButton = page.getByTestId('editor-option-menu');@@ -29,5 +24,7 @@ test('Open language switch menu', async ({ page }) => {await expect(languageMenuButton).toBeVisible();const actual = await languageMenuButton.innerText();expect(actual).toEqual('English');- await assertCurrentWorkspaceFlavour('local', page);+ const currentWorkspace = await workspace.current();++ expect(currentWorkspace.flavour).toContain('local');});diff --git a/tests/kit/playwright.ts b/tests/kit/playwright.tsindex 286b73af06..81e41be0f4 100644--- a/tests/kit/playwright.ts+++ b/tests/kit/playwright.ts@@ -4,6 +4,7 @@ import fs from 'node:fs';import path, { resolve } from 'node:path';import process from 'node:process';+import type { Workspace } from '@blocksuite/store';import { test as baseTest } from '@playwright/test';export const rootDir = resolve(__dirname, '..', '..');@@ -26,7 +27,26 @@ function generateUUID() {export const enableCoverage = !!process.env.CI || !!process.env.COVERAGE;-export const test = baseTest.extend({+type CurrentWorkspace = {+ id: string;+ flavour: string;+ blockSuiteWorkspace: Workspace;+};++export const test = baseTest.extend<{+ workspace: {+ current: () => Promise<CurrentWorkspace>;+ };+}>({+ workspace: async ({ page }, use) => {+ await use({+ current: async () => {+ return await page.evaluate(async () => {+ return (globalThis as any).currentWorkspace;+ });+ },+ });+ },context: async ({ context }, use) => {if (enableCoverage) {await context.addInitScript(() =>diff --git a/tests/kit/utils/workspace.ts b/tests/kit/utils/workspace.tsindex 06b50807ea..9f92bbe8b9 100644--- a/tests/kit/utils/workspace.ts+++ b/tests/kit/utils/workspace.ts@@ -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 buttonreturn 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,- });-}