mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 05:14:54 +00:00
Close [AI-351](https://linear.app/affine-design/issue/AI-351) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Disabled action updates related to document IDs and sessions in the AI chat content panel. * **Tests** * Skipped all end-to-end tests for the "should show chat history in chat panel" scenario across various AI action test suites. These tests will no longer run during automated testing. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import { expect } from '@playwright/test';
|
|
|
|
import { test } from '../base/base-test';
|
|
|
|
test.describe('AIAction/CheckCodeError', () => {
|
|
test.beforeEach(async ({ loggedInPage: page, utils }) => {
|
|
await utils.testUtils.setupTestEnvironment(page);
|
|
await utils.chatPanel.openChatPanel(page);
|
|
});
|
|
|
|
test('should support check code error', async ({
|
|
loggedInPage: page,
|
|
utils,
|
|
}) => {
|
|
const { checkCodeError } = await utils.editor.askAIWithCode(
|
|
page,
|
|
'consloe.log("Hello,World!");',
|
|
'javascript'
|
|
);
|
|
const { answer, responses } = await checkCodeError();
|
|
await expect(answer).toHaveText(/console/);
|
|
await expect(responses).toEqual(
|
|
new Set(['insert-below', 'replace-selection'])
|
|
);
|
|
});
|
|
|
|
test.skip('should show chat history in chat panel', async ({
|
|
loggedInPage: page,
|
|
utils,
|
|
}) => {
|
|
const { checkCodeError } = await utils.editor.askAIWithCode(
|
|
page,
|
|
'consloe.log("Hello,World!");',
|
|
'javascript'
|
|
);
|
|
const { answer } = await checkCodeError();
|
|
const insert = answer.getByTestId('answer-insert-below');
|
|
await insert.click();
|
|
await utils.chatPanel.waitForHistory(page, [{ role: 'action' }]);
|
|
const {
|
|
message,
|
|
answer: panelAnswer,
|
|
prompt,
|
|
actionName,
|
|
} = await utils.chatPanel.getLatestAIActionMessage(page);
|
|
await expect(
|
|
message.getByTestId('original-text').locator('affine-code')
|
|
).toBeVisible();
|
|
await expect(panelAnswer).toHaveText(/console/);
|
|
await expect(prompt).toHaveText(/Check the code error of the follow code/);
|
|
await expect(actionName).toHaveText(/Check code error/);
|
|
});
|
|
});
|