tests: new tests folders organization (#3716)

* new tests folders organizations

* 📝 (nightly_build.yml): update tests_folder path from "tests/scheduled" to "tests/core" to reflect the correct location of the tests folder

* renaming test folder

* changing e2e to integrations folder

* 📝 (frontend/tsconfig.json): update test file paths to reflect changes in folder structure for better organization and clarity

* change assets folder

* 📝 (frontend): update file paths to remove redundant 'core' directory in test assets

* 📝 (Document QA.spec.ts, Vector Store.spec.ts, fileUploadComponent.spec.ts): Update file paths to correctly reference test assets in integration and unit tests.

* github suggestions
This commit is contained in:
Cristhian Zanforlin Lousa 2024-09-09 14:45:30 -03:00 • committed by GitHub
commit 6061951cba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
87 changed files with 60 additions and 55 deletions

View file

@ -0,0 +1,177 @@
import { test } from "@playwright/test";
test("user should be able to download a flow or a component", async ({
page,
}) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByRole("heading", { name: "Basic Prompting" }).click();
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();
await page.getByTitle("zoom out").click();
await page.getByText("Chat Input", { exact: true }).click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("icon-SaveAll").first().click();
await page.waitForTimeout(1000);
if (await page.getByTestId("replace-button").isVisible()) {
await page.getByTestId("replace-button").click();
}
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
const exitButton = await page.getByText("Exit", { exact: true }).count();
if (exitButton > 0) {
await page.getByText("Exit", { exact: true }).click();
}
await page.getByTestId("icon-ChevronLeft").last().click();
await page.getByRole("checkbox").nth(1).click();
await page.getByTestId("icon-FileDown").last().click();
await page.waitForTimeout(1000);
await page.getByText("Items exported successfully").isVisible();
await page.getByText("Flows", { exact: true }).click();
await page.getByRole("checkbox").nth(1).click();
await page.getByTestId("icon-FileDown").last().click();
await page.waitForTimeout(1000);
await page.getByText("Items exported successfully").isVisible();
await page.getByText("Components", { exact: true }).click();
await page.getByRole("checkbox").nth(1).click();
await page.getByTestId("icon-FileDown").last().click();
await page.waitForTimeout(1000);
await page.getByText("Components exported successfully").isVisible();
});
test("user should be able to upload a flow or a component", async ({
page,
}) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
await page.getByTestId("upload-folder-button").last().click();
});
test("user should be able to duplicate a flow or a component", async ({
page,
}) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByRole("heading", { name: "Basic Prompting" }).click();
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();
await page.getByTitle("zoom out").click();
await page.getByText("Chat Input", { exact: true }).click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("icon-SaveAll").first().click();
await page.waitForTimeout(1000);
if (await page.getByTestId("replace-button").isVisible()) {
await page.getByTestId("replace-button").click();
}
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
const exitButton = await page.getByText("Exit", { exact: true }).count();
if (exitButton > 0) {
await page.getByText("Exit", { exact: true }).click();
}
const replaceButton = await page.getByTestId("replace-button").isVisible();
if (replaceButton) {
await page.getByTestId("replace-button").click();
}
await page.getByTestId("icon-ChevronLeft").last().click();
await page.getByRole("checkbox").nth(1).click();
await page.getByTestId("icon-Copy").last().click();
await page.waitForTimeout(1000);
await page.getByText("Items duplicated successfully").isVisible();
});

View file

@ -0,0 +1,178 @@
import { expect, test } from "@playwright/test";
test("user should be able to manually save a flow when the auto_save is off", async ({
page,
}) => {
await page.route("**/api/v1/config", (route) => {
route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({
auto_saving: false,
frontend_timeout: 0,
}),
headers: {
"content-type": "application/json",
...route.request().headers(),
},
});
});
await page.goto("/");
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 5000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 5000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 5000,
});
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 5000,
});
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("NVIDIA");
await page.waitForTimeout(1000);
await page
.getByTestId("modelsNVIDIA")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[title="fit view"]', {
timeout: 5000,
});
await page.getByTitle("fit view").click();
expect(await page.getByText("Last saved:").isVisible()).toBeTruthy();
expect(await page.getByTestId("save-flow-button").isEnabled()).toBeTruthy();
await page.waitForSelector("text=loading", {
state: "hidden",
timeout: 5000,
});
await page.getByTestId("icon-ChevronLeft").last().click();
expect(
await page
.getByText("Unsaved changes will be permanently lost.")
.isVisible(),
).toBeTruthy();
await page.getByText("Exit Anyway", { exact: true }).click();
await page.getByText("Untitled document").first().click();
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 5000,
});
expect(await page.getByText("NVIDIA").isVisible()).toBeFalsy();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("NVIDIA");
await page.waitForTimeout(1000);
await page
.getByTestId("modelsNVIDIA")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[title="fit view"]', {
timeout: 5000,
});
await page.getByTitle("fit view").click();
await page.getByTestId("icon-ChevronLeft").last().click();
await page.getByText("Save And Exit", { exact: true }).click();
await page.getByText("Untitled document").first().click();
await page.waitForSelector("text=loading", {
state: "hidden",
timeout: 5000,
});
await page.waitForTimeout(5000);
expect(await page.getByTestId("title-NVIDIA").isVisible()).toBeTruthy();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("NVIDIA");
await page.waitForTimeout(1000);
await page
.getByTestId("modelsNVIDIA")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[title="fit view"]', {
timeout: 5000,
});
await page.getByTitle("fit view").click();
await page.getByTestId("save-flow-button").click();
await page.getByTestId("icon-ChevronLeft").last().click();
const replaceButton = await page.getByTestId("replace-button").isVisible();
if (replaceButton) {
await page.getByTestId("replace-button").click();
}
const saveExitButton = await page
.getByText("Save And Exit", { exact: true })
.last()
.isVisible();
if (saveExitButton) {
await page.getByText("Save And Exit", { exact: true }).last().click();
}
await page.getByText("Untitled document").first().click();
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 5000,
});
await page.waitForTimeout(5000);
const nvidiaNumber = await page.getByTestId("title-NVIDIA").count();
expect(nvidiaNumber).toBe(2);
});

