From d200c8aba427df0b93b78293b7989ba4bd35f73b Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 25 Nov 2024 21:57:47 -0300 Subject: [PATCH] refactor: remove regression test timeouts (#4837) refactor: Remove unnecessary wait timeouts in regression test --- .../regression/generalBugs-shard-9.spec.ts | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/frontend/tests/core/regression/generalBugs-shard-9.spec.ts b/src/frontend/tests/core/regression/generalBugs-shard-9.spec.ts index 34e85f7f0..c96f241f8 100644 --- a/src/frontend/tests/core/regression/generalBugs-shard-9.spec.ts +++ b/src/frontend/tests/core/regression/generalBugs-shard-9.spec.ts @@ -17,8 +17,6 @@ test( await page.goto("/"); - await page.waitForTimeout(1000); - let modalCount = 0; try { const modalTitleElement = await page?.getByTestId("modal-title"); @@ -31,13 +29,17 @@ 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.getByTestId("side_nav_options_all-templates").click(); await page.getByRole("heading", { name: "Basic Prompting" }).click(); - await page.waitForTimeout(1000); + await page.waitForSelector('[data-testid="fit_view"]', { + timeout: 2000, + }); await page.getByTestId("fit_view").click(); @@ -88,8 +90,6 @@ test( await page.mouse.up(); await page.mouse.down(); - await page.waitForTimeout; - await page.getByTestId("fit_view").click(); let outdatedComponents = await page @@ -98,14 +98,12 @@ test( while (outdatedComponents > 0) { await page.getByTestId("icon-AlertTriangle").first().click(); - await page.waitForTimeout(1000); outdatedComponents = await page.getByTestId("icon-AlertTriangle").count(); } let filledApiKey = await page.getByTestId("remove-icon-badge").count(); while (filledApiKey > 0) { await page.getByTestId("remove-icon-badge").first().click(); - await page.waitForTimeout(1000); filledApiKey = await page.getByTestId("remove-icon-badge").count(); } @@ -153,8 +151,6 @@ AI: await page.locator('//*[@id="react-flow-id"]').hover(); - await page.waitForTimeout(1000); - await page.getByText("Playground", { exact: true }).last().click(); await page.waitForSelector('[data-testid="button-send"]', { @@ -175,13 +171,15 @@ AI: await page.getByTestId("button-send").click(); - await page.waitForTimeout(400); + await page.waitForSelector("text=AI", { timeout: 30000 }); const textLocator = page.locator("text=AI"); await textLocator.nth(6).waitFor({ timeout: 30000 }); await expect(textLocator.nth(1)).toBeVisible(); - await page.waitForTimeout(3000); + await page.waitForSelector("[data-testid='button-send']", { + timeout: 3000, + }); const memoryResponseText = await page .locator(".form-modal-chat-text")