From 7c1a9957b3d805414167c689e123994598f23488 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 14:52:04 +0800 Subject: [PATCH] fix(core): falky translate e2e (#13363) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > CLOSE AF-2774 ## Summary by CodeRabbit * **Tests** * Updated translation tests to use Simplified Chinese instead of German as the target language. * Adjusted expected results in assertions to match Chinese characters "苹果" instead of the German word "Apfel" across relevant test cases. --- .../e2e/ai-action/translate.spec.ts | 18 +++++++++--------- .../e2e/chat-with/edgeless-note-block.spec.ts | 6 +++--- .../e2e/chat-with/edgeless-text-block.spec.ts | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/affine-cloud-copilot/e2e/ai-action/translate.spec.ts b/tests/affine-cloud-copilot/e2e/ai-action/translate.spec.ts index 62731a2324..bf3f54b255 100644 --- a/tests/affine-cloud-copilot/e2e/ai-action/translate.spec.ts +++ b/tests/affine-cloud-copilot/e2e/ai-action/translate.spec.ts @@ -13,8 +13,8 @@ test.describe('AIAction/Translate', () => { utils, }) => { const { translate } = await utils.editor.askAIWithText(page, 'Apple'); - const { answer, responses } = await translate('German'); - await expect(answer).toHaveText(/Apfel/, { timeout: 10000 }); + const { answer, responses } = await translate('Simplified Chinese'); + await expect(answer).toHaveText(/苹果/, { timeout: 10000 }); expect(responses).toEqual(new Set(['insert-below', 'replace-selection'])); }); @@ -28,8 +28,8 @@ test.describe('AIAction/Translate', () => { await utils.editor.createEdgelessText(page, 'Apple'); } ); - const { answer, responses } = await translate('German'); - await expect(answer).toHaveText(/Apfel/, { timeout: 10000 }); + const { answer, responses } = await translate('Simplified Chinese'); + await expect(answer).toHaveText(/苹果/, { timeout: 10000 }); expect(responses).toEqual(new Set(['insert-below'])); }); @@ -43,8 +43,8 @@ test.describe('AIAction/Translate', () => { await utils.editor.createEdgelessNote(page, 'Apple'); } ); - const { answer, responses } = await translate('German'); - await expect(answer).toHaveText(/Apfel/, { timeout: 10000 }); + const { answer, responses } = await translate('Simplified Chinese'); + await expect(answer).toHaveText(/苹果/, { timeout: 10000 }); expect(responses).toEqual(new Set(['insert-below'])); }); @@ -53,8 +53,8 @@ test.describe('AIAction/Translate', () => { 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 replace = answer.getByTestId('answer-replace'); await replace.click(); await utils.chatPanel.waitForHistory(page, [ @@ -67,7 +67,7 @@ test.describe('AIAction/Translate', () => { prompt, actionName, } = await utils.chatPanel.getLatestAIActionMessage(page); - await expect(panelAnswer).toHaveText(/Apfel/); + await expect(panelAnswer).toHaveText(/苹果/); await expect(prompt).toHaveText(/Translate/); await expect(actionName).toHaveText(/Translate/); }); 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.ts index ba68bccf50..ac595f7c49 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 @@ -18,12 +18,12 @@ test.describe('AIChatWith/EdgelessNoteBlock', () => { await utils.editor.createEdgelessNote(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(); await expect(page.locator('affine-edgeless-note').nth(1)).toHaveText( - /Apfel/ + /苹果/ ); }); }); 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.ts index 1c3daa9d36..940d9cef3f 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 @@ -18,12 +18,12 @@ test.describe('AIChatWith/EdgelessTextBlock', () => { await utils.editor.createEdgelessText(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(); await expect(page.locator('affine-edgeless-text')).toHaveText( - /Apple[\s\S]*Apfel/ + /Apple[\s\S]*苹果/ ); }); });