diff --git a/src/frontend/tests/extended/features/userSettings.spec.ts b/src/frontend/tests/extended/features/userSettings.spec.ts index dc1925656..4ad45097b 100644 --- a/src/frontend/tests/extended/features/userSettings.spec.ts +++ b/src/frontend/tests/extended/features/userSettings.spec.ts @@ -1,4 +1,4 @@ -import { test } from "@playwright/test"; +import { expect, test } from "@playwright/test"; test( "should see general profile gradient", @@ -14,12 +14,12 @@ test( timeout: 30000, }); await page.getByTestId("user-profile-settings").click(); - await page.waitForTimeout(1000); await page.getByText("Settings").click(); - await page.waitForTimeout(2000); - await page.getByText("General").nth(2).isVisible(); + await expect(page.getByText("General").nth(2)).toBeVisible({ + timeout: 4000, + }); await page.getByText("Profile Gradient").isVisible(); }, ); @@ -34,7 +34,6 @@ test( const randomName3 = Math.random().toString(36).substring(2); await page.goto("/"); - await page.waitForTimeout(1000); await page.getByTestId("user-profile-settings").click(); await page.getByText("Settings").click(); await page.getByText("Global Variables").click(); @@ -56,27 +55,27 @@ test( .fill("testtesttesttesttesttesttesttest"); await page.getByTestId("popover-anchor-apply-to-fields").click(); - await page.waitForTimeout(1000); + await page.getByPlaceholder("Search options...").waitFor({ + state: "visible", + timeout: 30000, + }); await page.getByPlaceholder("Search options...").fill("System"); - await page.waitForTimeout(500); - await page.waitForSelector("text=System", { timeout: 30000 }); - await page.waitForTimeout(500); - await page.getByText("System").last().click(); await page.getByPlaceholder("Search options...").fill("openAI"); await page.waitForSelector("text=openai", { timeout: 30000 }); - await page.waitForTimeout(500); - await page.getByText("openai").last().click(); - await page.waitForTimeout(500); + await page.getByPlaceholder("Search options...").waitFor({ + state: "visible", + timeout: 30000, + }); await page.getByPlaceholder("Search options...").fill("ollama"); @@ -88,7 +87,10 @@ test( await page.getByText(randomName).last().click(); await page.getByText(randomName).last().click(); - await page.waitForTimeout(500); + await page.getByPlaceholder("Insert a name for the variable...").waitFor({ + state: "visible", + timeout: 30000, + }); await page .getByPlaceholder("Insert a name for the variable...") @@ -100,7 +102,10 @@ test( await page.getByText(randomName2).last().click(); - await page.waitForTimeout(500); + await page.getByPlaceholder("Insert a name for the variable...").waitFor({ + state: "visible", + timeout: 30000, + }); await page .getByPlaceholder("Insert a name for the variable...") @@ -110,8 +115,6 @@ test( await page.getByText(randomName3).last().isVisible(); - await page.waitForTimeout(2000); - await page.locator(".ag-checkbox-input").first().click(); await page.getByTestId("icon-Trash2").click(); await page.getByText("No data available").isVisible(); @@ -128,10 +131,8 @@ test("should see shortcuts", { tag: ["@release"] }, async ({ page }) => { timeout: 30000, }); await page.getByTestId("user-profile-settings").click(); - await page.waitForTimeout(1000); await page.getByText("Settings").click(); - await page.waitForTimeout(3000); await page.getByText("General").nth(2).isVisible(); await page.getByText("Shortcuts").nth(0).click(); @@ -161,7 +162,6 @@ test( async ({ page }) => { await page.goto("/"); - await page.waitForTimeout(1000); await page.getByTestId("user-profile-settings").click(); await page.getByText("Settings").click(); await page.getByText("Langflow API").first().click(); @@ -177,8 +177,9 @@ test( await page.getByText("Create Secret Key", { exact: true }).click(); await page.getByText("Please save").isVisible(); await page.getByTestId("icon-Copy").click(); - await page.waitForTimeout(1000); - await page.getByText("Api Key Copied!").isVisible(); + await expect(page.getByText("Api Key Copied!")).toBeVisible({ + timeout: 3000, + }); await page.getByText(randomName).isVisible(); }, );