From e6cd335b1c2d8cbf63f9eb3b98c190ab7d4accdc Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 18 Nov 2024 22:08:26 -0300 Subject: [PATCH] refactor: time and use waitForSelector in filterSidebar.spec.ts (#4609) * refactor: Improve time and use waitForSelector in filterSidebar.spec.ts * refactor: Improve time and use waitForSelector in filterSidebar.spec.ts --- .../tests/core/features/filterSidebar.spec.ts | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/frontend/tests/core/features/filterSidebar.spec.ts b/src/frontend/tests/core/features/filterSidebar.spec.ts index 59a7018c579..ee38405447f 100644 --- a/src/frontend/tests/core/features/filterSidebar.spec.ts +++ b/src/frontend/tests/core/features/filterSidebar.spec.ts @@ -24,18 +24,26 @@ test("user must see on handle click the possibility connections - LLMChain", asy 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.waitForTimeout(1000); + await page.waitForSelector('[data-testid="blank-flow"]', { + timeout: 3000, + }); await page.getByTestId("blank-flow").click(); - await page.waitForTimeout(3000); + await page.waitForSelector('[data-testid="sidebar-search-input"]', { + timeout: 3000, + }); 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") .dragTo(page.locator('//*[@id="react-flow-id"]')); @@ -45,8 +53,12 @@ test("user must see on handle click the possibility connections - LLMChain", asy await page.getByTestId("zoom_out").click(); await page.getByTestId("zoom_out").click(); await page.getByTestId("zoom_out").click(); - await page.waitForTimeout(500); - + await page.waitForSelector( + '[data-testid="handle-apirequest-shownode-urls-left"]', + { + timeout: 3000, + }, + ); await page.getByTestId("handle-apirequest-shownode-urls-left").click(); await page.waitForTimeout(500);