From 9158fe7e74dc60234189427c406fdb0180688432 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 26 Nov 2024 17:09:27 -0300 Subject: [PATCH] Refactor: improve codeAreaModalComponent.spec.ts (#4854) * Refactor codeAreaModalComponent.spec.ts to improve readability and reliability * [autofix.ci] apply automated fixes --- .../tests/core/unit/codeAreaModalComponent.spec.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/frontend/tests/core/unit/codeAreaModalComponent.spec.ts b/src/frontend/tests/core/unit/codeAreaModalComponent.spec.ts index b0bdab06d..09496259d 100644 --- a/src/frontend/tests/core/unit/codeAreaModalComponent.spec.ts +++ b/src/frontend/tests/core/unit/codeAreaModalComponent.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(); } @@ -37,7 +39,9 @@ test( await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").fill("python function"); - await page.waitForTimeout(1000); + await page.waitForSelector('[data-testid="sidebar-options-trigger"]', { + timeout: 3000, + }); await page.getByTestId("sidebar-options-trigger").click(); await page @@ -45,7 +49,9 @@ test( .isVisible({ timeout: 5000 }); await page.getByTestId("sidebar-legacy-switch").click(); - await page.waitForTimeout(1000); + await page.waitForSelector('[data-testid="prototypesPython Function"]', { + timeout: 3000, + }); await page .getByTestId("prototypesPython Function") @@ -81,11 +87,9 @@ class PythonFunctionComponent(CustomComponent): await page.locator("textarea").press("Control+a"); await page.locator("textarea").fill(wCode); await page.locator('//*[@id="checkAndSaveBtn"]').click(); - await page.waitForTimeout(1000); await page.locator("textarea").press("Control+a"); await page.locator("textarea").fill(wCode); await page.locator("textarea").fill(customComponentCode); await page.locator('//*[@id="checkAndSaveBtn"]').click(); - await page.waitForTimeout(1000); }, );