From b61807d005dfc3cce05230ac4b16c7806d6d10ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=B7=E5=B8=83=E5=8A=B3=E5=A4=96=20=C2=B7=20=E8=B4=BE?= =?UTF-8?q?=E8=B4=B5?= <472285740@qq.com> Date: Wed, 30 Jul 2025 12:20:49 +0800 Subject: [PATCH] fix(core): ai chat with text e2e falky (#13361) > CLOSE AF-2773 ## Summary by CodeRabbit * **Tests** * Updated AI chat translation tests to use Simplified Chinese instead of German, adjusting expected results and assertions accordingly. --- .../e2e/chat-with/text.spec.ts | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/affine-cloud-copilot/e2e/chat-with/text.spec.ts b/tests/affine-cloud-copilot/e2e/chat-with/text.spec.ts index fdb78db5bd..787cda6e9d 100644 --- a/tests/affine-cloud-copilot/e2e/chat-with/text.spec.ts +++ b/tests/affine-cloud-copilot/e2e/chat-with/text.spec.ts @@ -38,25 +38,25 @@ test.describe('AIChatWith/Text', () => { 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 }); + const { answer } = await translate('Simplified Chinese'); + await expect(answer).toHaveText(/苹果/, { timeout: 10000 }); const copy = answer.getByTestId('answer-copy-button'); await copy.click(); await expect(answer.getByTestId('answer-copied')).toBeVisible(); const clipboardText = await page.evaluate(() => navigator.clipboard.readText() ); - expect(clipboardText).toBe('Apfel'); + expect(clipboardText).toBe('苹果'); }); 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 }); + const { answer } = await translate('Simplified Chinese'); + await expect(answer).toHaveText(/苹果/, { timeout: 10000 }); const insertBelow = answer.getByTestId('answer-insert-below'); await insertBelow.click(); const content = await utils.editor.getEditorContent(page); - expect(content).toBe('Apple\nApfel'); + expect(content).toBe('Apple\n苹果'); }); test('should support insert above', async ({ loggedInPage: page, utils }) => { @@ -101,8 +101,8 @@ test.describe('AIChatWith/Text', () => { utils, }) => { const { translate } = await utils.editor.askAIWithText(page, 'Apple'); - const { answer } = await translate('German'); - await expect(answer).toHaveText(/Apfel/, { timeout: 10000 }); + const { answer } = await translate('Simplified Chinese'); + await expect(answer).toHaveText(/苹果/, { timeout: 10000 }); const continueInChat = answer.getByTestId('answer-continue-in-chat'); await continueInChat.click(); const chatPanelInput = await page.getByTestId('chat-panel-input-container'); @@ -112,7 +112,7 @@ test.describe('AIChatWith/Text', () => { test('should support regenerate', async ({ loggedInPage: page, utils }) => { const { translate } = await utils.editor.askAIWithText(page, 'Apple'); - const { answer } = await translate('German'); + const { answer } = await translate('Simplified Chinese'); const regenerate = answer.getByTestId('answer-regenerate'); await regenerate.click(); const content = await utils.editor.getEditorContent(page); @@ -146,7 +146,7 @@ test.describe('AIChatWith/Text', () => { test('should support discard', async ({ loggedInPage: page, utils }) => { const { translate } = await utils.editor.askAIWithText(page, 'Apple'); - const { answer } = await translate('German'); + const { answer } = await translate('Simplified Chinese'); const discard = answer.getByTestId('answer-discard'); await discard.click(); await expect(answer).not.toBeVisible(); @@ -159,7 +159,7 @@ test.describe('AIChatWith/Text', () => { utils, }) => { const { translate } = await utils.editor.askAIWithText(page, 'Apple'); - const { answer } = await translate('German'); + const { answer } = await translate('Simplified Chinese'); await page.mouse.click(0, 0); await expect(page.getByText('Discard the AI result')).toBeVisible(); await page.getByTestId('confirm-modal-confirm').click();