fix(core): ai chat with text e2e falky (#13361)
> CLOSE AF-2773 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Updated AI chat translation tests to use Simplified Chinese instead of German, adjusting expected results and assertions accordingly. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -38,25 +38,25 @@ test.describe('AIChatWith/Text', () => {
|
|||||||
|
|
||||||
test('should support copy answer', async ({ loggedInPage: page, utils }) => {
|
test('should support copy answer', async ({ loggedInPage: page, 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 copy = answer.getByTestId('answer-copy-button');
|
const copy = answer.getByTestId('answer-copy-button');
|
||||||
await copy.click();
|
await copy.click();
|
||||||
await expect(answer.getByTestId('answer-copied')).toBeVisible();
|
await expect(answer.getByTestId('answer-copied')).toBeVisible();
|
||||||
const clipboardText = await page.evaluate(() =>
|
const clipboardText = await page.evaluate(() =>
|
||||||
navigator.clipboard.readText()
|
navigator.clipboard.readText()
|
||||||
);
|
);
|
||||||
expect(clipboardText).toBe('Apfel');
|
expect(clipboardText).toBe('苹果');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should support insert below', async ({ loggedInPage: page, utils }) => {
|
test('should support insert below', async ({ loggedInPage: page, 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 insertBelow = answer.getByTestId('answer-insert-below');
|
const insertBelow = answer.getByTestId('answer-insert-below');
|
||||||
await insertBelow.click();
|
await insertBelow.click();
|
||||||
const content = await utils.editor.getEditorContent(page);
|
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 }) => {
|
test('should support insert above', async ({ loggedInPage: page, utils }) => {
|
||||||
@@ -101,8 +101,8 @@ test.describe('AIChatWith/Text', () => {
|
|||||||
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 continueInChat = answer.getByTestId('answer-continue-in-chat');
|
const continueInChat = answer.getByTestId('answer-continue-in-chat');
|
||||||
await continueInChat.click();
|
await continueInChat.click();
|
||||||
const chatPanelInput = await page.getByTestId('chat-panel-input-container');
|
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 }) => {
|
test('should support regenerate', async ({ loggedInPage: page, 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');
|
||||||
const regenerate = answer.getByTestId('answer-regenerate');
|
const regenerate = answer.getByTestId('answer-regenerate');
|
||||||
await regenerate.click();
|
await regenerate.click();
|
||||||
const content = await utils.editor.getEditorContent(page);
|
const content = await utils.editor.getEditorContent(page);
|
||||||
@@ -146,7 +146,7 @@ test.describe('AIChatWith/Text', () => {
|
|||||||
|
|
||||||
test('should support discard', async ({ loggedInPage: page, utils }) => {
|
test('should support discard', async ({ loggedInPage: page, 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');
|
||||||
const discard = answer.getByTestId('answer-discard');
|
const discard = answer.getByTestId('answer-discard');
|
||||||
await discard.click();
|
await discard.click();
|
||||||
await expect(answer).not.toBeVisible();
|
await expect(answer).not.toBeVisible();
|
||||||
@@ -159,7 +159,7 @@ test.describe('AIChatWith/Text', () => {
|
|||||||
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 page.mouse.click(0, 0);
|
await page.mouse.click(0, 0);
|
||||||
await expect(page.getByText('Discard the AI result')).toBeVisible();
|
await expect(page.getByText('Discard the AI result')).toBeVisible();
|
||||||
await page.getByTestId('confirm-modal-confirm').click();
|
await page.getByTestId('confirm-modal-confirm').click();
|
||||||
|
|||||||
Reference in New Issue
Block a user