From e777e397b946fadd686c62e029b112b077854ea1 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 28 Nov 2024 11:58:04 -0300 Subject: [PATCH] Refactor: update nestedComponent test to improve performance (#4919) fix: update nestedComponent test to use explicit timeouts The nestedComponent test was updated to use explicit timeouts when waiting for certain elements to appear. This ensures that the test waits for the elements to be present before proceeding, preventing any potential race conditions or flakiness in the test results. --- src/frontend/tests/core/unit/nestedComponent.spec.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/frontend/tests/core/unit/nestedComponent.spec.ts b/src/frontend/tests/core/unit/nestedComponent.spec.ts index c0c2166b0..27a8bbd13 100644 --- a/src/frontend/tests/core/unit/nestedComponent.spec.ts +++ b/src/frontend/tests/core/unit/nestedComponent.spec.ts @@ -25,7 +25,9 @@ test( 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.waitForSelector('[data-testid="blank-flow"]', { @@ -35,7 +37,9 @@ test( await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").fill("api request"); - await page.waitForTimeout(1000); + await page.waitForSelector('[data-testid="dataAPI Request"]', { + timeout: 3000, + }); await page .getByTestId("dataAPI Request")