From c26a2d82e803ce8ec62409b13493cb109f37070f Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Sat, 7 Dec 2024 13:54:27 -0300 Subject: [PATCH] Refactor: Improve wait times in regression test (#5137) * fix: Improve wait times in regression test Improve the wait times in the regression test to ensure that the necessary elements are loaded before interacting with them. This prevents potential timing issues and improves the reliability of the test. Refactor the test code to use `waitForSelector` instead of `waitForTimeout` to wait for the modal title and sidebar custom component button to appear. Increase the timeout for the sidebar custom component button to 30 seconds to allow for slower loading times. Also, add a comment to indicate that the wait for the animation to propagate is intentional. This commit addresses the issues identified in the regression test and improves the overall stability of the test suite. --- .../extended/regression/generalBugs-shard-6.spec.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/frontend/tests/extended/regression/generalBugs-shard-6.spec.ts b/src/frontend/tests/extended/regression/generalBugs-shard-6.spec.ts index c42791cf8..cd0edfa0e 100644 --- a/src/frontend/tests/extended/regression/generalBugs-shard-6.spec.ts +++ b/src/frontend/tests/extended/regression/generalBugs-shard-6.spec.ts @@ -19,7 +19,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(); } @@ -29,7 +31,12 @@ test( await page.getByTestId("blank-flow").click(); - await page.waitForTimeout(1000); + await page.waitForSelector( + '[data-testid="sidebar-custom-component-button"]', + { + timeout: 30000, + }, + ); await page.getByTestId("sidebar-custom-component-button").click(); @@ -72,6 +79,7 @@ class CustomComponent(Component): await page.getByText("Check & Save").last().click(); + //wait for the animation to propagate await page.waitForTimeout(1000); const error = await page