fix(test): e2e stability (#14749)
#### PR Dependency Tree * **PR #14749** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved link preview reliability by updating request identification to better match modern browsers. * **Tests** * Made end-to-end and integration tests deterministic and more robust, improving AI chat, image generation, attachment handling, settings visibility, and editor flows. * **Chores** * Updated underlying tooling versions to enhance stability and compatibility. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -53,34 +53,34 @@ test.describe('AIChatWith/Attachments', () => {
|
||||
loggedInPage: page,
|
||||
utils,
|
||||
}) => {
|
||||
const randomStr1 = Math.random().toString(36).substring(2, 6);
|
||||
const randomStr2 = Math.random().toString(36).substring(2, 6);
|
||||
const textContent1 = `Attachment${randomStr1} is a cute cat`;
|
||||
const textContent2 = `Attachment${randomStr2} is a cute dog`;
|
||||
const textContent1 = 'This attachment describes a cute cat.';
|
||||
const textContent2 = 'This attachment describes a cute dog.';
|
||||
const buffer1 = Buffer.from(textContent1);
|
||||
const buffer2 = Buffer.from(textContent2);
|
||||
const firstName = 'cat-document.txt';
|
||||
const secondName = 'dog-document.txt';
|
||||
|
||||
await utils.chatPanel.chatWithAttachments(
|
||||
page,
|
||||
[
|
||||
{
|
||||
name: 'document1.txt',
|
||||
name: firstName,
|
||||
mimeType: 'text/plain',
|
||||
buffer: buffer1,
|
||||
},
|
||||
{
|
||||
name: 'document2.txt',
|
||||
name: secondName,
|
||||
mimeType: 'text/plain',
|
||||
buffer: buffer2,
|
||||
},
|
||||
],
|
||||
`Which animal is Attachment${randomStr1} and which animal is Attachment${randomStr2}? Answer with both attachment names.`
|
||||
`Which animal is described in ${firstName} and which animal is described in ${secondName}? Answer with both attachment names.`
|
||||
);
|
||||
|
||||
await utils.chatPanel.waitForHistory(page, [
|
||||
{
|
||||
role: 'user',
|
||||
content: `Which animal is Attachment${randomStr1} and which animal is Attachment${randomStr2}? Answer with both attachment names.`,
|
||||
content: `Which animal is described in ${firstName} and which animal is described in ${secondName}? Answer with both attachment names.`,
|
||||
},
|
||||
{
|
||||
role: 'assistant',
|
||||
@@ -90,8 +90,8 @@ test.describe('AIChatWith/Attachments', () => {
|
||||
|
||||
await expect(async () => {
|
||||
const { content } = await utils.chatPanel.getLatestAssistantMessage(page);
|
||||
expect(content).toMatch(new RegExp(`Attachment${randomStr1}`));
|
||||
expect(content).toMatch(new RegExp(`Attachment${randomStr2}`));
|
||||
expect(content).toContain(firstName);
|
||||
expect(content).toContain(secondName);
|
||||
expect(content).toMatch(/cat/i);
|
||||
expect(content).toMatch(/dog/i);
|
||||
}).toPass({ timeout: 20000 });
|
||||
|
||||
@@ -37,11 +37,11 @@ test.describe('AIChatWith/Image', () => {
|
||||
},
|
||||
]);
|
||||
|
||||
const { content } = await utils.chatPanel.getLatestAssistantMessage(page);
|
||||
await expect(
|
||||
content.toLowerCase().includes('kitten') ||
|
||||
content.toLowerCase().includes('cat')
|
||||
).toBe(true);
|
||||
await expect(async () => {
|
||||
const { content } = await utils.chatPanel.getLatestAssistantMessage(page);
|
||||
expect(content.length).toBeGreaterThan(20);
|
||||
expect(content).toMatch(/cat|kitten|feline|tabby|fluffy/i);
|
||||
}).toPass({ timeout: 20000 });
|
||||
});
|
||||
|
||||
test('support chat with mutiple images', async ({
|
||||
|
||||
Reference in New Issue
Block a user