From 6d252d34c6da0684798e2c1c2f24d0d3a63686b6 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Sat, 7 Dec 2024 00:43:23 -0300 Subject: [PATCH] Refactor: improve YouTube Transcripts integration tests (#5129) fix: improve YouTube Transcripts integration tests Improve the integration tests for the YouTube Transcripts feature by adding explicit wait conditions for modals and elements. This ensures that the tests are more reliable and less prone to timing issues. --- .../integrations/youtube-transcripts.spec.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/frontend/tests/extended/integrations/youtube-transcripts.spec.ts b/src/frontend/tests/extended/integrations/youtube-transcripts.spec.ts index f09648c98..921289112 100644 --- a/src/frontend/tests/extended/integrations/youtube-transcripts.spec.ts +++ b/src/frontend/tests/extended/integrations/youtube-transcripts.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(); } @@ -33,7 +35,9 @@ test( await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").fill("youtube"); - await page.waitForTimeout(1000); + await page.waitForSelector('[id="toolsYouTube Transcripts"]', { + timeout: 3000, + }); await page .locator('//*[@id="toolsYouTube Transcripts"]') @@ -48,7 +52,6 @@ test( while (outdatedComponents > 0) { await page.getByTestId("icon-AlertTriangle").first().click(); - await page.waitForTimeout(1000); outdatedComponents = await page.getByTestId("icon-AlertTriangle").count(); } @@ -62,12 +65,10 @@ test( await page.getByTestId("output-inspection-data").first().click(); - await page.waitForTimeout(1000); + await page.waitForSelector("text=Component Output", { timeout: 30000 }); await page.getByRole("gridcell").first().click(); - await page.waitForTimeout(1000); - const value = await page.getByPlaceholder("Empty").inputValue(); expect(value.length).toBeGreaterThan(10); },