From 7df5aba991218d6af10e8e92ad1448c4ae4beb72 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Tue, 28 Apr 2026 09:06:28 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85(e2e)=20fix=20uuid=20not=20formatted?= =?UTF-8?q?=20correctly=20in=20mocked=20document?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We added a guard on the uuid format in our frontend requests, this guard broke some of our e2e tests because the mocked document id was not a valid uuid. --- .../e2e/__tests__/app-impress/doc-header.spec.ts | 6 ++---- .../apps/e2e/__tests__/app-impress/utils-common.ts | 14 +++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts index 7fce8769d..991072160 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts @@ -501,7 +501,7 @@ test.describe('Doc Header', () => { browserName === 'webkit', 'navigator.clipboard is not working with webkit and playwright', ); - await mockedDocument(page, { + const uuid = await mockedDocument(page, { abilities: { destroy: false, // Means owner link_configuration: true, @@ -534,9 +534,7 @@ test.describe('Doc Header', () => { const clipboardContent = await handle.jsonValue(); const origin = await page.evaluate(() => window.location.origin); - expect(clipboardContent.trim()).toMatch( - `${origin}/docs/mocked-document-id/`, - ); + expect(clipboardContent.trim()).toMatch(`${origin}/docs/${uuid}/`); }); test('it pins a document', async ({ page, browserName }) => { diff --git a/src/frontend/apps/e2e/__tests__/app-impress/utils-common.ts b/src/frontend/apps/e2e/__tests__/app-impress/utils-common.ts index dd98aff9e..5d011ce0d 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/utils-common.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/utils-common.ts @@ -137,13 +137,10 @@ export const createDoc = async ( }) .click(); - await page.waitForURL('**/docs/**', { - timeout: 10000, - waitUntil: 'networkidle', - }); - const input = page.getByLabel('Document title'); - await expect(input).toBeVisible(); + await expect(input).toBeVisible({ + timeout: 10000, + }); await expect(input).toHaveText(''); await input.fill(randomDocs[i]); @@ -251,6 +248,7 @@ export const waitForResponseCreateDoc = (page: Page) => { export const mockedDocument = async (page: Page, data: object) => { // document/[ID]/ or document/[ID]/tree/ routes + const uuid = crypto.randomUUID(); await page.route(/.*\/documents\/[^/]+\/(?:$|tree\/.*)/, async (route) => { const request = route.request(); if (request.method().includes('GET') && !request.url().includes('page=')) { @@ -259,7 +257,7 @@ export const mockedDocument = async (page: Page, data: object) => { }; await route.fulfill({ json: { - id: 'mocked-document-id', + id: uuid, title: 'Mocked document', path: '000000', abilities: { @@ -304,6 +302,8 @@ export const mockedDocument = async (page: Page, data: object) => { await route.continue(); } }); + + return uuid; }; export const mockedListDocs = async (page: Page, data: object[] = []) => {