View file

@ -0,0 +1,26 @@
import { test } from "@playwright/test";
test.describe("Auto_login tests", () => {
test("auto_login sign in", async ({ page }) => {
await page.goto("/");
await page.getByText("New Project", { exact: true }).click();
});
test("auto_login block_admin", async ({ page }) => {
await page.goto("/");
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(5000);
await page.goto("/login");
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(5000);
await page.goto("/admin");
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(5000);
await page.goto("/admin/login");
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(5000);
});
});

View file

@ -0,0 +1,30 @@
import { expect, test } from "@playwright/test";
test("curl_api_generation", async ({ page, context }) => {
await page.goto("/");
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForTimeout(1000);
await page.getByText("API", { exact: true }).click();
await page.getByRole("tab", { name: "cURL" }).click();
await page.getByTestId("icon-Copy").last().click();
const handle = await page.evaluateHandle(() =>
navigator.clipboard.readText(),
);
const clipboardContent = await handle.jsonValue();
expect(clipboardContent.length).toBeGreaterThan(0);
});

View file

@ -0,0 +1,53 @@
import { test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("should delete a component", async ({ page }) => {
test.skip(
!process?.env?.STORE_API_KEY,
"STORE_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.waitForTimeout(1000);
await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);
await page.getByTestId("api-key-button-store").click();
await page
.getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? "");
await page.getByTestId("api-key-save-button-store").click();
await page.waitForTimeout(1000);
await page.getByText("Success! Your API Key has been saved.").isVisible();
await page.waitForTimeout(1000);
await page.getByText("Store").nth(0).click();
await page.getByTestId("install-Basic RAG").click();
await page.waitForTimeout(5000);
await page.getByText("My Collection").nth(0).click();
await page.getByText("Components").first().click();
await page.getByText("Basic RAG").first().isVisible();
await page.waitForSelector('[data-testid="checkbox-component"]', {
timeout: 100000,
});
await page.getByTestId("checkbox-component").first().click();
await page.getByTestId("icon-Trash2").click();
await page
.getByText("Are you sure you want to delete the selected component?")
.isVisible();
await page.getByText("Delete").nth(1).click();
await page.waitForTimeout(1000);
await page.getByText("Successfully").first().isVisible();
});

View file

@ -0,0 +1,63 @@
import { test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("should delete a flow", async ({ page }) => {
test.skip(
!process?.env?.STORE_API_KEY,
"STORE_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.waitForTimeout(1000);
await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);
await page.getByTestId("api-key-button-store").click();
await page
.getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? "");
await page.getByTestId("api-key-save-button-store").click();
await page.waitForTimeout(1000);
await page.getByText("Success! Your API Key has been saved.").isVisible();
await page.waitForSelector("text=Store", { timeout: 30000 });
await page.getByText("Store").nth(0).click();
await page.waitForSelector('[data-testid="install-Website Content QA"]', {
timeout: 100000,
});
await page.getByTestId("install-Website Content QA").click();
await page.getByText("Flow Installed Successfully.").nth(0).click();
await page.waitForSelector("text=My Collection", { timeout: 30000 });
await page.getByText("My Collection").nth(0).click();
await page.waitForSelector("text=Website Content QA", { timeout: 30000 });
await page.getByText("Website Content QA").first().isVisible();
await page.waitForSelector('[data-testid="checkbox-component"]', {
timeout: 100000,
});
await page.getByTestId("checkbox-component").first().click();
await page.getByTestId("icon-Trash2").click();
await page
.getByText("Are you sure you want to delete the selected component?")
.isVisible();
await page.getByText("Delete").nth(1).click();
await page.waitForTimeout(1000);
await page.getByText("Successfully").first().isVisible();
});

