mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
test(core): common setup for ai tests (#11644)
### TL:DR By sharing initialization logic, accelerate test case execution. ### What Changed * Global setup for copilot e2e * Login * Create Workspace * Enable fully parallel for ci ### Optimization Comparison Comparing with PR [fix(core): ask AI input box in the whiteboard is blocked by the menu …](https://github.com/toeverything/AFFiNE/pull/11634): | | Shard 1 |2|3|4|5|6|7|8| | ------|----|----|----|----|----|---|---|--| |Before|15min|14min|14min|14min|14min|13min|15min|10min| |After|8min|11min|8min|8min|8min|8min|8min|7min| ### Trade-Off Since all copilot use cases currently share a single user and workspace, some test cases need to focus on **isolation** and **independence**. For example, when testing Embedding-related workflows: * Different document contents should be used to avoid interference. * After each test case execution, **cleanup** operations are also required. * Some tests should be configured to **serial** mode. ```ts test.describe.configure({ mode: 'serial' }); test.describe('AIChatWith/Collections', () => { 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 collections await utils.editor.createCollectionAndDoc( page, 'Collection 1', 'CollectionAAaa is a cute dog' ); await utils.chatPanel.chatWithCollections(page, ['Collection 1']); await utils.chatPanel.makeChat(page, 'What is CollectionAAaa(Use English)'); // ... }); test('should support chat with multiple collections', async ({ 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 2', 'Collection 3', ]); await utils.chatPanel.makeChat( page, 'What is CollectionEEee? What is CollectionFFff?(Use English)' ); // ... }); }); ``` > CLOSE AI-51
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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!");',
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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!");',
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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 Platform
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user