fix(core): falky translate e2e (#13363)

> CLOSE AF-2774

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## 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.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
德布劳外 · 贾贵
2025-07-30 14:52:04 +08:00
committed by GitHub
parent 603f2a1e5a
commit 7c1a9957b3
3 changed files with 15 additions and 15 deletions

View File

@@ -13,8 +13,8 @@ test.describe('AIAction/Translate', () => {
utils, utils,
}) => { }) => {
const { translate } = await utils.editor.askAIWithText(page, 'Apple'); const { translate } = await utils.editor.askAIWithText(page, 'Apple');
const { answer, responses } = await translate('German'); const { answer, responses } = await translate('Simplified Chinese');
await expect(answer).toHaveText(/Apfel/, { timeout: 10000 }); await expect(answer).toHaveText(/苹果/, { timeout: 10000 });
expect(responses).toEqual(new Set(['insert-below', 'replace-selection'])); expect(responses).toEqual(new Set(['insert-below', 'replace-selection']));
}); });
@@ -28,8 +28,8 @@ test.describe('AIAction/Translate', () => {
await utils.editor.createEdgelessText(page, 'Apple'); await utils.editor.createEdgelessText(page, 'Apple');
} }
); );
const { answer, responses } = await translate('German'); const { answer, responses } = await translate('Simplified Chinese');
await expect(answer).toHaveText(/Apfel/, { timeout: 10000 }); await expect(answer).toHaveText(/苹果/, { timeout: 10000 });
expect(responses).toEqual(new Set(['insert-below'])); expect(responses).toEqual(new Set(['insert-below']));
}); });
@@ -43,8 +43,8 @@ test.describe('AIAction/Translate', () => {
await utils.editor.createEdgelessNote(page, 'Apple'); await utils.editor.createEdgelessNote(page, 'Apple');
} }
); );
const { answer, responses } = await translate('German'); const { answer, responses } = await translate('Simplified Chinese');
await expect(answer).toHaveText(/Apfel/, { timeout: 10000 }); await expect(answer).toHaveText(/苹果/, { timeout: 10000 });
expect(responses).toEqual(new Set(['insert-below'])); expect(responses).toEqual(new Set(['insert-below']));
}); });
@@ -53,8 +53,8 @@ test.describe('AIAction/Translate', () => {
utils, utils,
}) => { }) => {
const { translate } = await utils.editor.askAIWithText(page, 'Apple'); const { translate } = await utils.editor.askAIWithText(page, 'Apple');
const { answer } = await translate('German'); const { answer } = await translate('Simplified Chinese');
await expect(answer).toHaveText(/Apfel/, { timeout: 10000 }); await expect(answer).toHaveText(/苹果/, { timeout: 10000 });
const replace = answer.getByTestId('answer-replace'); const replace = answer.getByTestId('answer-replace');
await replace.click(); await replace.click();
await utils.chatPanel.waitForHistory(page, [ await utils.chatPanel.waitForHistory(page, [
@@ -67,7 +67,7 @@ test.describe('AIAction/Translate', () => {
prompt, prompt,
actionName, actionName,
} = await utils.chatPanel.getLatestAIActionMessage(page); } = await utils.chatPanel.getLatestAIActionMessage(page);
await expect(panelAnswer).toHaveText(/Apfel/); await expect(panelAnswer).toHaveText(/苹果/);
await expect(prompt).toHaveText(/Translate/); await expect(prompt).toHaveText(/Translate/);
await expect(actionName).toHaveText(/Translate/); await expect(actionName).toHaveText(/Translate/);
}); });

View File

@@ -18,12 +18,12 @@ test.describe('AIChatWith/EdgelessNoteBlock', () => {
await utils.editor.createEdgelessNote(page, 'Apple'); await utils.editor.createEdgelessNote(page, 'Apple');
} }
); );
const { answer } = await translate('German'); const { answer } = await translate('Simplified Chinese');
await expect(answer).toHaveText(/Apfel/, { timeout: 10000 }); await expect(answer).toHaveText(/苹果/, { timeout: 10000 });
const insertBelow = answer.getByTestId('answer-insert-below'); const insertBelow = answer.getByTestId('answer-insert-below');
await insertBelow.click(); await insertBelow.click();
await expect(page.locator('affine-edgeless-note').nth(1)).toHaveText( await expect(page.locator('affine-edgeless-note').nth(1)).toHaveText(
/Apfel/ /苹果/
); );
}); });
}); });

View File

@@ -18,12 +18,12 @@ test.describe('AIChatWith/EdgelessTextBlock', () => {
await utils.editor.createEdgelessText(page, 'Apple'); await utils.editor.createEdgelessText(page, 'Apple');
} }
); );
const { answer } = await translate('German'); const { answer } = await translate('Simplified Chinese');
await expect(answer).toHaveText(/Apfel/, { timeout: 10000 }); await expect(answer).toHaveText(/苹果/, { timeout: 10000 });
const insertBelow = answer.getByTestId('answer-insert-below'); const insertBelow = answer.getByTestId('answer-insert-below');
await insertBelow.click(); await insertBelow.click();
await expect(page.locator('affine-edgeless-text')).toHaveText( await expect(page.locator('affine-edgeless-text')).toHaveText(
/Apple[\s\S]*Apfel/ /Apple[\s\S]*苹果/
); );
}); });
}); });