View file

@ -0,0 +1,67 @@
import { expect, test } from "@playwright/test";
import { readFileSync } from "fs";
test.describe("drag and drop test", () => {
/// <reference lib="dom"/>
test("drop collection", async ({ page }) => {
await page.goto("/");
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.locator("span").filter({ hasText: "Close" }).first().click();
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
// Read your file into a buffer.
const jsonContent = readFileSync("tests/assets/collection.json", "utf-8");
// Create the DataTransfer and File
const dataTransfer = await page.evaluateHandle((data) => {
const dt = new DataTransfer();
// Convert the buffer to a hex array
const file = new File([data], "flowtest.json", {
type: "application/json",
});
dt.items.add(file);
return dt;
}, jsonContent);
// Now dispatch
await page.getByTestId("cards-wrapper").dispatchEvent("drop", {
dataTransfer,
});
await page.waitForTimeout(3000);
const genericNode = page.getByTestId("div-generic-node");
const elementCount = await genericNode?.count();
if (elementCount > 0) {
expect(true).toBeTruthy();
}
expect(
await page.locator("text=Getting Started:").last().isVisible(),
).toBeTruthy();
expect(
await page.locator("text=Inquisitive Pike").last().isVisible(),
).toBeTruthy();
expect(
await page.locator("text=Dreamy Bassi").last().isVisible(),
).toBeTruthy();
expect(
await page.locator("text=Furious Faraday").last().isVisible(),
).toBeTruthy();
});
});

View file

@ -0,0 +1,172 @@
import { expect, test } from "@playwright/test";
test("user must see on handle click the possibility connections - RetrievalQA", async ({
page,
}) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForTimeout(1000);
await page.getByTestId(
"input-list-plus-btn-edit_metadata_indexing_include-2",
);
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 30000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("retrievalqa");
await page.waitForTimeout(1000);
await page
.getByTestId("chainsRetrieval QA")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.waitForTimeout(500);
let visibleElementHandle;
const outputElements = await page
.getByTestId("handle-retrievalqa-shownode-text-right")
.all();
for (const element of outputElements) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.click({
force: true,
});
const disclosureTestIds = [
"disclosure-inputs",
"disclosure-outputs",
"disclosure-data",
"disclosure-models",
"disclosure-helpers",
"disclosure-vector stores",
"disclosure-embeddings",
"disclosure-agents",
"disclosure-chains",
"disclosure-memories",
"disclosure-prototypes",
"disclosure-retrievers",
"disclosure-text splitters",
];
const elementTestIds = [
"inputsChat Input",
"outputsChat Output",
"dataAPI Request",
"modelsAmazon Bedrock",
"helpersChat Memory",
"vectorstoresAstra DB",
"embeddingsAmazon Bedrock Embeddings",
"agentsTool Calling Agent",
"chainsConversationChain",
"memoriesAstra DB Chat Memory",
"prototypesConditional Router",
"retrieversSelf Query Retriever",
"textsplittersCharacterTextSplitter",
];
await Promise.all(
disclosureTestIds.map((id) => expect(page.getByTestId(id)).toBeVisible()),
);
await Promise.all(
elementTestIds.map((id) =>
expect(page.getByTestId(id).first()).toBeVisible(),
),
);
await page.getByPlaceholder("Search").click();
const notVisibleModelSpecsTestIds = [
"model_specsVertexAI",
"model_specsCTransformers",
"model_specsAmazon Bedrock",
"modelsAzure OpenAI",
"model_specsAzureChatOpenAI",
"model_specsChatAnthropic",
"model_specsChatLiteLLM",
"model_specsChatOllama",
"model_specsChatOpenAI",
"model_specsChatVertexAI",
];
await Promise.all(
notVisibleModelSpecsTestIds.map((id) =>
expect(page.getByTestId(id)).not.toBeVisible(),
),
);
const chainInputElements1 = await page
.getByTestId("handle-retrievalqa-shownode-llm-left")
.all();
for (const element of chainInputElements1) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.blur();
await visibleElementHandle.click({
force: true,
});
await expect(page.getByTestId("disclosure-models")).toBeVisible();
const rqaChainInputElements0 = await page
.getByTestId("handle-retrievalqa-shownode-template-left")
.all();
for (const element of rqaChainInputElements0) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.click();
await expect(page.getByTestId("disclosure-helpers")).toBeVisible();
await expect(page.getByTestId("disclosure-agents")).toBeVisible();
await expect(page.getByTestId("disclosure-chains")).toBeVisible();
await expect(page.getByTestId("disclosure-prototypes")).toBeVisible();
});

View file

