From 47d7004fc0c2303fd138948882ddb8da75d794af Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Sat, 7 Dec 2024 00:19:17 -0300 Subject: [PATCH] Refactor: Improve test stability and reliability (#5135) fix: Improve test stability and reliability Improve the stability and reliability of the tests in the generalBugs-shard-2.spec.ts file. - Use waitForSelector instead of waitForTimeout to ensure that the modal and data elements are present before proceeding. - Increase the timeout value to 3000 milliseconds for better reliability. - Add a comment to indicate the purpose of the timeout. This commit addresses the issue of intermittent failures in the tests and enhances the overall test stability. --- .../extended/regression/generalBugs-shard-2.spec.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/frontend/tests/extended/regression/generalBugs-shard-2.spec.ts b/src/frontend/tests/extended/regression/generalBugs-shard-2.spec.ts index 6fe984a2f..a3499e4ad 100644 --- a/src/frontend/tests/extended/regression/generalBugs-shard-2.spec.ts +++ b/src/frontend/tests/extended/regression/generalBugs-shard-2.spec.ts @@ -36,7 +36,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(); } @@ -45,7 +47,9 @@ test( await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").fill("webhook"); - await page.waitForTimeout(1000); + await page.waitForSelector('[data-testid="dataWebhook"]', { + timeout: 3000, + }); await page .getByTestId("dataWebhook") @@ -62,7 +66,9 @@ test( await page.getByTestId("zoom_out").click(); await page.getByTestId("zoom_out").click(); + // wait for the update to be applied await page.waitForTimeout(1000); + await page.getByText("API", { exact: true }).click(); await page.getByText("Webhook cURL", { exact: true }).click();