From 02403150208b7a09b9bc42f1aa8fafb7ef716c31 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Fri, 29 Nov 2024 12:57:21 -0300 Subject: [PATCH] Refactor: improve dropdownComponent (#4855) Refactor dropdownComponent.spec.ts to improve code readability and reliability --- .../tests/core/unit/dropdownComponent.spec.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/frontend/tests/core/unit/dropdownComponent.spec.ts b/src/frontend/tests/core/unit/dropdownComponent.spec.ts index 474a94501..fa4692152 100644 --- a/src/frontend/tests/core/unit/dropdownComponent.spec.ts +++ b/src/frontend/tests/core/unit/dropdownComponent.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"]', { @@ -37,7 +39,9 @@ test( await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").fill("amazon"); - await page.waitForTimeout(1000); + await page.waitForSelector('[data-testid="modelsAmazon Bedrock"]', { + timeout: 3000, + }); await page .getByTestId("modelsAmazon Bedrock") @@ -73,7 +77,9 @@ test( expect(false).toBeTruthy(); } - await page.waitForTimeout(1000); + await page.waitForSelector('[data-testid="more-options-modal"]', { + timeout: 3000, + }); await page.getByTestId("more-options-modal").click(); await page.getByTestId("advanced-button-modal").click(); @@ -148,7 +154,6 @@ test( expect(false).toBeTruthy(); } await page.getByTestId("code-button-modal").click(); - await page.waitForTimeout(1000); await page.locator("textarea").press("Control+a"); const emptyOptionsCode = `from langchain_community.chat_models.bedrock import BedrockChat