@ -0,0 +1,50 @@
import { test } from "@playwright/test";
test.describe("Flow Page tests", () => {
test("save", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 30000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("custom");
await page.waitForTimeout(1000);
await page
.locator('//*[@id="helpersCustom Component"]')
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
});
});

View file

@ -0,0 +1,78 @@
import { expect, test } from "@playwright/test";
test("flowSettings", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(1000);
await page.getByTestId("flow_name").click();
await page.getByText("Settings").first().click();
await page
.getByPlaceholder("Flow name")
.fill(
"Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test",
);
await page.getByText("Character limit reached").isVisible();
await page.getByPlaceholder("Flow name").click();
const randomName = Math.random().toString(36).substring(2);
await page.getByPlaceholder("Flow name").fill(randomName);
await page.getByPlaceholder("Flow name").click();
await page
.getByPlaceholder("Flow description")
.fill(
"Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test",
);
await page.getByTestId("save-flow-settings").click();
await page.getByText("Changes saved successfully").isVisible();
await page.getByTestId("flow_name").click();
await page.getByText("Settings").first().click();
const flowName = await page.getByPlaceholder("Flow name").inputValue();
const flowDescription = await page
.getByPlaceholder("Flow description")
.inputValue();
if (flowName != randomName) {
expect(false).toBeTruthy();
}
if (
flowDescription !=
"Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test"
) {
expect(false).toBeTruthy();
}
await page.getByText("Saved").first().isVisible();
await page.getByTestId("icon-CheckCircle2").first().isVisible();
});

View file

@ -0,0 +1,109 @@
import { expect, test } from "@playwright/test";
import uaParser from "ua-parser-js";
test("LangflowShortcuts", async ({ page }) => {
await page.goto("/");
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(3000);
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.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 30000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("ollama");
await page.waitForTimeout(1000);
await page
.getByTestId("modelsOllama")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.locator('//*[@id="react-flow-id"]/div/div[2]/button[3]').click();
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();
await page.getByTitle("zoom out").click();
await page.getByTestId("generic-node-title-arrangement").click();
await page.keyboard.press(`${control}+Shift+A`);
await page.getByText("Close").last().click();
await page.getByTestId("generic-node-title-arrangement").click();
await page.keyboard.press(`${control}+d`);
let numberOfNodes = await page.getByTestId("title-Ollama")?.count();
if (numberOfNodes != 2) {
expect(false).toBeTruthy();
}
const ollamaTitleElement = await page.getByTestId("title-Ollama").last();
await ollamaTitleElement.click();
await page.keyboard.press("Backspace");
numberOfNodes = await page.getByTestId("title-Ollama")?.count();
if (numberOfNodes != 1) {
expect(false).toBeTruthy();
}
await page.getByTestId("generic-node-title-arrangement").click();
await page.keyboard.press(`${control}+c`);
await page.getByTestId("title-Ollama").click();
await page.keyboard.press(`${control}+v`);
numberOfNodes = await page.getByTestId("title-Ollama")?.count();
if (numberOfNodes != 2) {
expect(false).toBeTruthy();
}
await ollamaTitleElement.click();
await page.keyboard.press("Backspace");
await page.getByTestId("title-Ollama").click();
await page.keyboard.press(`${control}+x`);
numberOfNodes = await page.getByTestId("title-Ollama")?.count();
if (numberOfNodes != 0) {
expect(false).toBeTruthy();
}
await page.keyboard.press(`${control}+v`);
numberOfNodes = await page.getByTestId("title-Ollama")?.count();
if (numberOfNodes != 1) {
expect(false).toBeTruthy();
}
});

View file

@ -0,0 +1,37 @@
import { expect, test } from "@playwright/test";
test("python_api_generation", async ({ page, context }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForTimeout(1000);
await page.getByText("API", { exact: true }).click();
await page.getByRole("tab", { name: "Python API" }).click();
await page.getByTestId("icon-Copy").click();
const handle = await page.evaluateHandle(() =>
navigator.clipboard.readText(),
);
const clipboardContent = await handle.jsonValue();
expect(clipboardContent.length).toBeGreaterThan(0);
});

View file

