From af5ffc22ac49f228df76f7f925a9a81a111afe3f Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Wed, 23 Oct 2024 15:16:33 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85(e2e)=20fix=20flaky=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a flaky tests on the e2e test: - "it renders correctly when we switch from one doc to another" - "it saves the doc when we change pages" --- .../e2e/__tests__/app-impress/doc-editor.spec.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts index 1d13eb8f..bd5c7f62 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts @@ -131,9 +131,10 @@ test.describe('Doc Editor', () => { test('it renders correctly when we switch from one doc to another', async ({ page, + browserName, }) => { // Check the first doc - const firstDoc = await goToGridDoc(page); + const [firstDoc] = await createDoc(page, 'doc-switch-1', browserName, 1); await expect(page.locator('h2').getByText(firstDoc)).toBeVisible(); const editor = page.locator('.ProseMirror'); @@ -142,9 +143,7 @@ test.describe('Doc Editor', () => { await expect(editor.getByText('Hello World Doc 1')).toBeVisible(); // Check the second doc - const secondDoc = await goToGridDoc(page, { - nthRow: 2, - }); + const [secondDoc] = await createDoc(page, 'doc-switch-2', browserName, 1); await expect(page.locator('h2').getByText(secondDoc)).toBeVisible(); await expect(editor.getByText('Hello World Doc 1')).toBeHidden(); await editor.click(); @@ -160,9 +159,12 @@ test.describe('Doc Editor', () => { await expect(editor.getByText('Hello World Doc 1')).toBeVisible(); }); - test('it saves the doc when we change pages', async ({ page }) => { + test('it saves the doc when we change pages', async ({ + page, + browserName, + }) => { // Check the first doc - const doc = await goToGridDoc(page); + const [doc] = await createDoc(page, 'doc-saves-change', browserName, 1); await expect(page.locator('h2').getByText(doc)).toBeVisible(); const editor = page.locator('.ProseMirror');