♻️ (playwright.config.ts): increase workers from 1 to 3 to improve test parallelism

 (basicExamples.spec.ts): add waitForSelector for 'fit view' to ensure element is loaded

 (basicExamples.spec.ts): add waitForSelector for 'built successfully' to ensure element is loaded

 (chatInputOutput.spec.ts): add waitForSelector for 'extended-disclosure' to ensure element is loaded

 (codeAreaModalComponent.spec.ts): add waitForSelector for 'extended-disclosure' to ensure element is loaded

 (dropdownComponent.spec.ts): add waitForSelector for 'extended-disclosure' to ensure element is loaded

 (fileUploadComponent.spec.ts): add waitForSelector for 'extended-disclosure' to ensure element is loaded

 (filterEdge.spec.ts): add waitForSelector for 'extended-disclosure' to ensure element is loaded

 (filterEdge.spec.ts): update test expectations for 'disclosure-agents' to be visible

 (floatComponent.spec.ts): add waitForSelector for 'extended-disclosure' to ensure element is loaded

 (flowPage.spec.ts): add waitForSelector for 'extended-disclosure' to ensure element is loaded

 (folders.spec.ts): add waitForSelector for 'icon-ChevronLeft' to ensure element is loaded

 (folders.spec.ts): update folder name input and visibility check to improve reliability

 (generalBugs.spec.ts): add waitForSelector for 'extended-disclosure' to ensure element is loaded

 (tests): replace waitForTimeout with waitForSelector in end-to-end tests

Replace `waitForTimeout` with `waitForSelector` to improve test reliability and reduce flakiness.
This commit is contained in:
cristhianzl 2024-06-25 22:14:17 -03:00 committed by Gabriel Luiz Freitas Almeida
commit 4e62f95a2a
20 changed files with 92 additions and 38 deletions

View file

@ -21,7 +21,7 @@ export default defineConfig({
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: 1,
workers: 3,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
timeout: 120 * 1000,
// reporter: [

View file

@ -24,6 +24,10 @@ test("Basic Prompting (Hello, World)", async ({ page }) => {
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForTimeout(1000);
await page.waitForSelector('[title="fit view"]', {
timeout: 100000,
});
await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
@ -283,6 +287,9 @@ test("Blog Writer", async ({ page }) => {
await page.getByTestId("button_run_chat output").click();
await page.waitForTimeout(5000);
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("built successfully").last().click({
timeout: 30000,
});

View file

@ -28,7 +28,11 @@ test("chat_io_teste", async ({ page }) => {
);
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("chat output");

View file

@ -23,7 +23,11 @@ test("CodeAreaModalComponent", async ({ page }) => {
await page.waitForTimeout(1000);
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("python function");

View file

@ -22,8 +22,9 @@ test("dropDownComponent", async ({ page }) => {
await page.waitForTimeout(1000);
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("amazon");

View file

@ -23,7 +23,9 @@ test("should be able to upload a file", async ({ page }) => {
await page.waitForTimeout(1000);
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();

View file

@ -21,7 +21,9 @@ test("LLMChain - Tooltip", async ({ page }) => {
}
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
@ -168,12 +170,13 @@ test("LLMChain - Filter", async ({ page }) => {
}
await page.waitForTimeout(1000);
await page.getByTestId(
"input-list-plus-btn-edit_metadata_indexing_include-2",
);
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("llmchain");
@ -196,10 +199,8 @@ test("LLMChain - Filter", async ({ page }) => {
)
.click();
await expect(page.getByTestId("disclosure-models")).toBeVisible();
await expect(
page.getByTestId("modelsGoogle Generative AI").first(),
).toBeVisible();
await expect(page.getByTestId("disclosure-agents")).toBeVisible();
await expect(page.getByTestId("chainsLLMChain").first()).toBeVisible();
await expect(
page.getByTestId("langchain_utilitiesSearchApi").first(),

View file

@ -22,7 +22,9 @@ test("FloatComponent", async ({ page }) => {
await page.waitForTimeout(1000);
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("ollama");

View file

@ -22,7 +22,9 @@ test.describe("Flow Page tests", () => {
}
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("custom");

View file

@ -22,6 +22,10 @@ test("CRUD folders", async ({ page }) => {
}
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
await page.getByTestId("icon-ChevronLeft").first().click();
await page.getByText("My Collection").nth(2).isVisible();
@ -35,9 +39,16 @@ test("CRUD folders", async ({ page }) => {
await page.getByText("New Folder").last().isVisible();
await page.waitForTimeout(1000);
await page.getByText("New Folder").last().dblclick();
await page.getByTestId("input-folder").fill("new folder test name");
await page.keyboard.press("Enter");
await page.getByText("new folder test name").last().isVisible();
const element = await page.getByTestId("input-folder");
await element.fill("new folder test name");
await page.getByText("My Projects").last().click();
await page.getByText("new folder test name").last().waitFor({
state: "visible",
timeout: 30000,
});
await page
.getByText("new folder test name")

View file

@ -22,7 +22,9 @@ test("should interact with api request", async ({ page }) => {
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(1000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("api request");

View file

@ -22,7 +22,9 @@ test("GlobalVariables", async ({ page }) => {
await page.waitForTimeout(1000);
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("openai");

View file

@ -22,7 +22,9 @@ test("InputComponent", async ({ page }) => {
await page.waitForTimeout(1000);
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("Chroma");

View file

@ -21,7 +21,9 @@ test("InputListComponent", async ({ page }) => {
}
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("url");

View file

@ -22,7 +22,9 @@ test("IntComponent", async ({ page }) => {
await page.waitForTimeout(1000);
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("openai");

View file

@ -2,13 +2,6 @@ import { expect, test } from "@playwright/test";
import uaParser from "ua-parser-js";
test("LangflowShortcuts", async ({ page }) => {
await page.goto("/");
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
let control = "Control";
if (userAgentInfo.os.name.includes("Mac")) {
control = "Meta";
}
await page.waitForTimeout(1000);
@ -28,8 +21,18 @@ test("LangflowShortcuts", async ({ page }) => {
modalCount = await page.getByTestId("modal-title")?.count();
}
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
let control = "Control";
if (userAgentInfo.os.name.includes("Mac")) {
control = "Meta";
}
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("ollama");

View file

@ -21,7 +21,9 @@ test("NestedComponent", async ({ page }) => {
}
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("pinecone");

View file

@ -21,7 +21,9 @@ test("PromptTemplateComponent", async ({ page }) => {
}
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("prompt");

View file

@ -93,8 +93,9 @@ test.describe("save component tests", () => {
if (replaceButton) {
await page.getByTestId("replace-button").click();
}
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("group");

View file

@ -82,7 +82,9 @@ test("check if tweaks are updating when someothing on the flow changes", async (
await page.waitForTimeout(1000);
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 100000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("Chroma");