@ -0,0 +1,181 @@
import { ENABLE_MVPS } from "@/../../src/customization/feature-flags";
import { expect, test } from "@playwright/test";
import uaParser from "ua-parser-js";
test("user should be able to interact with sticky notes", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
let control = "Control";
if (userAgentInfo.os.name.includes("Mac")) {
control = "Meta";
}
const noteText = `
Artificial Intelligence (AI) has rapidly evolved from a speculative concept in science fiction to a transformative force reshaping industries and everyday life. The term AI encompasses a broad range of technologies, from simple algorithms designed to perform specific tasks to complex systems capable of learning and adapting independently. As AI continues to advance, its applications are becoming increasingly diverse, impacting everything from healthcare to finance, entertainment, and beyond.
At its core, AI is about creating systems that can perform tasks that would typically require human intelligence. This includes abilities such as visual perception, speech recognition, decision-making, and even language translation. The development of AI can be traced back to the mid-20th century, when pioneers like Alan Turing began exploring the idea of machines that could think. Turing's famous "Turing Test" proposed a benchmark for AI, where a machine would be considered intelligent if it could engage in a conversation with a human without being detected as a machine.
The early days of AI research were marked by optimism, with researchers believing that human-like intelligence in machines was just around the corner. However, progress was slower than expected, leading to periods known as "AI winters," where interest and funding in the field waned. Despite these setbacks, AI research persisted, and by the 21st century, significant breakthroughs began to emerge.
One of the key drivers of modern AI is the availability of vast amounts of data. The internet and the proliferation of digital devices have generated unprecedented quantities of data, which AI systems can analyze to identify patterns and make predictions. This data-driven approach is at the heart of machine learning, a subset of AI that focuses on teaching machines to learn from experience rather than relying on explicitly programmed instructions.
Machine learning has enabled remarkable advancements in AI, particularly in areas like image and speech recognition. For example, AI systems can now accurately identify objects in images, transcribe spoken words into text, and even understand natural language. These capabilities have led to the development of virtual assistants like Siri, Alexa, and Google Assistant, which can perform a wide range of tasks, from setting reminders to controlling smart home devices.
Another important development in AI is the rise of deep learning, a type of machine learning that uses artificial neural networks to model complex patterns in data. Deep learning has been instrumental in achieving breakthroughs in areas such as computer vision and natural language processing. For instance, deep learning algorithms power the facial recognition systems used in security applications and the language models behind advanced chatbots and translation services.
AI's impact is not limited to consumer applications; it is also transforming industries on a larger scale. In healthcare, AI is being used to analyze medical images, predict patient outcomes, and even discover new drugs. In finance, AI-driven algorithms are used for trading, fraud detection, and personalized financial advice. The automotive industry is leveraging AI to develop self-driving cars, which have the potential to reduce accidents and revolutionize transportation.
Despite its many benefits, AI also raises important ethical and societal questions. As AI systems become more capable, there are concerns about job displacement, privacy, and the potential for bias in decision-making. AI algorithms are only as good as the data they are trained on, and if that data is biased, the AI's decisions may be biased as well. This has led to calls for greater transparency and accountability in AI development, as well as discussions about the need for regulations to ensure that AI is used responsibly.
The future of AI is both exciting and uncertain. As the technology continues to advance, it will undoubtedly bring about profound changes in society. The challenge will be to harness AI's potential for good while addressing the ethical and societal issues that arise. Whether it's through smarter healthcare, more efficient transportation, or enhanced creativity, AI has the potential to reshape the world in ways we are only beginning to imagine. The journey of AI is far from over, and its impact will be felt for generations to come.
`;
const randomTitle = Math.random().toString(36).substring(7);
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 30000,
});
await page.getByTestId("add_note").click();
await page.waitForTimeout(1000);
const targetElement = await page.locator('//*[@id="react-flow-id"]');
await page.mouse.up();
await page.mouse.down();
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();
await page.getByTestId("note_node").click();
await page.getByTestId("title-Note").dblclick();
await page.waitForTimeout(1000);
await page.getByTestId("popover-anchor-input-title-Note").fill(randomTitle);
await page.getByTestId("note_icon").first().dblclick();
await page.locator(".generic-node-desc").last().dblclick();
await page.getByTestId("textarea").fill(noteText);
expect(await page.getByText("2500/2500")).toBeVisible();
await page.getByTestId("note_icon").first().dblclick();
const textMarkdown = await page.locator(".markdown").innerText();
const textLength = textMarkdown.length;
const noteTextLength = noteText.length;
expect(textLength).toBeLessThan(noteTextLength);
await page.getByTestId("note_node").click();
let element = await page.getByTestId("note_node");
let hasStyles = await element?.evaluate((el) => {
const style = window.getComputedStyle(el);
return style.backgroundColor === "rgb(224, 231, 255)";
});
expect(hasStyles).toBe(true);
await page.getByTestId("note_node").click();
await page.getByTestId("color_picker").click();
await page.getByTestId("color_picker_button_red").click();
await page.waitForTimeout(1000);
await page.getByTestId("note_node").click();
element = await page.getByTestId("note_node");
hasStyles = await element?.evaluate((el) => {
const style = window.getComputedStyle(el);
return style.backgroundColor === "rgb(254, 226, 226)";
});
expect(hasStyles).toBe(true);
await page.getByTestId("note_node").click();
await page.getByTestId("more-options-modal").click();
await page.getByText("Duplicate").click();
let titleNumber = await page.getByText(randomTitle).count();
expect(titleNumber).toBe(2);
await page.getByTestId("note_node").last().click();
await page.getByTestId("more-options-modal").click();
await page.getByText("Copy").click();
await page.waitForTimeout(1000);
await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
targetElement.focus();
targetElement.click();
await page.waitForTimeout(1000);
targetElement.click();
await page.waitForTimeout(1000);
targetElement.click();
await page.keyboard.press(`${control}+v`);
await page.waitForTimeout(1000);
titleNumber = await page.getByText(randomTitle).count();
expect(titleNumber).toBe(3);
await page.getByTestId("note_node").last().click();
await page.getByTestId("more-options-modal").click();
await page.getByText("Delete").last().click();
await page.waitForTimeout(1000);
await page.getByTestId("note_node").last().click();
await page.getByTestId("more-options-modal").click();
await page.getByText("Delete").last().click();
await page.waitForTimeout(1000);
titleNumber = await page.getByText(randomTitle).count();
expect(titleNumber).toBe(1);
});

