From d60508ec85f7d4ab8b5f53d8658305c414baaa36 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 5 Dec 2024 21:39:14 -0300 Subject: [PATCH] refactor: Improve reliability of flowPage.spec.ts test (#5070) * test: Improve flowPage.spec.ts test reliability Enhance the reliability of the flowPage.spec.ts test by adding explicit wait conditions for the modal and sidebar components. This ensures that the test waits for the necessary elements to be present before interacting with them, reducing the likelihood of test failures due to timing issues. --- src/frontend/tests/extended/features/flowPage.spec.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/frontend/tests/extended/features/flowPage.spec.ts b/src/frontend/tests/extended/features/flowPage.spec.ts index bd6ab016b..7c198fdb7 100644 --- a/src/frontend/tests/extended/features/flowPage.spec.ts +++ b/src/frontend/tests/extended/features/flowPage.spec.ts @@ -23,13 +23,20 @@ test.describe("Flow Page tests", () => { while (modalCount === 0) { await page.getByText("New Flow", { exact: true }).click(); - await page.waitForTimeout(3000); + await page.waitForSelector('[data-testid="modal-title"]', { + timeout: 3000, + }); modalCount = await page.getByTestId("modal-title")?.count(); } await page.getByTestId("blank-flow").click(); - await page.waitForTimeout(1000); + await page.waitForSelector( + '[data-testid="sidebar-custom-component-button"]', + { + timeout: 3000, + }, + ); await page.getByTestId("sidebar-custom-component-button").click();