(e2e) webp image with export tests

We added a new webp image to the e2e tests and updated the export
tests to include this new image format.
This ensures that the export functionality correctly
handles webp images, maintaining compatibility and
performance across different image formats.
We increase throttles, to be sure that the e2e tests
don't hit them.
This commit is contained in:
Anthony LC
2026-09-04 14:46:26 +02:00
parent 0815c14d78
commit 63ccd0ae58
5 changed files with 47 additions and 43 deletions
+9 -5
View File
@@ -1,10 +1,14 @@
# For the CI job test-e2e
BURST_THROTTLE_RATES="1000/minute"
BURST_THROTTLE_RATES="2000/minute"
COLLABORATION_API_URL=http://y-provider:4444/collaboration/api/
SUSTAINED_THROTTLE_RATES="1000/minute"
SUSTAINED_THROTTLE_RATES="2000/minute"
Y_PROVIDER_API_BASE_URL=http://y-provider-converter:4444/api/
# Throttle
API_DOCUMENT_THROTTLE_RATE=1000/min
API_DOCUMENT_ACCESS_THROTTLE_RATE=1000/min
API_CONFIG_THROTTLE_RATE=1000/min
API_CONFIG_THROTTLE_RATE=2000/min
API_DOCUMENT_ACCESS_THROTTLE_RATE=2000/min
API_DOCUMENT_ASK_FOR_ACCESS_THROTTLE_RATE=2000/min
API_DOCUMENT_THROTTLE_RATE=2000/min
API_INVITATION_THROTTLE_RATE=2000/min
API_USERS_LIST_THROTTLE_RATE_BURST=2000/min
API_USERS_LIST_THROTTLE_RATE_SUSTAINED=2000/min
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@@ -4,16 +4,10 @@ import {
clickInDocOptionMenu,
createDoc,
getOtherBrowserName,
updateDocTitle,
verifyDocName,
} from './utils-common';
import { addNewMember, connectOtherUserToDoc } from './utils-share';
import {
addChild,
clickOnAddRootSubPage,
createRootSubPage,
getTreeRow,
} from './utils-sub-pages';
import { addChild, createRootSubPage, getTreeRow } from './utils-sub-pages';
test.describe('Doc Tree', () => {
test.beforeEach(async ({ page }) => {
@@ -157,17 +151,23 @@ test.describe('Doc Tree', () => {
const docTree = page.getByTestId('doc-tree');
// Create first sub page
await clickOnAddRootSubPage(page);
await updateDocTitle(page, 'first move');
const { name: docChild1 } = await createRootSubPage(
page,
browserName,
'first move',
);
// Create second sub page
await clickOnAddRootSubPage(page);
await updateDocTitle(page, 'second move');
const { name: docChild2 } = await createRootSubPage(
page,
browserName,
'second move',
);
await page.waitForTimeout(500); // Wait for the tree to be stable
const firstSubPageItem = docTree.getByText('first move').first();
const secondSubPageItem = docTree.getByText('second move').first();
const firstSubPageItem = docTree.getByText(docChild1).first();
const secondSubPageItem = docTree.getByText(docChild2).first();
// check that the sub pages are visible in the tree
await expect(firstSubPageItem).toBeVisible();
@@ -178,8 +178,8 @@ test.describe('Doc Tree', () => {
await expect(allSubPageItems).toHaveCount(2);
// Check that elements are in the correct order
await expect(allSubPageItems.nth(0).getByText('first move')).toBeVisible();
await expect(allSubPageItems.nth(1).getByText('second move')).toBeVisible();
await expect(allSubPageItems.nth(0).getByText(docChild1)).toBeVisible();
await expect(allSubPageItems.nth(1).getByText(docChild2)).toBeVisible();
// Will move the first sub page to the second position
// Wait for elements to be stable before reading their positions — a React
@@ -211,8 +211,8 @@ test.describe('Doc Tree', () => {
// Wait for the reorder to be reflected in the tree before reloading —
// this also ensures the API call has had time to persist the new order.
await expect(allSubPageItems.nth(0).getByText('second move')).toBeVisible();
await expect(allSubPageItems.nth(1).getByText('first move')).toBeVisible();
await expect(allSubPageItems.nth(0).getByText(docChild2)).toBeVisible();
await expect(allSubPageItems.nth(1).getByText(docChild1)).toBeVisible();
// reload the page
await page.reload();
@@ -222,8 +222,8 @@ test.describe('Doc Tree', () => {
await expect(secondSubPageItem).toBeVisible();
// Check that elements are in the correct order
await expect(allSubPageItems.nth(0).getByText('second move')).toBeVisible();
await expect(allSubPageItems.nth(1).getByText('first move')).toBeVisible();
await expect(allSubPageItems.nth(0).getByText(docChild2)).toBeVisible();
await expect(allSubPageItems.nth(1).getByText(docChild1)).toBeVisible();
});
test('it detaches a document', async ({ page, browserName }) => {
@@ -64,7 +64,7 @@ export const overrideDocContent = async ({
await page.waitForTimeout(1000);
// Add a simple Image PNG (1 IDAT chunk)
// Add image PNG
await openSuggestionMenu({
page,
suggestion: 'Resizable image with caption',
@@ -73,24 +73,6 @@ export const overrideDocContent = async ({
await page.getByText('Upload image').click();
const fileChooserPNG = await fileChooserPNGPromise;
await fileChooserPNG.setFiles(
path.join(__dirname, 'assets/logo-suite-numerique.png'),
);
const imagePng = page
.locator('.--docs--editor-container')
.getByRole('img', { name: 'logo-suite-numerique.png' });
await expect(imagePng).toBeVisible();
await page.waitForTimeout(1000);
// Add a more complex Image PNG (45 IDAT chunks)
await openSuggestionMenu({
page,
suggestion: 'Resizable image with caption',
});
const fileChooserComplexPNGPromise = page.waitForEvent('filechooser');
await page.getByText('Upload image').click();
const fileChooserComplexPNG = await fileChooserComplexPNGPromise;
await fileChooserComplexPNG.setFiles(
path.join(__dirname, 'assets/issue-860-complex-image.png'),
);
const complexImagePng = page
@@ -100,6 +82,24 @@ export const overrideDocContent = async ({
await page.waitForTimeout(1000);
// Add image WEBP
await openSuggestionMenu({
page,
suggestion: 'Resizable image with caption',
});
const fileChooserWEBPPromise = page.waitForEvent('filechooser');
await page.getByText('Upload image').click();
const fileChooserWEBP = await fileChooserWEBPPromise;
await fileChooserWEBP.setFiles(
path.join(__dirname, 'assets/webp-image.webp'),
);
const complexImageWebP = page
.locator('.--docs--editor-container')
.getByRole('img', { name: 'webp-image.webp' });
await expect(complexImageWebP).toBeVisible();
await page.waitForTimeout(1000);
return randomDoc;
};