View file

@ -0,0 +1,159 @@
import { expect, test } from "@playwright/test";
import uaParser from "ua-parser-js";
test("User must be able to stop building from inside Playground", async ({
page,
}) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 1000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("custom");
await page.waitForTimeout(1000);
await page
.locator('//*[@id="helpersCustom Component"]')
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("chat output");
await page.waitForTimeout(1000);
await page
.getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.getByTestId("div-generic-node").nth(0).click();
await page.getByTestId("code-button-modal").nth(0).click();
const waitTimeoutCode = `
# from langflow.field_typing import Data
from langflow.custom import Component
from langflow.io import MessageTextInput, Output
from langflow.schema import Data
from time import sleep
from langflow.schema.message import Message
class CustomComponent(Component):
display_name = "Custom Component"
description = "Use as a template to create your own component."
documentation: str = "http://docs.langflow.org/components/custom"
icon = "custom_components"
name = "CustomComponent"
inputs = [
MessageTextInput(name="input_value", display_name="Input Value", value="Hello, World!"),
]
outputs = [
Output(display_name="Output", name="output", method="build_output"),
]
def build_output(self) -> Message:
data = Data(value=self.input_value)
self.status = data
sleep(60)
return data`;
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
let control = "Control";
if (userAgentInfo.os.name.includes("Mac")) {
control = "Meta";
}
await page.locator(".ace_content").click();
await page.keyboard.press(`${control}+A`);
await page.locator("textarea").fill(waitTimeoutCode);
await page.getByText("Check & Save").last().click();
await page.waitForTimeout(1000);
await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
//connection 1
const elementCustomComponentOutput = await page
.getByTestId("handle-customcomponent-shownode-output-right")
.first();
await elementCustomComponentOutput.hover();
await page.mouse.down();
const elementChatOutput = await page
.getByTestId("handle-chatoutput-shownode-text-left")
.first();
await elementChatOutput.hover();
await page.mouse.up();
await page.waitForTimeout(1000);
await page.getByTestId("button_run_chat output").click();
await page.waitForTimeout(1000);
await page.getByText("Playground", { exact: true }).click();
await page.waitForTimeout(1000);
await page.waitForSelector('[data-testid="icon-Square"]', {
timeout: 30000,
});
const elements = await page.$$('[data-testid="icon-Square"]');
if (elements.length > 0) {
const lastElement = elements[elements.length - 1];
await lastElement.waitForElementState("visible");
}
expect(await page.getByTestId("icon-Square").last()).toBeVisible();
await page.getByTestId("icon-Square").last().click();
await page.waitForSelector("text=build stopped", { timeout: 30000 });
expect(await page.getByText("build stopped").isVisible()).toBeTruthy();
});

View file

@ -0,0 +1,19 @@
import { test } from "@playwright/test";
test("should exists Store", async ({ page }) => {
await page.goto("/");
await page.waitForTimeout(1000);
await page.getByTestId("button-store").isVisible();
await page.getByTestId("button-store").isEnabled();
});
test("should not have an API key", async ({ page }) => {
await page.goto("/");
await page.waitForTimeout(1000);
await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);
await page.getByText("API Key Error").isVisible();
});

View file

