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(core): common setup for ai tests (#11644)
yoyoyohamapid494394c8d1e
diff --git a/.gitignore b/.gitignoreindex 9a253279fb..d58d487e4f 100644--- a/.gitignore+++ b/.gitignore@@ -85,3 +85,6 @@ packages/frontend/core/public/static/templatesafaf.cmd*.resolved++# playwright+storageState.jsondiff --git a/packages/frontend/core/src/modules/explorer/views/nodes/collection/operations.tsx b/packages/frontend/core/src/modules/explorer/views/nodes/collection/operations.tsxindex e337389eb7..3d035ea487 100644--- a/packages/frontend/core/src/modules/explorer/views/nodes/collection/operations.tsx+++ b/packages/frontend/core/src/modules/explorer/views/nodes/collection/operations.tsx@@ -193,6 +193,7 @@ export const useExplorerCollectionNodeOperations = (<MenuItemtype={'danger'}prefixIcon={<DeleteIcon />}+ data-testid="collection-delete-button"onClick={handleDeleteCollection}>{t['Delete']()}diff --git a/packages/frontend/core/src/modules/explorer/views/nodes/tag/operations.tsx b/packages/frontend/core/src/modules/explorer/views/nodes/tag/operations.tsxindex c81d4bf688..89c3e2a420 100644--- a/packages/frontend/core/src/modules/explorer/views/nodes/tag/operations.tsx+++ b/packages/frontend/core/src/modules/explorer/views/nodes/tag/operations.tsx@@ -145,6 +145,7 @@ export const useExplorerTagNodeOperations = (type={'danger'}prefixIcon={<DeleteIcon />}onClick={handleMoveToTrash}+ data-testid="tag-delete-button">{t['Delete']()}</MenuItem>diff --git a/tests/affine-cloud-copilot/e2e/ai-action/brainstorm-ideas-with-mind-map.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/brainstorm-ideas-with-mind-map.spec.tsindex 2fc986f9f8..f2b207abfd 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/brainstorm-ideas-with-mind-map.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/brainstorm-ideas-with-mind-map.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/BrainstormIdeasWithMindMap', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should generate a mind map for the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { brainstormMindMap } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/BrainstormIdeasWithMindMap', () => {});test('should generate a mind map for the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { brainstormMindMap } = await utils.editor.askAIWithEdgeless(@@ -40,7 +37,7 @@ test.describe('AIAction/BrainstormIdeasWithMindMap', () => {});test('should generate a mind map for the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { brainstormMindMap } = await utils.editor.askAIWithEdgeless(diff --git a/tests/affine-cloud-copilot/e2e/ai-action/change-tone.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/change-tone.spec.tsindex 219c8f8dcf..c699e0accf 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/change-tone.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/change-tone.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/ChangeTone', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support changing the tone of the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { changeTone } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/ChangeTone', () => {});test('should support changing the tone of the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { changeTone } = await utils.editor.askAIWithEdgeless(@@ -44,7 +41,7 @@ test.describe('AIAction/ChangeTone', () => {});test('should support changing the tone of the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { changeTone } = await utils.editor.askAIWithEdgeless(@@ -62,7 +59,10 @@ test.describe('AIAction/ChangeTone', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { changeTone } = await utils.editor.askAIWithText(page,'AFFiNE is a great note-taking app'diff --git a/tests/affine-cloud-copilot/e2e/ai-action/check-code-error.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/check-code-error.spec.tsindex 6135232cda..b8169ae17a 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/check-code-error.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/check-code-error.spec.ts@@ -1,17 +1,17 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/CheckCodeError', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('should support check code error', async ({ page, utils }) => {+ test('should support check code error', async ({+ loggedInPage: page,+ utils,+ }) => {const { checkCodeError } = await utils.editor.askAIWithCode(page,'consloe.log("Hello,World!");',@@ -24,7 +24,10 @@ test.describe('AIAction/CheckCodeError', () => {);});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { checkCodeError } = await utils.editor.askAIWithCode(page,'consloe.log("Hello,World!");',diff --git a/tests/affine-cloud-copilot/e2e/ai-action/continue-with-ai.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/continue-with-ai.spec.tsindex 5654417144..a1b10f97b0 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/continue-with-ai.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/continue-with-ai.spec.ts@@ -1,16 +1,16 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/ContinueWithAI', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);});- test('should support continue in chat panel', async ({ page, utils }) => {+ test('should support continue in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { continueWithAi } = await utils.editor.askAIWithText(page, 'Apple');await continueWithAi();const chatPanelInput = await page.getByTestId('chat-panel-input-container');diff --git a/tests/affine-cloud-copilot/e2e/ai-action/continue-writing.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/continue-writing.spec.tsindex da544b9f06..f9664c5908 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/continue-writing.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/continue-writing.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/ContinueWriting', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support continue writing the selected content', async ({- page,+ loggedInPage: page,utils,}) => {await page.setViewportSize({ width: 1280, height: 2000 });@@ -26,7 +23,7 @@ test.describe('AIAction/ContinueWriting', () => {});test('should support continue writing the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { continueWriting } = await utils.editor.askAIWithEdgeless(@@ -45,7 +42,7 @@ test.describe('AIAction/ContinueWriting', () => {});test('should support continue writing the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { continueWriting } = await utils.editor.askAIWithEdgeless(@@ -63,7 +60,10 @@ test.describe('AIAction/ContinueWriting', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { continueWriting } = await utils.editor.askAIWithText(page,'AFFiNE is a workspace with fully merged docs'diff --git a/tests/affine-cloud-copilot/e2e/ai-action/expand-mindmap-node.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/expand-mindmap-node.spec.tsindex e56492ff6f..c00908585e 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/expand-mindmap-node.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/expand-mindmap-node.spec.ts@@ -1,17 +1,17 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('expand mindmap node', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('should expand the mindmap node', async ({ page, utils }) => {+ test('should expand the mindmap node', async ({+ loggedInPage: page,+ utils,+ }) => {let id: string;const { expandMindMapNode } = await utils.editor.askAIWithEdgeless(page,diff --git a/tests/affine-cloud-copilot/e2e/ai-action/explain-code.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/explain-code.spec.tsindex 3d27232eb2..ed4f4b51c1 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/explain-code.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/explain-code.spec.ts@@ -1,17 +1,14 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/ExplainCode', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('should support explain code', async ({ page, utils }) => {+ test('should support explain code', async ({ loggedInPage: page, utils }) => {const { explainCode } = await utils.editor.askAIWithCode(page,'console.log("Hello, World!");',@@ -21,7 +18,10 @@ test.describe('AIAction/ExplainCode', () => {await expect(answer).toHaveText(/console.log/);});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { explainCode } = await utils.editor.askAIWithCode(page,'console.log("Hello, World!");',diff --git a/tests/affine-cloud-copilot/e2e/ai-action/explain-image.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/explain-image.spec.tsindex 865ab6cf39..8b1299d528 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/explain-image.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/explain-image.spec.ts@@ -1,4 +1,3 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';@@ -13,15 +12,13 @@ const image = {};test.describe('AIAction/ExplainImage', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support explaining the selected image', async ({- page,+ loggedInPage: page,utils,}) => {const { explainImage } = await utils.editor.askAIWithImage(page, image);@@ -30,7 +27,10 @@ test.describe('AIAction/ExplainImage', () => {expect(responses).toEqual(new Set(['insert-below', 'replace-selection']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { explainImage } = await utils.editor.askAIWithImage(page, image);const { answer } = await explainImage();const insertBelow = answer.getByTestId('answer-insert-below');diff --git a/tests/affine-cloud-copilot/e2e/ai-action/explain-selection.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/explain-selection.spec.tsindex 09f1c9451e..325cd56bd3 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/explain-selection.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/explain-selection.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/ExplainSelection', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support explaining the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { explainSelection } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/ExplainSelection', () => {});test('should support explaining the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { explainSelection } = await utils.editor.askAIWithEdgeless(@@ -41,7 +38,7 @@ test.describe('AIAction/ExplainSelection', () => {});test('should support explaining the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { explainSelection } = await utils.editor.askAIWithEdgeless(@@ -56,7 +53,10 @@ test.describe('AIAction/ExplainSelection', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { explainSelection } = await utils.editor.askAIWithText(page, 'LLM');const { answer } = await explainSelection();const replace = answer.getByTestId('answer-replace');diff --git a/tests/affine-cloud-copilot/e2e/ai-action/find-actions.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/find-actions.spec.tsindex ece8eb6c25..1878b711c6 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/find-actions.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/find-actions.spec.ts@@ -1,17 +1,17 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/FindActions', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('should find actions for selected content', async ({ page, utils }) => {+ test('should find actions for selected content', async ({+ loggedInPage: page,+ utils,+ }) => {const { findActions } = await utils.editor.askAIWithText(page,`Choose a Booking Platform@@ -39,7 +39,7 @@ Compare and Select Flights`});test('should find actions for selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { findActions } = await utils.editor.askAIWithEdgeless(@@ -71,7 +71,7 @@ Compare and Select Flights`});test('should find actions for selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { findActions } = await utils.editor.askAIWithEdgeless(@@ -102,7 +102,10 @@ Compare and Select Flights`expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { findActions } = await utils.editor.askAIWithText(page,`Choose a Booking Platformdiff --git a/tests/affine-cloud-copilot/e2e/ai-action/fix-grammar.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/fix-grammar.spec.tsindex ae0754bfd3..e7dd8e052b 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/fix-grammar.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/fix-grammar.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/FixGrammar', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support fixing grammatical errors in the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { fixGrammar } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/FixGrammar', () => {});test('should support fixing grammatical errors in the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { fixGrammar } = await utils.editor.askAIWithEdgeless(@@ -41,7 +38,7 @@ test.describe('AIAction/FixGrammar', () => {});test('should support fixing grammatical errors in the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { fixGrammar } = await utils.editor.askAIWithEdgeless(@@ -56,7 +53,10 @@ test.describe('AIAction/FixGrammar', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { fixGrammar } = await utils.editor.askAIWithText(page,'I is a student'diff --git a/tests/affine-cloud-copilot/e2e/ai-action/fix-spelling.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/fix-spelling.spec.tsindex 0ad2ff2cf6..66c52cc7f0 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/fix-spelling.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/fix-spelling.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/FixSpelling', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support fixing spelling errors in the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { fixSpelling } = await utils.editor.askAIWithText(page, 'Appel');@@ -22,7 +19,7 @@ test.describe('AIAction/FixSpelling', () => {});test('should support fixing spelling errors in the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { fixSpelling } = await utils.editor.askAIWithEdgeless(@@ -38,7 +35,7 @@ test.describe('AIAction/FixSpelling', () => {});test('should support fixing spelling errors in the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { fixSpelling } = await utils.editor.askAIWithEdgeless(@@ -53,7 +50,10 @@ test.describe('AIAction/FixSpelling', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { fixSpelling } = await utils.editor.askAIWithText(page, 'Appel');const { answer } = await fixSpelling();await expect(answer).toHaveText(/Apple/, { timeout: 10000 });diff --git a/tests/affine-cloud-copilot/e2e/ai-action/generate-an-image-with-image.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/generate-an-image-with-image.spec.tsindex f721fdeba8..6f1aa8c887 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/generate-an-image-with-image.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/generate-an-image-with-image.spec.ts@@ -1,4 +1,3 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';@@ -13,15 +12,13 @@ const image = {};test.describe('AIAction/GenerateAnImageWithImage', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should generate an image for the selected image', async ({- page,+ loggedInPage: page,utils,}) => {const { generateImage } = await utils.editor.askAIWithImage(page, image);@@ -30,7 +27,10 @@ test.describe('AIAction/GenerateAnImageWithImage', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { generateImage } = await utils.editor.askAIWithImage(page, image);const { answer } = await generateImage();await expect(answer.getByTestId('ai-answer-image')).toBeVisible();diff --git a/tests/affine-cloud-copilot/e2e/ai-action/generate-an-image-with-text.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/generate-an-image-with-text.spec.tsindex eec01e1fdc..8081b800b4 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/generate-an-image-with-text.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/generate-an-image-with-text.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/GenerateAnImageWithText', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should generate an image for the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { generateImage } = await utils.editor.askAIWithText(page, 'Panda');@@ -22,7 +19,7 @@ test.describe('AIAction/GenerateAnImageWithText', () => {});test('should generate an image for the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { generateImage } = await utils.editor.askAIWithEdgeless(@@ -37,7 +34,7 @@ test.describe('AIAction/GenerateAnImageWithText', () => {});test('should generate an image for the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { generateImage } = await utils.editor.askAIWithEdgeless(@@ -52,7 +49,7 @@ test.describe('AIAction/GenerateAnImageWithText', () => {});test('should generate an image for the selected shape in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { generateImage } = await utils.editor.askAIWithEdgeless(@@ -66,7 +63,10 @@ test.describe('AIAction/GenerateAnImageWithText', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { generateImage } = await utils.editor.askAIWithText(page, 'Panda');const { answer } = await generateImage();const insert = answer.getByTestId('answer-insert-below');diff --git a/tests/affine-cloud-copilot/e2e/ai-action/generate-headings.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/generate-headings.spec.tsindex 1b2f9ec8cd..48122f93bf 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/generate-headings.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/generate-headings.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/GenerateHeadings', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should generate headings for selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { generateHeadings } = await utils.editor.askAIWithText(@@ -30,7 +27,7 @@ test.describe('AIAction/GenerateHeadings', () => {});test('should generate headings for selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { generateHeadings } = await utils.editor.askAIWithEdgeless(@@ -54,7 +51,7 @@ test.describe('AIAction/GenerateHeadings', () => {});test('should generate headings for selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { generateHeadings } = await utils.editor.askAIWithEdgeless(@@ -77,7 +74,10 @@ test.describe('AIAction/GenerateHeadings', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { generateHeadings } = await utils.editor.askAIWithText(page,'AFFiNE is a workspace with fully merged docs'diff --git a/tests/affine-cloud-copilot/e2e/ai-action/generate-image-caption.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/generate-image-caption.spec.tsindex 63877f22bb..6da747f4ce 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/generate-image-caption.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/generate-image-caption.spec.ts@@ -1,4 +1,3 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';@@ -13,14 +12,15 @@ const image = {};test.describe('AIAction/GenerateImageCaption', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('should generate image caption', async ({ page, utils }) => {+ test('should generate image caption', async ({+ loggedInPage: page,+ utils,+ }) => {const { generateCaption } = await utils.editor.askAIWithImage(page, image);const { answer, responses } = await generateCaption();await expect(answer).toHaveText(/cat|kitten/i);@@ -29,7 +29,10 @@ test.describe('AIAction/GenerateImageCaption', () => {);});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { generateCaption } = await utils.editor.askAIWithImage(page, image);const { answer } = await generateCaption();await expect(answer).toHaveText(/cat|kitten/i);diff --git a/tests/affine-cloud-copilot/e2e/ai-action/generate-outline.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/generate-outline.spec.tsindex 411953428c..301be1ebe7 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/generate-outline.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/generate-outline.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/GenerateOutline', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should generate outline for selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { generateOutline } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/GenerateOutline', () => {});test('should generate outline for selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { generateOutline } = await utils.editor.askAIWithEdgeless(@@ -43,7 +40,7 @@ test.describe('AIAction/GenerateOutline', () => {});test('should generate outline for selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { generateOutline } = await utils.editor.askAIWithEdgeless(@@ -60,7 +57,10 @@ test.describe('AIAction/GenerateOutline', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { generateOutline } = await utils.editor.askAIWithText(page,'AFFiNE is a workspace with fully merged docs'diff --git a/tests/affine-cloud-copilot/e2e/ai-action/generate-presentation.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/generate-presentation.spec.tsindex e38e4e469a..daafe26448 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/generate-presentation.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/generate-presentation.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/GeneratePresentation', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should generate a presentation for the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { generatePresentation } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/GeneratePresentation', () => {});test('should generate a presentation for the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { generatePresentation } = await utils.editor.askAIWithEdgeless(@@ -43,7 +40,7 @@ test.describe('AIAction/GeneratePresentation', () => {});test('should generate a presentation for the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { generatePresentation } = await utils.editor.askAIWithEdgeless(diff --git a/tests/affine-cloud-copilot/e2e/ai-action/image-filter.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/image-filter.spec.tsindex 3017fc6b2a..8b7f10f420 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/image-filter.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/image-filter.spec.ts@@ -1,4 +1,3 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';@@ -13,14 +12,12 @@ const image = {};test.describe('AIAction/ImageFilter', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('should support image filter', async ({ page, utils }) => {+ test('should support image filter', async ({ loggedInPage: page, utils }) => {const { imageFilter } = await utils.editor.askAIWithImage(page, image);const { answer, responses } = await imageFilter('pixel-style');await expect(answer.getByTestId('ai-answer-image')).toBeVisible();diff --git a/tests/affine-cloud-copilot/e2e/ai-action/image-processing.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/image-processing.spec.tsindex 0eec1a779e..a286d509ac 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/image-processing.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/image-processing.spec.ts@@ -1,4 +1,3 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';@@ -13,21 +12,25 @@ const image = {};test.describe('AIAction/ImageProcessing', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('should support image processing', async ({ page, utils }) => {+ test('should support image processing', async ({+ loggedInPage: page,+ utils,+ }) => {const { imageProcessing } = await utils.editor.askAIWithImage(page, image);const { answer, responses } = await imageProcessing('remove-background');await expect(answer.getByTestId('ai-answer-image')).toBeVisible();await expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { imageProcessing } = await utils.editor.askAIWithImage(page, image);const { answer } = await imageProcessing('remove-background');await expect(answer.getByTestId('ai-answer-image')).toBeVisible();diff --git a/tests/affine-cloud-copilot/e2e/ai-action/improve-writing.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/improve-writing.spec.tsindex 4f8abe6feb..ec4034e04a 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/improve-writing.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/improve-writing.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/ImproveWriting', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support improving the writing of the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { improveWriting } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/ImproveWriting', () => {});test('should support improving the writing of the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { improveWriting } = await utils.editor.askAIWithEdgeless(@@ -40,7 +37,7 @@ test.describe('AIAction/ImproveWriting', () => {});test('should support improving the writing of the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { improveWriting } = await utils.editor.askAIWithEdgeless(@@ -54,7 +51,10 @@ test.describe('AIAction/ImproveWriting', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { improveWriting } = await utils.editor.askAIWithText(page,'AFFiNE is so smart'diff --git a/tests/affine-cloud-copilot/e2e/ai-action/make-it-longer.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/make-it-longer.spec.tsindex 5a5945a318..669e19e970 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/make-it-longer.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/make-it-longer.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/MakeItLonger', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support making the selected content longer', async ({- page,+ loggedInPage: page,utils,}) => {const { makeItLonger } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/MakeItLonger', () => {});test('should support making the selected text block longer in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { makeItLonger } = await utils.editor.askAIWithEdgeless(@@ -43,7 +40,7 @@ test.describe('AIAction/MakeItLonger', () => {});test('should support making the selected note block longer in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { makeItLonger } = await utils.editor.askAIWithEdgeless(@@ -60,7 +57,10 @@ test.describe('AIAction/MakeItLonger', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { makeItLonger } = await utils.editor.askAIWithText(page,'AFFiNE is a workspace with fully merged docs'diff --git a/tests/affine-cloud-copilot/e2e/ai-action/make-it-real.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/make-it-real.spec.tsindex ea8078d4e7..1b659e6619 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/make-it-real.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/make-it-real.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/MakeItReal', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support making the selected content to real', async ({- page,+ loggedInPage: page,utils,}) => {const { makeItReal } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/MakeItReal', () => {});test('should support making the selected text block to real in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { makeItReal } = await utils.editor.askAIWithEdgeless(@@ -43,7 +40,7 @@ test.describe('AIAction/MakeItReal', () => {});test('should support making the selected note block to real in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { makeItReal } = await utils.editor.askAIWithEdgeless(@@ -61,7 +58,7 @@ test.describe('AIAction/MakeItReal', () => {});test('should support making the selected element to real in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { makeItReal } = await utils.editor.askAIWithEdgeless(@@ -76,7 +73,10 @@ test.describe('AIAction/MakeItReal', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { makeItReal } = await utils.editor.askAIWithText(page,'AFFiNE is a workspace with fully merged docs'diff --git a/tests/affine-cloud-copilot/e2e/ai-action/make-it-shorter.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/make-it-shorter.spec.tsindex 5ffcda68ae..d02cc19273 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/make-it-shorter.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/make-it-shorter.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/MakeItShorter', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support making the selected content shorter', async ({- page,+ loggedInPage: page,utils,}) => {const { makeItShorter } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/MakeItShorter', () => {});test('should support making the selected text block shorter in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { makeItShorter } = await utils.editor.askAIWithEdgeless(@@ -43,7 +40,7 @@ test.describe('AIAction/MakeItShorter', () => {});test('should support making the selected note block shorter in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { makeItShorter } = await utils.editor.askAIWithEdgeless(@@ -60,7 +57,10 @@ test.describe('AIAction/MakeItShorter', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { makeItShorter } = await utils.editor.askAIWithText(page,'AFFiNE is a workspace with fully merged docs'diff --git a/tests/affine-cloud-copilot/e2e/ai-action/regenerate-mindmap.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/regenerate-mindmap.spec.tsindex df6cc506da..b31b1b7969 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/regenerate-mindmap.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/regenerate-mindmap.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/RegenerateMindMap', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support regenerate the mind map for mindmap root', async ({- page,+ loggedInPage: page,utils,}) => {let id: string;diff --git a/tests/affine-cloud-copilot/e2e/ai-action/summarize.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/summarize.spec.tsindex 9d60d5dac9..908b1c0af8 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/summarize.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/summarize.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/Summarize', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support summarizing the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { summarize } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/Summarize', () => {});test('should support summarizing the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { summarize } = await utils.editor.askAIWithEdgeless(@@ -43,7 +40,7 @@ test.describe('AIAction/Summarize', () => {});test('should support summarizing the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { summarize } = await utils.editor.askAIWithEdgeless(@@ -60,7 +57,10 @@ test.describe('AIAction/Summarize', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { summarize } = await utils.editor.askAIWithText(page,'AFFiNE is a workspace with fully merged docs'diff --git a/tests/affine-cloud-copilot/e2e/ai-action/translate.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/translate.spec.tsindex 45ef256f87..52ba54c11f 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/translate.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/translate.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/Translate', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support translating the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { translate } = await utils.editor.askAIWithText(page, 'Apple');@@ -22,7 +19,7 @@ test.describe('AIAction/Translate', () => {});test('should support translating the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { translate } = await utils.editor.askAIWithEdgeless(@@ -37,7 +34,7 @@ test.describe('AIAction/Translate', () => {});test('should support translating the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { translate } = await utils.editor.askAIWithEdgeless(@@ -51,7 +48,10 @@ test.describe('AIAction/Translate', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('support show chat history in chat panel', async ({ page, utils }) => {+ test('support show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { translate } = await utils.editor.askAIWithText(page, 'Apple');const { answer } = await translate('German');await expect(answer).toHaveText(/Apfel/, { timeout: 10000 });diff --git a/tests/affine-cloud-copilot/e2e/ai-action/write-an-article.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/write-an-article.spec.tsindex 0d4fdb3423..ddbdfdcbb1 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/write-an-article.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/write-an-article.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/WriteAnArticleAboutThis', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should generate an article for the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { writeArticle } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/WriteAnArticleAboutThis', () => {});test('should support writing an article for the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { writeArticle } = await utils.editor.askAIWithEdgeless(@@ -43,7 +40,7 @@ test.describe('AIAction/WriteAnArticleAboutThis', () => {});test('should support writing an article for the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { writeArticle } = await utils.editor.askAIWithEdgeless(@@ -60,7 +57,10 @@ test.describe('AIAction/WriteAnArticleAboutThis', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { writeArticle } = await utils.editor.askAIWithText(page,'AFFiNE is a workspace with fully merged docs'diff --git a/tests/affine-cloud-copilot/e2e/ai-action/write-an-blog.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/write-an-blog.spec.tsindex e866fbfb1e..eb57dc5554 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/write-an-blog.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/write-an-blog.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/WriteAnBlogPostAboutThis', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should generate an blog post for the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { writeBlogPost } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/WriteAnBlogPostAboutThis', () => {});test('should support writing an blog post for the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { writeBlogPost } = await utils.editor.askAIWithEdgeless(@@ -43,7 +40,7 @@ test.describe('AIAction/WriteAnBlogPostAboutThis', () => {});test('should support writing an blog post for the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { writeBlogPost } = await utils.editor.askAIWithEdgeless(@@ -60,7 +57,10 @@ test.describe('AIAction/WriteAnBlogPostAboutThis', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { writeBlogPost } = await utils.editor.askAIWithText(page,'AFFiNE is a workspace with fully merged docs'diff --git a/tests/affine-cloud-copilot/e2e/ai-action/write-an-poem.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/write-an-poem.spec.tsindex bd34c902a1..b50421d80f 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/write-an-poem.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/write-an-poem.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/WriteAnPoemAboutThis', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should generate an poem for the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { writePoem } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/WriteAnPoemAboutThis', () => {});test('should generate an poem for the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { writePoem } = await utils.editor.askAIWithEdgeless(@@ -43,7 +40,7 @@ test.describe('AIAction/WriteAnPoemAboutThis', () => {});test('should generate an poem for the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { writePoem } = await utils.editor.askAIWithEdgeless(@@ -60,7 +57,10 @@ test.describe('AIAction/WriteAnPoemAboutThis', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { writePoem } = await utils.editor.askAIWithText(page,'AFFiNE is a workspace with fully merged docs'diff --git a/tests/affine-cloud-copilot/e2e/ai-action/write-an-tweet.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/write-an-tweet.spec.tsindex 1c2bcf2866..b78729bb22 100644--- a/tests/affine-cloud-copilot/e2e/ai-action/write-an-tweet.spec.ts+++ b/tests/affine-cloud-copilot/e2e/ai-action/write-an-tweet.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIAction/WriteAnTweetAboutThis', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should generate an tweet for the selected content', async ({- page,+ loggedInPage: page,utils,}) => {const { writeTwitterPost } = await utils.editor.askAIWithText(@@ -25,7 +22,7 @@ test.describe('AIAction/WriteAnTweetAboutThis', () => {});test('should generate an tweet for the selected text block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { writeTwitterPost } = await utils.editor.askAIWithEdgeless(@@ -43,7 +40,7 @@ test.describe('AIAction/WriteAnTweetAboutThis', () => {});test('should generate an tweet for the selected note block in edgeless', async ({- page,+ loggedInPage: page,utils,}) => {const { writeTwitterPost } = await utils.editor.askAIWithEdgeless(@@ -60,7 +57,10 @@ test.describe('AIAction/WriteAnTweetAboutThis', () => {expect(responses).toEqual(new Set(['insert-below']));});- test('should show chat history in chat panel', async ({ page, utils }) => {+ test('should show chat history in chat panel', async ({+ loggedInPage: page,+ utils,+ }) => {const { writeTwitterPost } = await utils.editor.askAIWithText(page,'AFFiNE is a workspace with fully merged docs'diff --git a/tests/affine-cloud-copilot/e2e/base/base-test.ts b/tests/affine-cloud-copilot/e2e/base/base-test.tsindex 49a5674120..8e92c6bf3e 100644--- a/tests/affine-cloud-copilot/e2e/base/base-test.ts+++ b/tests/affine-cloud-copilot/e2e/base/base-test.ts@@ -1,5 +1,6 @@// eslint-disable no-empty-patternimport { test as base } from '@affine-test/kit/playwright';+import type { Page } from '@playwright/test';import { ChatPanelUtils } from '../utils/chat-panel-utils';import { EditorUtils } from '../utils/editor-utils';@@ -11,6 +12,7 @@ interface TestUtilsFixtures {chatPanel: typeof ChatPanelUtils;editor: typeof EditorUtils;};+ loggedInPage: Page;}export const test = base.extend<TestUtilsFixtures>({@@ -22,6 +24,14 @@ export const test = base.extend<TestUtilsFixtures>({editor: EditorUtils,});},+ loggedInPage: async ({ browser }, use) => {+ const context = await browser.newContext({+ storageState: 'storageState.json',+ });+ const page = await context.newPage();+ await use(page);+ await context.close();+ },});export type TestFixtures = typeof test;diff --git a/tests/affine-cloud-copilot/e2e/basic/authority.spec.ts b/tests/affine-cloud-copilot/e2e/basic/authority.spec.tsindex 8ad9e36f38..7bf8ec4dff 100644--- a/tests/affine-cloud-copilot/e2e/basic/authority.spec.ts+++ b/tests/affine-cloud-copilot/e2e/basic/authority.spec.ts@@ -4,7 +4,8 @@ import { test } from '../base/base-test';test.describe('AIBasic/Authority', () => {test.beforeEach(async ({ page, utils }) => {- await utils.testUtils.setupTestEnvironment(page, false);+ // Sign out+ await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});diff --git a/tests/affine-cloud-copilot/e2e/basic/chat.spec.ts b/tests/affine-cloud-copilot/e2e/basic/chat.spec.tsindex 7f0f12697f..820d6a17c9 100644--- a/tests/affine-cloud-copilot/e2e/basic/chat.spec.ts+++ b/tests/affine-cloud-copilot/e2e/basic/chat.spec.ts@@ -1,17 +1,16 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIBasic/Chat', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ utils, loggedInPage: page }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('should display empty state when no messages', async ({ page }) => {+ test('should display empty state when no messages', async ({+ loggedInPage: page,+ }) => {// Verify empty state UIawait expect(page.getByTestId('chat-panel-empty-state')).toBeVisible();await expect(page.getByTestId('ai-onboarding')).toBeVisible();@@ -22,7 +21,7 @@ test.describe('AIBasic/Chat', () => {- AI is loading- AI generating- AI success- `, async ({ page, utils }) => {+ `, async ({ loggedInPage: page, utils }) => {// Type and send a messageawait utils.chatPanel.makeChat(page, 'Introduce AFFiNE to me');@@ -66,7 +65,10 @@ test.describe('AIBasic/Chat', () => {]);});- test('should support stop generating', async ({ page, utils }) => {+ test('should support stop generating', async ({+ loggedInPage: page,+ utils,+ }) => {await utils.chatPanel.makeChat(page, 'Introduce AFFiNE to me');// AI Generating@@ -95,7 +97,7 @@ test.describe('AIBasic/Chat', () => {});test('should render ai actions inline if the answer is the last one in the list, otherwise, nest them under the "More" menu', async ({- page,+ loggedInPage: page,utils,}) => {await utils.chatPanel.makeChat(page, 'Hello, how can you help me?');@@ -140,7 +142,7 @@ test.describe('AIBasic/Chat', () => {});test('should show scroll indicator when there are many messages', async ({- page,+ loggedInPage: page,utils,}) => {// Set window height to 100px to ensure scroll indicator appears@@ -188,7 +190,10 @@ test.describe('AIBasic/Chat', () => {await expect(scrollDownIndicator).not.toBeVisible();});- test('should show error when request failed', async ({ page, utils }) => {+ test('should show error when request failed', async ({+ loggedInPage: page,+ utils,+ }) => {// Simulate network error by disconnectingawait page.route('**/graphql', route => route.abort('failed'));@@ -199,7 +204,10 @@ test.describe('AIBasic/Chat', () => {await expect(page.getByTestId('action-retry-button')).toBeVisible();});- test('should support retrying failed messages', async ({ page, utils }) => {+ test('should support retrying failed messages', async ({+ loggedInPage: page,+ utils,+ }) => {// Simulate network error by disconnectingawait page.route('**/graphql', route => route.abort('failed'));@@ -238,7 +246,10 @@ test.describe('AIBasic/Chat', () => {]);});- test('should support retrying question', async ({ page, utils }) => {+ test('should support retrying question', async ({+ loggedInPage: page,+ utils,+ }) => {await utils.chatPanel.makeChat(page,'Introduce Large Language Model in under 500 words'@@ -282,7 +293,7 @@ test.describe('AIBasic/Chat', () => {});test('should support sending message with button', async ({- page,+ loggedInPage: page,utils,}) => {await utils.chatPanel.openChatPanel(page);@@ -300,7 +311,10 @@ test.describe('AIBasic/Chat', () => {]);});- test('should support clearing chat', async ({ page, utils }) => {+ test('should support clearing chat', async ({+ loggedInPage: page,+ utils,+ }) => {await utils.chatPanel.openChatPanel(page);await utils.chatPanel.makeChat(page, 'Hello');await utils.chatPanel.waitForHistory(page, [@@ -317,7 +331,10 @@ test.describe('AIBasic/Chat', () => {await utils.chatPanel.waitForHistory(page, []);});- test('should support copying answer', async ({ page, utils }) => {+ test('should support copying answer', async ({+ loggedInPage: page,+ utils,+ }) => {await utils.chatPanel.openChatPanel(page);await utils.chatPanel.makeChat(page, 'Hello');await utils.chatPanel.waitForHistory(page, [diff --git a/tests/affine-cloud-copilot/e2e/basic/onboarding.spec.ts b/tests/affine-cloud-copilot/e2e/basic/onboarding.spec.tsindex 9206c0531d..a298fe7d03 100644--- a/tests/affine-cloud-copilot/e2e/basic/onboarding.spec.ts+++ b/tests/affine-cloud-copilot/e2e/basic/onboarding.spec.ts@@ -1,4 +1,3 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';@@ -6,14 +5,12 @@ import { test } from '../base/base-test';test.describe.configure({ mode: 'parallel' });test.describe('AIBasic/Onboarding', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('should show AI onboarding', async ({ page }) => {+ test('should show AI onboarding', async ({ loggedInPage: page }) => {await expect(page.getByTestId('ai-onboarding')).toBeVisible();// Show options@@ -30,7 +27,10 @@ test.describe('AIBasic/Onboarding', () => {await expect(page.getByTestId('freely-communicate-with-ai')).toBeVisible();});- test('read a foreign language article with AI', async ({ page, utils }) => {+ test('read a foreign language article with AI', async ({+ loggedInPage: page,+ utils,+ }) => {await page.getByTestId('read-foreign-language-article-with-ai').click();await utils.editor.isEdgelessMode(page);@@ -38,7 +38,10 @@ test.describe('AIBasic/Onboarding', () => {await expect(docTitle).toContain('Read a foreign language');});- test('tidy an article with AI MindMap Action', async ({ page, utils }) => {+ test('tidy an article with AI MindMap Action', async ({+ loggedInPage: page,+ utils,+ }) => {await page.getByTestId('tidy-an-article-with-ai-mindmap-action').click();await utils.editor.isEdgelessMode(page);@@ -46,7 +49,10 @@ test.describe('AIBasic/Onboarding', () => {await expect(docTitle).toContain('Tidy');});- test('add illustrations to the article', async ({ page, utils }) => {+ test('add illustrations to the article', async ({+ loggedInPage: page,+ utils,+ }) => {await page.getByTestId('add-illustrations-to-the-article').click();await utils.editor.isEdgelessMode(page);@@ -54,7 +60,7 @@ test.describe('AIBasic/Onboarding', () => {await expect(docTitle).toContain('Add illustrations');});- test('complete writing with AI', async ({ page, utils }) => {+ test('complete writing with AI', async ({ loggedInPage: page, utils }) => {await page.getByTestId('complete-writing-with-ai').click();await utils.editor.isEdgelessMode(page);@@ -62,7 +68,7 @@ test.describe('AIBasic/Onboarding', () => {await expect(docTitle).toContain('Complete writing');});- test('freely communicate with AI', async ({ page, utils }) => {+ test('freely communicate with AI', async ({ loggedInPage: page, utils }) => {await page.getByTestId('freely-communicate-with-ai').click();await utils.editor.isEdgelessMode(page);diff --git a/tests/affine-cloud-copilot/e2e/chat-with/attachments.spec.ts b/tests/affine-cloud-copilot/e2e/chat-with/attachments.spec.tsindex d3facccf1f..8f85ee0338 100644--- a/tests/affine-cloud-copilot/e2e/chat-with/attachments.spec.ts+++ b/tests/affine-cloud-copilot/e2e/chat-with/attachments.spec.ts@@ -1,18 +1,18 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIChatWith/Attachments', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('support chat with attachment', async ({ page, utils }) => {- const textContent = 'EEee is a cute cat';+ test('support chat with attachment', async ({+ loggedInPage: page,+ utils,+ }) => {+ const textContent = 'AttachmentEEee is a cute cat';const buffer = Buffer.from(textContent);await utils.chatPanel.chatWithAttachments(@@ -24,13 +24,13 @@ test.describe('AIChatWith/Attachments', () => {buffer: buffer,},],- 'What is EEee?'+ 'What is AttachmentEEee?');await utils.chatPanel.waitForHistory(page, [{role: 'user',- content: 'What is EEee?',+ content: 'What is AttachmentEEee?',},{role: 'assistant',@@ -44,9 +44,12 @@ test.describe('AIChatWith/Attachments', () => {}).toPass({ timeout: 10000 });});- test('support chat with multiple attachments', async ({ page, utils }) => {- const textContent1 = 'EEee is a cute cat';- const textContent2 = 'FFff is a cute dog';+ test('support chat with multiple attachments', async ({+ loggedInPage: page,+ utils,+ }) => {+ const textContent1 = 'AttachmentEEee is a cute cat';+ const textContent2 = 'AttachmentFFff is a cute dog';const buffer1 = Buffer.from(textContent1);const buffer2 = Buffer.from(textContent2);@@ -64,13 +67,13 @@ test.describe('AIChatWith/Attachments', () => {buffer: buffer2,},],- 'What is EEee? What is FFff?'+ 'What is AttachmentEEee? What is AttachmentFFff?');await utils.chatPanel.waitForHistory(page, [{role: 'user',- content: 'What is EEee? What is FFff?',+ content: 'What is AttachmentEEee? What is AttachmentFFff?',},{role: 'assistant',@@ -81,8 +84,8 @@ test.describe('AIChatWith/Attachments', () => {await expect(async () => {const { content, message } =await utils.chatPanel.getLatestAssistantMessage(page);- expect(content).toMatch(/EEee/);- expect(content).toMatch(/FFff/);+ expect(content).toMatch(/AttachmentEEee/);+ expect(content).toMatch(/AttachmentFFff/);expect(await message.locator('affine-footnote-node').count()).toBe(2);}).toPass({ timeout: 20000 });});diff --git a/tests/affine-cloud-copilot/e2e/chat-with/collections.spec.ts b/tests/affine-cloud-copilot/e2e/chat-with/collections.spec.tsindex 23144d0eb2..88d2763d18 100644--- a/tests/affine-cloud-copilot/e2e/chat-with/collections.spec.ts+++ b/tests/affine-cloud-copilot/e2e/chat-with/collections.spec.ts@@ -1,35 +1,40 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';+test.describe.configure({ mode: 'serial' });+test.describe('AIChatWith/Collections', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);+ await utils.editor.clearAllCollections(page);++ await utils.testUtils.createNewPage(page);+ });+ test.afterEach(async ({ loggedInPage: page, utils }) => {+ // clear all collections+ await utils.editor.clearAllCollections(page);+ });++ test('should support chat with collection', async ({+ loggedInPage: page,+ utils,+ }) => {// Create two collectionsawait utils.editor.createCollectionAndDoc(page,'Collection 1',- 'EEee is a cute cat'- );- await utils.editor.createCollectionAndDoc(- page,- 'Collection 2',- 'FFff is a cute dog'+ 'CollectionAAaa is a cute dog');- });- test('should support chat with collection', async ({ page, utils }) => {await utils.chatPanel.chatWithCollections(page, ['Collection 1']);- await utils.chatPanel.makeChat(page, 'What is EEee(Use English)');+ await utils.chatPanel.makeChat(page, 'What is CollectionAAaa(Use English)');await utils.chatPanel.waitForHistory(page, [{role: 'user',- content: 'What is EEee(Use English)',+ content: 'What is CollectionAAaa(Use English)',},{role: 'assistant',@@ -40,27 +45,40 @@ test.describe('AIChatWith/Collections', () => {await expect(async () => {const { content, message } =await utils.chatPanel.getLatestAssistantMessage(page);- expect(content).toMatch(/EEee.*cat/);+ expect(content).toMatch(/CollectionAAaa.*dog/);expect(await message.locator('affine-footnote-node').count()).toBe(1);}).toPass();});test('should support chat with multiple collections', async ({- page,+ loggedInPage: page,utils,}) => {+ // Create two collections+ await utils.editor.createCollectionAndDoc(+ page,+ 'Collection 2',+ 'CollectionEEee is a cute cat'+ );++ await utils.editor.createCollectionAndDoc(+ page,+ 'Collection 3',+ 'CollectionFFff is a cute dog'+ );+await utils.chatPanel.chatWithCollections(page, [- 'Collection 1','Collection 2',+ 'Collection 3',]);await utils.chatPanel.makeChat(page,- 'What is EEee? What is FFff?(Use English)'+ 'What is CollectionEEee? What is CollectionFFff?(Use English)');await utils.chatPanel.waitForHistory(page, [{role: 'user',- content: 'What is EEee? What is FFff?(Use English)',+ content: 'What is CollectionEEee? What is CollectionFFff?(Use English)',},{role: 'assistant',@@ -71,8 +89,8 @@ test.describe('AIChatWith/Collections', () => {await expect(async () => {const { content, message } =await utils.chatPanel.getLatestAssistantMessage(page);- expect(content).toMatch(/EEee.*cat/);- expect(content).toMatch(/FFff.*dog/);+ expect(content).toMatch(/CollectionEEee.*cat/);+ expect(content).toMatch(/CollectionFFff.*dog/);expect(await message.locator('affine-footnote-node').count()).toBe(2);}).toPass();});diff --git a/tests/affine-cloud-copilot/e2e/chat-with/doc.spec.ts b/tests/affine-cloud-copilot/e2e/chat-with/doc.spec.tsindex b68447eaf4..74a4d8e5cc 100644--- a/tests/affine-cloud-copilot/e2e/chat-with/doc.spec.ts+++ b/tests/affine-cloud-copilot/e2e/chat-with/doc.spec.ts@@ -1,4 +1,3 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { focusDocTitle } from '@affine-test/kit/utils/editor';import {clickNewPageButton,@@ -9,27 +8,28 @@ import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIChatWith/Doc', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('support chat with specified doc', async ({ page, utils }) => {+ test('support chat with specified doc', async ({+ loggedInPage: page,+ utils,+ }) => {// Initialize the docawait focusDocTitle(page);await page.keyboard.insertText('Test Doc');await page.keyboard.press('Enter');- await page.keyboard.insertText('EEee is a cute cat');+ await page.keyboard.insertText('DocEEee is a cute cat');await utils.chatPanel.chatWithDoc(page, 'Test Doc');- await utils.chatPanel.makeChat(page, 'What is EEee?');+ await utils.chatPanel.makeChat(page, 'What is DocEEee?');await utils.chatPanel.waitForHistory(page, [{role: 'user',- content: 'What is EEee?',+ content: 'What is DocEEee?',},{role: 'assistant',@@ -39,16 +39,19 @@ test.describe('AIChatWith/Doc', () => {await expect(async () => {const { content } = await utils.chatPanel.getLatestAssistantMessage(page);- expect(content).toMatch(/EEee/);+ expect(content).toMatch(/DocEEee/);}).toPass({ timeout: 10000 });});- test('support chat with specified docs', async ({ page, utils }) => {+ test('support chat with specified docs', async ({+ loggedInPage: page,+ utils,+ }) => {// Initialize the doc 1await focusDocTitle(page);await page.keyboard.insertText('Test Doc1');await page.keyboard.press('Enter');- await page.keyboard.insertText('EEee is a cute cat');+ await page.keyboard.insertText('DocEEee is a cute cat');// Initialize the doc 2await clickNewPageButton(page);@@ -56,16 +59,16 @@ test.describe('AIChatWith/Doc', () => {await focusDocTitle(page);await page.keyboard.insertText('Test Doc2');await page.keyboard.press('Enter');- await page.keyboard.insertText('FFff is a cute dog');+ await page.keyboard.insertText('DocFFff is a cute dog');await utils.chatPanel.chatWithDoc(page, 'Test Doc1');await utils.chatPanel.chatWithDoc(page, 'Test Doc2');- await utils.chatPanel.makeChat(page, 'What is EEee? What is FFff?');+ await utils.chatPanel.makeChat(page, 'What is DocEEee? What is DocFFff?');await utils.chatPanel.waitForHistory(page, [{role: 'user',- content: 'What is EEee? What is FFff?',+ content: 'What is DocEEee? What is DocFFff?',},{role: 'assistant',@@ -75,8 +78,8 @@ test.describe('AIChatWith/Doc', () => {await expect(async () => {const { content } = await utils.chatPanel.getLatestAssistantMessage(page);- expect(content).toMatch(/EEee/);- expect(content).toMatch(/FFff/);+ expect(content).toMatch(/DocEEee/);+ expect(content).toMatch(/DocFFff/);}).toPass({ timeout: 10000 });});});diff --git a/tests/affine-cloud-copilot/e2e/chat-with/edgeless-mindmap.spec.ts b/tests/affine-cloud-copilot/e2e/chat-with/edgeless-mindmap.spec.tsindex 5866944f5c..7963c1a50d 100644--- a/tests/affine-cloud-copilot/e2e/chat-with/edgeless-mindmap.spec.ts+++ b/tests/affine-cloud-copilot/e2e/chat-with/edgeless-mindmap.spec.ts@@ -1,4 +1,3 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import type { EdgelessRootBlockComponent } from '@blocksuite/affine/blocks/root';import type { GfxModel } from '@blocksuite/std/gfx';import { expect } from '@playwright/test';@@ -6,15 +5,13 @@ import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIChatWith/EdgelessMindMap', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support replace mindmap with the regenerated one', async ({- page,+ loggedInPage: page,utils,}) => {let id: string;diff --git a/tests/affine-cloud-copilot/e2e/chat-with/edgeless-note-block.spec.ts b/tests/affine-cloud-copilot/e2e/chat-with/edgeless-note-block.spec.tsindex 8f9ebb7312..ba68bccf50 100644--- a/tests/affine-cloud-copilot/e2e/chat-with/edgeless-note-block.spec.ts+++ b/tests/affine-cloud-copilot/e2e/chat-with/edgeless-note-block.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIChatWith/EdgelessNoteBlock', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support insert a new note block below the current', async ({- page,+ loggedInPage: page,utils,}) => {const { translate } = await utils.editor.askAIWithEdgeless(diff --git a/tests/affine-cloud-copilot/e2e/chat-with/edgeless-text-block.spec.ts b/tests/affine-cloud-copilot/e2e/chat-with/edgeless-text-block.spec.tsindex 94c18efb22..1c3daa9d36 100644--- a/tests/affine-cloud-copilot/e2e/chat-with/edgeless-text-block.spec.ts+++ b/tests/affine-cloud-copilot/e2e/chat-with/edgeless-text-block.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIChatWith/EdgelessTextBlock', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support insert answer below the current text', async ({- page,+ loggedInPage: page,utils,}) => {const { translate } = await utils.editor.askAIWithEdgeless(diff --git a/tests/affine-cloud-copilot/e2e/chat-with/image-block.spec.ts b/tests/affine-cloud-copilot/e2e/chat-with/image-block.spec.tsindex d48ad6b046..a3dfe2577f 100644--- a/tests/affine-cloud-copilot/e2e/chat-with/image-block.spec.ts+++ b/tests/affine-cloud-copilot/e2e/chat-with/image-block.spec.ts@@ -1,4 +1,3 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';@@ -13,14 +12,15 @@ const image = {};test.describe('AIChatWith/Image', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('should support use the generated caption', async ({ page, utils }) => {+ test('should support use the generated caption', async ({+ loggedInPage: page,+ utils,+ }) => {const { generateCaption } = await utils.editor.askAIWithImage(page, image);const { answer } = await generateCaption();await expect(answer).toHaveText(/cat|kitten/i);diff --git a/tests/affine-cloud-copilot/e2e/chat-with/image.spec.ts b/tests/affine-cloud-copilot/e2e/chat-with/image.spec.tsindex 1a81d2827c..c5302c69ab 100644--- a/tests/affine-cloud-copilot/e2e/chat-with/image.spec.ts+++ b/tests/affine-cloud-copilot/e2e/chat-with/image.spec.ts@@ -1,16 +1,12 @@-import { loginUser } from '@affine-test/kit/utils/cloud';-import { test } from '../base/base-test';test.describe('AIChatWith/Image', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('support chat with image', async ({ page, utils }) => {+ test('support chat with image', async ({ loggedInPage: page, utils }) => {const image ='/9j/4AAQSkZJRgABAQEAAAAAAAD/4QAuRXhpZgAATU0AKgAAAAgAAkAAAAMAAAABAAAAAEABAAEAAAABAAAAAAAAAAD/2wBDAAoHBwkHBgoJCAkLCwoMDxkQDw4ODx4WFxIZJCAmJSMgIyIoLTkwKCo2KyIjMkQyNjs9QEBAJjBGS0U+Sjk/QD3/2wBDAQsLCw8NDx0QEB09KSMpPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT3/wAARCAD6APoDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK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6/wC6P5U7vVHGhhOBVaWTA61O/eq1xTQFOSQk1JCeRUJ+/UsPagOhpRdKlB4qGP7lT0rgOJPagHIptLQAEkGlFJRQA6lHSmVJUoBpNRucVJUcnSqQFSZ+DWVcydRWnN0NZNz1NDKiVi/aoZJBnk041Wk71mzogO3ikMgBqOmGmaIn8z6VFI+RTO1MkqWBC55NIH7USU0UGnQlBqQDvUaVOtCJZYtbqa2BWFyocfMMdf8AOamkvZZEKssZDKVJ24PJz2qutOP3ashxVxtxM0xDMFUqMfIMZ9z71XzUj96UdBQVFaH/2Q==';@@ -40,7 +36,10 @@ test.describe('AIChatWith/Image', () => {]);});- test('support chat with mutiple images', async ({ page, utils }) => {+ test('support chat with mutiple images', async ({+ loggedInPage: page,+ utils,+ }) => {const image ='/9j/4AAQSkZJRgABAQEAAAAAAAD/4QAuRXhpZgAATU0AKgAAAAgAAkAAAAMAAAABAAAAAEABAAEAAAABAAAAAAAAAAD/2wBDAAoHBwkHBgoJCAkLCwoMDxkQDw4ODx4WFxIZJCAmJSMgIyIoLTkwKCo2KyIjMkQyNjs9QEBAJjBGS0U+Sjk/QD3/2wBDAQsLCw8NDx0QEB09KSMpPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT3/wAARCAD6APoDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AA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aVy2iU0g6ioy49aeCMjmmIuR4wKf+FQQh5HCojMT6AkZ9M+tPEgJ4NNEPcfRxURkApvm0wsdvJ/rDQKO6/wC6P5U7vVHGhhOBVaWTA61O/eq1xTQFOSQk1JCeRUJ+/UsPagOhpRdKlB4qGP7lT0rgOJPagHIptLQAEkGlFJRQA6lHSmVJUoBpNRucVJUcnSqQFSZ+DWVcydRWnN0NZNz1NDKiVi/aoZJBnk041Wk71mzogO3ikMgBqOmGmaIn8z6VFI+RTO1MkqWBC55NIH7USU0UGnQlBqQDvUaVOtCJZYtbqa2BWFyocfMMdf8AOamkvZZEKssZDKVJ24PJz2qutOP3ashxVxtxM0xDMFUqMfIMZ9z71XzUj96UdBQVFaH/2Q==';diff --git a/tests/affine-cloud-copilot/e2e/chat-with/network.spec.ts b/tests/affine-cloud-copilot/e2e/chat-with/network.spec.tsindex e25c3fe648..c012f35356 100644--- a/tests/affine-cloud-copilot/e2e/chat-with/network.spec.ts+++ b/tests/affine-cloud-copilot/e2e/chat-with/network.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIChatWith/Network', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should support chat with network if network search enabled', async ({- page,+ loggedInPage: page,utils,}) => {await utils.chatPanel.enableNetworkSearch(page);@@ -40,7 +37,7 @@ test.describe('AIChatWith/Network', () => {});test('should disable chat with image if network search enabled', async ({- page,+ loggedInPage: page,utils,}) => {await utils.chatPanel.enableNetworkSearch(page);@@ -49,7 +46,10 @@ test.describe('AIChatWith/Network', () => {expect(isImageUploadEnabled).toBe(false);});- test('should prevent network search if disabled', async ({ page, utils }) => {+ test('should prevent network search if disabled', async ({+ loggedInPage: page,+ utils,+ }) => {await utils.chatPanel.disableNetworkSearch(page);await utils.chatPanel.makeChat(page,@@ -74,7 +74,7 @@ test.describe('AIChatWith/Network', () => {});test('should disable network search when chating with image', async ({- page,+ loggedInPage: page,utils,}) => {const image =diff --git a/tests/affine-cloud-copilot/e2e/chat-with/tags.spec.ts b/tests/affine-cloud-copilot/e2e/chat-with/tags.spec.tsindex 4d8990aea1..5865d6a399 100644--- a/tests/affine-cloud-copilot/e2e/chat-with/tags.spec.ts+++ b/tests/affine-cloud-copilot/e2e/chat-with/tags.spec.ts@@ -1,25 +1,32 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';+test.describe.configure({ mode: 'serial' });+test.describe('AIChatWith/tags', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);- await utils.editor.createTagAndDoc(page, 'Tag 1', 'EEee is a cute cat');- await utils.editor.createTagAndDoc(page, 'Tag 2', 'FFff is a cute dog');+ await utils.editor.clearAllTags(page);+ await utils.testUtils.createNewPage(page);+ });++ test.afterEach(async ({ loggedInPage: page, utils }) => {+ await utils.editor.clearAllTags(page);});- test('should support chat with tag', async ({ page, utils }) => {+ test('should support chat with tag', async ({+ loggedInPage: page,+ utils,+ }) => {+ await utils.editor.createTagAndDoc(page, 'Tag 1', 'TagAAaa is a cute cat');await utils.chatPanel.chatWithTags(page, ['Tag 1']);- await utils.chatPanel.makeChat(page, 'What is EEee(Use English)');+ await utils.chatPanel.makeChat(page, 'What is TagAAaa(Use English)');await utils.chatPanel.waitForHistory(page, [{role: 'user',- content: 'What is EEee(Use English)',+ content: 'What is TagAAaa(Use English)',},{role: 'assistant',@@ -29,21 +36,26 @@ test.describe('AIChatWith/tags', () => {await expect(async () => {const { content, message } =await utils.chatPanel.getLatestAssistantMessage(page);- expect(content).toMatch(/EEee.*cat/);+ expect(content).toMatch(/TagAAaa.*cat/);expect(await message.locator('affine-footnote-node').count()).toBe(1);}).toPass();});- test('should support chat with multiple tags', async ({ page, utils }) => {- await utils.chatPanel.chatWithTags(page, ['Tag 1', 'Tag 2']);+ test('should support chat with multiple tags', async ({+ loggedInPage: page,+ utils,+ }) => {+ await utils.editor.createTagAndDoc(page, 'Tag 2', 'TagEEee is a cute cat');+ await utils.editor.createTagAndDoc(page, 'Tag 3', 'TagFFff is a cute dog');+ await utils.chatPanel.chatWithTags(page, ['Tag 2', 'Tag 3']);await utils.chatPanel.makeChat(page,- 'What is EEee? What is FFff?(Use English)'+ 'What is TagEEee? What is TagFFff?(Use English)');await utils.chatPanel.waitForHistory(page, [{role: 'user',- content: 'What is EEee? What is FFff?(Use English)',+ content: 'What is TagEEee? What is TagFFff?(Use English)',},{role: 'assistant',@@ -53,8 +65,8 @@ test.describe('AIChatWith/tags', () => {await expect(async () => {const { content, message } =await utils.chatPanel.getLatestAssistantMessage(page);- expect(content).toMatch(/EEee.*cat/);- expect(content).toMatch(/FFff.*dog/);+ expect(content).toMatch(/TagEEee.*cat/);+ expect(content).toMatch(/TagFFff.*dog/);expect(await message.locator('affine-footnote-node').count()).toBe(2);}).toPass();});diff --git a/tests/affine-cloud-copilot/e2e/chat-with/text.spec.ts b/tests/affine-cloud-copilot/e2e/chat-with/text.spec.tsindex 3bbb9ce702..827463987a 100644--- a/tests/affine-cloud-copilot/e2e/chat-with/text.spec.ts+++ b/tests/affine-cloud-copilot/e2e/chat-with/text.spec.ts@@ -1,17 +1,17 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIChatWith/Text', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('should support stop generating', async ({ page, utils }) => {+ test('should support stop generating', async ({+ loggedInPage: page,+ utils,+ }) => {await utils.editor.askAIWithText(page, 'Appel');await page.getByTestId('action-fix-grammar').click();await expect(page.getByTestId('ai-generating')).toBeVisible();@@ -20,7 +20,7 @@ test.describe('AIChatWith/Text', () => {await expect(page.getByTestId('ai-generating')).not.toBeVisible();});- test('should support copy answer', async ({ page, utils }) => {+ test('should support copy answer', async ({ loggedInPage: page, utils }) => {const { translate } = await utils.editor.askAIWithText(page, 'Apple');const { answer } = await translate('German');await expect(answer).toHaveText(/Apfel/, { timeout: 10000 });@@ -33,7 +33,7 @@ test.describe('AIChatWith/Text', () => {expect(clipboardText).toBe('Apfel');});- test('should support insert below', async ({ page, utils }) => {+ test('should support insert below', async ({ loggedInPage: page, utils }) => {const { translate } = await utils.editor.askAIWithText(page, 'Apple');const { answer } = await translate('German');await expect(answer).toHaveText(/Apfel/, { timeout: 10000 });@@ -43,7 +43,7 @@ test.describe('AIChatWith/Text', () => {expect(content).toBe('Apple\nApfel');});- test('should support insert above', async ({ page, utils }) => {+ test('should support insert above', async ({ loggedInPage: page, utils }) => {const { generateHeadings } = await utils.editor.askAIWithText(page,'AFFiNE'@@ -58,7 +58,10 @@ test.describe('AIChatWith/Text', () => {expect(content).toBe('AFFiNE\nAFFiNE');});- test('should support replace selection', async ({ page, utils }) => {+ test('should support replace selection', async ({+ loggedInPage: page,+ utils,+ }) => {const { translate } = await utils.editor.askAIWithText(page, 'Apple');const { answer } = await translate('German');await expect(answer).toHaveText(/Apfel/, { timeout: 10000 });@@ -68,7 +71,10 @@ test.describe('AIChatWith/Text', () => {expect(content).toBe('Apfel');});- test('should support continue in chat', async ({ page, utils }) => {+ test('should support continue in chat', async ({+ loggedInPage: page,+ utils,+ }) => {const { translate } = await utils.editor.askAIWithText(page, 'Apple');const { answer } = await translate('German');await expect(answer).toHaveText(/Apfel/, { timeout: 10000 });@@ -79,7 +85,7 @@ test.describe('AIChatWith/Text', () => {await expect(quote).toHaveText(/Apple/, { timeout: 10000 });});- test('should support regenerate', async ({ page, utils }) => {+ test('should support regenerate', async ({ loggedInPage: page, utils }) => {const { translate } = await utils.editor.askAIWithText(page, 'Apple');const { answer } = await translate('German');const regenerate = answer.getByTestId('answer-regenerate');@@ -88,14 +94,20 @@ test.describe('AIChatWith/Text', () => {expect(content).toBe('Apple');});- test('should show error when request failed', async ({ page, utils }) => {+ test('should show error when request failed', async ({+ loggedInPage: page,+ utils,+ }) => {await page.route('**/graphql', route => route.abort('failed'));await utils.editor.askAIWithText(page, 'Appel');await page.getByTestId('action-fix-spelling').click();await expect(page.getByTestId('ai-error')).toBeVisible();});- test('should support retry when error', async ({ page, utils }) => {+ test('should support retry when error', async ({+ loggedInPage: page,+ utils,+ }) => {await page.route('**/graphql', route => route.abort('failed'));await utils.editor.askAIWithText(page, 'Appel');await page.getByTestId('action-fix-spelling').click();@@ -107,7 +119,7 @@ test.describe('AIChatWith/Text', () => {await expect(answer).toHaveText(/Apple/, { timeout: 10000 });});- test('should support discard', async ({ page, utils }) => {+ test('should support discard', async ({ loggedInPage: page, utils }) => {const { translate } = await utils.editor.askAIWithText(page, 'Apple');const { answer } = await translate('German');const discard = answer.getByTestId('answer-discard');@@ -117,7 +129,10 @@ test.describe('AIChatWith/Text', () => {expect(content).toBe('Apple');});- test('should support discard when click outside', async ({ page, utils }) => {+ test('should support discard when click outside', async ({+ loggedInPage: page,+ utils,+ }) => {const { translate } = await utils.editor.askAIWithText(page, 'Apple');const { answer } = await translate('German');await page.mouse.click(0, 0);@@ -128,7 +143,7 @@ test.describe('AIChatWith/Text', () => {expect(content).toBe('Apple');});- test('should focus on textarea', async ({ page, utils }) => {+ test('should focus on textarea', async ({ loggedInPage: page, utils }) => {await utils.editor.askAIWithText(page, 'Apple');const textarea = await utils.editor.whatAreYourThoughts(page, 'Coffee');diff --git a/tests/affine-cloud-copilot/e2e/insertion/add-to-edgeless-as-note.spec.ts b/tests/affine-cloud-copilot/e2e/insertion/add-to-edgeless-as-note.spec.tsindex a3306911c2..89c5e4ee26 100644--- a/tests/affine-cloud-copilot/e2e/insertion/add-to-edgeless-as-note.spec.ts+++ b/tests/affine-cloud-copilot/e2e/insertion/add-to-edgeless-as-note.spec.ts@@ -1,17 +1,17 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIInsertion/AddToEdgelessAsNote', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('should only show option in edgeless mode', async ({ page, utils }) => {+ test('should only show option in edgeless mode', async ({+ loggedInPage: page,+ utils,+ }) => {await utils.editor.focusToEditor(page);await utils.chatPanel.makeChat(page, 'Hello');@@ -37,7 +37,7 @@ test.describe('AIInsertion/AddToEdgelessAsNote', () => {});test('should add to edgeless as note in edgeless mode', async ({- page,+ loggedInPage: page,utils,}) => {await utils.editor.switchToEdgelessMode(page);diff --git a/tests/affine-cloud-copilot/e2e/insertion/insert.spec.ts b/tests/affine-cloud-copilot/e2e/insertion/insert.spec.tsindex 4083a0d28b..c5ff40de74 100644--- a/tests/affine-cloud-copilot/e2e/insertion/insert.spec.ts+++ b/tests/affine-cloud-copilot/e2e/insertion/insert.spec.ts@@ -1,19 +1,16 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { focusDocTitle } from '@affine-test/kit/utils/editor';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIInsertion/Insert', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should insert content below selected block in page mode', async ({- page,+ loggedInPage: page,utils,}) => {// Create tow blocks@@ -53,7 +50,7 @@ test.describe('AIInsertion/Insert', () => {});test('should insert content below selected block in edgeless mode', async ({- page,+ loggedInPage: page,utils,}) => {await utils.editor.switchToEdgelessMode(page);@@ -92,7 +89,7 @@ test.describe('AIInsertion/Insert', () => {});test('should insert content at the end of the page when no block is selected', async ({- page,+ loggedInPage: page,utils,}) => {// Create tow blocks@@ -132,7 +129,7 @@ test.describe('AIInsertion/Insert', () => {});test('should insert content at the end of the note when no block is selected in edgeless mode', async ({- page,+ loggedInPage: page,utils,}) => {await utils.editor.switchToEdgelessMode(page);@@ -166,7 +163,7 @@ test.describe('AIInsertion/Insert', () => {});test('should create a new note when no block or note is selected in edgeless mode', async ({- page,+ loggedInPage: page,utils,}) => {await utils.editor.switchToEdgelessMode(page);diff --git a/tests/affine-cloud-copilot/e2e/insertion/save-as-block.spec.ts b/tests/affine-cloud-copilot/e2e/insertion/save-as-block.spec.tsindex 2540fbf6af..3852bbd947 100644--- a/tests/affine-cloud-copilot/e2e/insertion/save-as-block.spec.ts+++ b/tests/affine-cloud-copilot/e2e/insertion/save-as-block.spec.ts@@ -1,18 +1,15 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIInsertion/SaveAsBlock', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});test('should save content as a chat block in page mode', async ({- page,+ loggedInPage: page,utils,}) => {await utils.chatPanel.openChatPanel(page);@@ -42,7 +39,7 @@ test.describe('AIInsertion/SaveAsBlock', () => {});test('should save content as a chat block in edgeless mode', async ({- page,+ loggedInPage: page,utils,}) => {await utils.editor.switchToEdgelessMode(page);diff --git a/tests/affine-cloud-copilot/e2e/insertion/save-as-doc.spec.ts b/tests/affine-cloud-copilot/e2e/insertion/save-as-doc.spec.tsindex 648b7cb9e0..b4de24e848 100644--- a/tests/affine-cloud-copilot/e2e/insertion/save-as-doc.spec.ts+++ b/tests/affine-cloud-copilot/e2e/insertion/save-as-doc.spec.ts@@ -1,17 +1,17 @@-import { loginUser } from '@affine-test/kit/utils/cloud';import { expect } from '@playwright/test';import { test } from '../base/base-test';test.describe('AIInsertion/SaveAsDoc', () => {- test.beforeEach(async ({ page, utils }) => {- const user = await utils.testUtils.getUser();- await loginUser(page, user);+ test.beforeEach(async ({ loggedInPage: page, utils }) => {await utils.testUtils.setupTestEnvironment(page);await utils.chatPanel.openChatPanel(page);});- test('should save content as a doc in page mode', async ({ page, utils }) => {+ test('should save content as a doc in page mode', async ({+ loggedInPage: page,+ utils,+ }) => {await utils.chatPanel.openChatPanel(page);await utils.chatPanel.makeChat(page, 'Hello');@@ -39,7 +39,7 @@ test.describe('AIInsertion/SaveAsDoc', () => {});test('should save content as a doc in edgeless mode', async ({- page,+ loggedInPage: page,utils,}) => {await utils.editor.switchToEdgelessMode(page);diff --git a/tests/affine-cloud-copilot/e2e/utils/editor-utils.ts b/tests/affine-cloud-copilot/e2e/utils/editor-utils.tsindex 081d41cc6d..3608ce32eb 100644--- a/tests/affine-cloud-copilot/e2e/utils/editor-utils.ts+++ b/tests/affine-cloud-copilot/e2e/utils/editor-utils.ts@@ -238,6 +238,50 @@ export class EditorUtils {);}+ public static async clearAllCollections(page: Page) {+ while (true) {+ const collection = await page+ .getByTestId('explorer-collections')+ .locator('[data-testid^="explorer-collection-"]')+ .first();++ if (!(await collection.isVisible())) {+ break;+ }++ const collectionContent = await collection.locator('div').first();+ await collectionContent.hover();+ const more = await collectionContent.getByTestId(+ 'explorer-tree-node-operation-button'+ );+ await more.click();+ await page.getByTestId('collection-delete-button').click();+ }+ await page.waitForTimeout(100);+ }++ public static async clearAllTags(page: Page) {+ while (true) {+ const tag = await page+ .getByTestId('explorer-tags')+ .locator('[data-testid^="explorer-tag-"]')+ .first();++ if (!(await tag.isVisible())) {+ break;+ }++ const tagContent = await tag.locator('div').first();+ await tagContent.hover();+ const more = await tagContent.getByTestId(+ 'explorer-tree-node-operation-button'+ );+ await more.click();+ await page.getByTestId('tag-delete-button').click();+ }+ await page.waitForTimeout(100);+ }+public static async createCollectionAndDoc(page: Page,collectionName: string,diff --git a/tests/affine-cloud-copilot/e2e/utils/test-utils.ts b/tests/affine-cloud-copilot/e2e/utils/test-utils.tsindex 2f51a0a9de..9ec142a71f 100644--- a/tests/affine-cloud-copilot/e2e/utils/test-utils.ts+++ b/tests/affine-cloud-copilot/e2e/utils/test-utils.ts@@ -1,7 +1,4 @@-import {- createRandomAIUser,- enableCloudWorkspace,-} from '@affine-test/kit/utils/cloud';+import { createRandomAIUser } from '@affine-test/kit/utils/cloud';import { openHomePage, setCoreUrl } from '@affine-test/kit/utils/load-page';import {clickNewPageButton,@@ -55,13 +52,14 @@ export class TestUtils {};}- public async setupTestEnvironment(page: Page, enableCloud: boolean = true) {- await openHomePage(page);+ public async createNewPage(page: Page) {await clickNewPageButton(page);await waitForEditorLoad(page);- if (enableCloud) {- await enableCloudWorkspace(page);- }+ }++ public async setupTestEnvironment(page: Page) {+ await openHomePage(page);+ await this.createNewPage(page);}public async createTestWorkspace(page: Page, name: string = 'test') {diff --git a/tests/affine-cloud-copilot/global-setup.ts b/tests/affine-cloud-copilot/global-setup.tsnew file mode 100644index 0000000000..2a4e0253d5--- /dev/null+++ b/tests/affine-cloud-copilot/global-setup.ts@@ -0,0 +1,35 @@+import fs from 'node:fs';++import {+ createRandomAIUser,+ enableCloudWorkspace,+ loginUserDirectly,+} from '@affine-test/kit/utils/cloud';+import { openHomePage } from '@affine-test/kit/utils/load-page';+import type { Page } from '@playwright/test';+import { chromium } from '@playwright/test';++function getUser() {+ return createRandomAIUser();+}++async function setupTestEnvironment(page: Page) {+ await openHomePage(page);+ await enableCloudWorkspace(page);+}++export default async function globalSetup() {+ const browser = await chromium.launch();+ const page = await browser.newPage();+ await page.goto('http://localhost:8080/', { timeout: 240 * 1000 });+ const user = await getUser();+ await page.getByTestId('sidebar-user-avatar').click({+ delay: 200,+ timeout: 20 * 1000,+ });+ await loginUserDirectly(page, user);+ await setupTestEnvironment(page);+ const state = await page.context().storageState();+ fs.writeFileSync('storageState.json', JSON.stringify(state));+ await browser.close();+}diff --git a/tests/affine-cloud-copilot/playwright.config.ts b/tests/affine-cloud-copilot/playwright.config.tsindex 52d6608a57..e221744361 100644--- a/tests/affine-cloud-copilot/playwright.config.ts+++ b/tests/affine-cloud-copilot/playwright.config.ts@@ -6,9 +6,10 @@ import type {const config: PlaywrightTestConfig = {testDir: './e2e',- fullyParallel: !process.env.CI,+ fullyParallel: true,timeout: 120_000,outputDir: testResultDir,+ globalSetup: './global-setup.ts',use: {baseURL: 'http://localhost:8080/',browserName:@@ -29,6 +30,8 @@ const config: PlaywrightTestConfig = {{command: 'yarn run -T affine dev -p @affine/web',port: 8080,+ stdout: 'ignore',+ stderr: 'ignore',timeout: 120 * 1000,reuseExistingServer: !process.env.CI,env: {@@ -40,8 +43,8 @@ const config: PlaywrightTestConfig = {port: 3010,timeout: 120 * 1000,reuseExistingServer: !process.env.CI,- stdout: 'pipe',- stderr: 'pipe',+ stdout: 'ignore',+ stderr: 'ignore',env: {DATABASE_URL:process.env.DATABASE_URL ??diff --git a/tests/kit/src/utils/page-logic.ts b/tests/kit/src/utils/page-logic.tsindex b4cb999d0e..68049ed3ee 100644--- a/tests/kit/src/utils/page-logic.ts+++ b/tests/kit/src/utils/page-logic.ts@@ -39,7 +39,7 @@ export async function waitForAllPagesLoad(page: Page) {export async function clickNewPageButton(page: Page, title?: string) {await page.getByTestId('sidebar-new-page-button').click({// default timeout is 5000ms, but it's not enough for the CI first page load- timeout: 8000,+ timeout: 20000,});await waitForEmptyEditor(page);if (title) {