@ -0,0 +1,147 @@
import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("should like and add components and flows", async ({ page }) => {
test.skip(
!process?.env?.STORE_API_KEY,
"STORE_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.waitForTimeout(1000);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByText("Close", { exact: true }).click();
await page.waitForTimeout(1000);
await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);
await page.getByTestId("api-key-button-store").click();
await page
.getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? "");
await page.getByTestId("api-key-save-button-store").click();
await page.waitForTimeout(1000);
await page.getByText("Success! Your API Key has been saved.").isVisible();
await page.waitForTimeout(1000);
await page.getByTestId("button-store").click();
await page.waitForTimeout(5000);
const likedValue = await page
.getByTestId("likes-Website Content QA")
.innerText();
await page.getByTestId("like-Website Content QA").click();
await page.waitForTimeout(5000);
const likedValueAfter = await page
.getByTestId("likes-Website Content QA")
.innerText();
if (Number(likedValue) === Number(likedValueAfter)) {
expect(false).toBe(true);
}
const downloadValue = await page
.getByTestId("downloads-Website Content QA")
.innerText();
await page.getByTestId("install-Website Content QA").click();
await page.waitForTimeout(1000);
await page.getByText("Flow Installed Successfully").isVisible();
await page.waitForTimeout(5000);
const downloadValueAfter = await page
.getByTestId("downloads-Website Content QA")
.innerText();
if (Number(downloadValue) === Number(downloadValueAfter)) {
expect(false).toBe(true);
}
await page.getByTestId("install-Basic RAG").click();
await page.waitForTimeout(1000);
await page.getByText("Component Installed Successfully").isVisible();
await page.waitForTimeout(5000);
await page.getByText("My Collection").click();
await page.getByText("Website Content QA").first().isVisible();
await page.getByText("Components").first().click();
await page.getByText("Basic RAG").first().isVisible();
});
test("should find a searched Component on Store", async ({ page }) => {
test.skip(
!process?.env?.STORE_API_KEY,
"STORE_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.waitForTimeout(1000);
await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);
await page.getByTestId("api-key-button-store").click();
await page
.getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? "");
await page.getByTestId("api-key-save-button-store").click();
await page.waitForTimeout(1000);
await page.getByText("Success! Your API Key has been saved.").isVisible();
await page.waitForTimeout(1000);
await page.getByTestId("button-store").click();
await page.waitForSelector('[data-testid="search-store-input"]', {
timeout: 100000,
});
await page.getByTestId("search-store-input").fill("File Loader");
await page.getByTestId("search-store-button").click();
await page.getByText("File Loader").isVisible();
await page.getByTestId("search-store-input").fill("Basic RAG");
await page.getByTestId("search-store-button").click();
await page.getByText("Basic RAG").isVisible();
await page.getByTestId("search-store-input").fill("YouTube QA");
await page.getByTestId("search-store-button").click();
await page.getByText("YouTube QA").isVisible();
});

View file

@ -0,0 +1,109 @@
import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("should order the visualization", async ({ page }) => {
test.skip(
!process?.env?.STORE_API_KEY,
"STORE_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.waitForTimeout(1000);
await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);
await page.getByTestId("api-key-button-store").click();
await page
.getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? "");
await page.getByTestId("api-key-save-button-store").click();
await page.waitForTimeout(1000);
await page.getByText("Success! Your API Key has been saved.").isVisible();
await page.waitForTimeout(1000);
await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);
await page.getByText("Basic RAG").isVisible();
await page.getByTestId("select-order-store").click();
await page.waitForTimeout(1000);
await page.getByText("Alphabetical").click();
await page.getByText("Album Cover Builder").isVisible();
await page.getByTestId("select-order-store").click();
await page.getByText("Popular").click();
await page.getByText("Basic RAG").isVisible();
});
test("should filter by type", async ({ page }) => {
test.skip(
!process?.env?.STORE_API_KEY,
"STORE_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.waitForTimeout(1000);
await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);
await page.getByTestId("api-key-button-store").click();
await page
.getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? "");
await page.getByTestId("api-key-save-button-store").click();
await page.waitForTimeout(1000);
await page.getByText("Success! Your API Key has been saved.").isVisible();
await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);
await page.getByText("Website Content QA").isVisible();
await page.getByTestId("flows-button-store").click();
await page.waitForTimeout(8000);
let iconGroup = await page.getByTestId("icon-Group")?.count();
expect(iconGroup).not.toBe(0);
await page.getByText("icon-ToyBrick").last().isHidden();
await page.getByTestId("components-button-store").click();
await page.waitForTimeout(8000);
await page.getByTestId("icon-Group").last().isHidden();
let toyBrick = await page.getByTestId("icon-ToyBrick")?.count();
expect(toyBrick).not.toBe(0);
await page.getByTestId("all-button-store").click();
await page.waitForTimeout(10000);
let iconGroupAllCount = await page.getByTestId("icon-Group")?.count();
await page.waitForTimeout(5000);
let toyBrickAllCount = await page.getByTestId("icon-ToyBrick")?.count();
await page.waitForTimeout(5000);
if (iconGroupAllCount === 0 || toyBrickAllCount === 0) {
expect(false).toBe(true);
}
});

View file

@ -0,0 +1,57 @@
import { expect, test } from "@playwright/test";
test("user should be able to see multiple edges and interact with them", async ({
page,
}) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForTimeout(1000);
await page.getByText("Vector Store RAG", { exact: true }).last().click();
await page.waitForTimeout(3000);
await page.getByText("Retriever", { exact: true }).first().isVisible();
await page.getByText("Search Results", { exact: true }).first().isVisible();
const focusElementsOnBoard = async ({ page }) => {
await page.waitForSelector('[title="fit view"]', { timeout: 30000 });
const focusElements = await page.getByTitle("fit view");
await focusElements.click();
};
await focusElementsOnBoard({ page });
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.getByTestId("input-inspection-retriever").first().click();
await page.getByText("Retriever", { exact: true }).first().isHidden();
await page.getByTestId("icon-ChevronDown").last().isVisible();
await page.getByTestId("icon-ChevronDown").last().click();
await page.getByText("Retriever", { exact: true }).first().isVisible();
await page.getByText("Search Results", { exact: true }).first().isVisible();
await page.getByTestId("icon-EyeOff").nth(0).isVisible();
});

View file

@ -0,0 +1,190 @@
import { test } from "@playwright/test";
test("should see general profile gradient", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
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("Profile Gradient").isVisible();
});
test("should interact with global variables", async ({ page }) => {
const randomName = Math.random().toString(36).substring(2);
const randomName2 = Math.random().toString(36).substring(2);
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();
await page.getByText("Global Variables").nth(2);
await page.getByText("Global Variables", { exact: true }).nth(1).isVisible();
await page.getByText("Add New").click();
await page
.getByPlaceholder("Insert a name for the variable...")
.fill(randomName);
await page.getByTestId("popover-anchor-type-global-variables").click();
await page.getByPlaceholder("Search options...").fill("Generic");
await page.waitForTimeout(1000);
await page.getByText("Generic", { exact: true }).last().isVisible();
await page.getByText("Generic", { exact: true }).last().click();
await page.getByTestId("popover-anchor-type-global-variables").click();
await page.waitForTimeout(1000);
await page.getByPlaceholder("Search options...").fill("Generic");
await page.getByText("Generic", { exact: true }).last().isVisible();
await page.getByText("Generic", { exact: true }).last().click();
await page
.getByPlaceholder("Insert a value for the variable...")
.fill("testtesttesttesttesttesttesttest");
await page.getByTestId("popover-anchor-apply-to-fields").click();
await page.waitForTimeout(1000);
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...").fill("ollama");
await page.waitForSelector("text=ollama", { timeout: 30000 });
await page.getByText("ollama").first().click();
await page.keyboard.press("Escape");
await page.getByText("Save Variable", { exact: true }).click();
await page.getByText(randomName).last().isVisible();
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...")
.fill(randomName2);
await page.getByText("Update Variable", { exact: true }).last().click();
await page.getByText(randomName2).last().isVisible();
await page.getByText(randomName2).last().click();
await page.waitForTimeout(500);
await page
.getByPlaceholder("Insert a name for the variable...")
.fill(randomName3);
await page.getByText("Update Variable", { exact: true }).last().click();
await page.getByText(randomName3).last().isVisible();
const focusElementsOnBoard = async ({ page }) => {
await page.waitForSelector(
'[aria-label="Press Space to toggle all rows selection (unchecked)"]',
{ timeout: 30000 },
);
const focusElements = await page
.getByLabel("Press Space to toggle all rows selection (unchecked)")
.first();
await focusElements.click();
};
await focusElementsOnBoard({ page });
await page.getByTestId("icon-Trash2").click();
await page.getByText("No data available").isVisible();
});
test("should see shortcuts", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
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();
await page.getByText("Shortcuts", { exact: true }).nth(1).isVisible();
await page
.getByText("Advanced Settings Component", { exact: true })
.isVisible();
await page.getByText("Minimize Component", { exact: true }).isVisible();
await page.getByText("Code Component", { exact: true }).isVisible();
await page.getByText("Copy Component", { exact: true }).isVisible();
await page.getByText("Duplicate Component", { exact: true }).isVisible();
await page.getByText("Share Component", { exact: true }).isVisible();
await page.getByText("Docs Component", { exact: true }).isVisible();
await page.getByText("Save Component", { exact: true }).isVisible();
await page.getByText("Delete Component", { exact: true }).isVisible();
await page.getByText("Open Playground", { exact: true }).isVisible();
await page.getByText("Undo", { exact: true }).isVisible();
await page.mouse.wheel(0, 10000);
await page.getByText("Redo", { exact: true }).last().isVisible();
await page.getByText("Reset Columns").last().isVisible();
});
test("should interact with API Keys", 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();
await page.getByText("Langflow API", { exact: true }).nth(1).isVisible();
await page.getByText("Add New").click();
await page.getByPlaceholder("Insert a name for your API Key").isVisible();
const randomName = Math.random().toString(36).substring(2);
await page
.getByPlaceholder("Insert a name for your API Key")
.fill(randomName);
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 page.getByText(randomName).isVisible();
});