tests: Categorize Tests into CI and Scheduled Groups (#3391)
* categoring tests * ✨ (actionsMainPage-shard-1.spec.ts): Add end-to-end tests for selecting and deleting items, searching flows, and searching components on the main page to ensure proper functionality and user experience. * 📝 (frontend/tsconfig.json): update file paths in include section to match the correct directory structure for scheduled-end-to-end tests. * 🔧 (typescript_test.yml): update path in the command to change directory to run end-to-end tests in the frontend folder 📝 (typescript_test.yml): improve comments for better readability and understanding of the workflow logic * add yml configuration to choose folder to run CI * 🔧 (ci.yml): Fix formatting issues and add support for running tests in a specific folder 📝 (ci.yml): Update job dependencies to improve readability and maintainability of the workflow configuration * ♻️ (typescript_test.yml): refactor matrix values for shardIndex and shardTotal to reduce redundancy and improve readability * categoring tests * ✨ (actionsMainPage-shard-1.spec.ts): Add end-to-end tests for selecting and deleting items, searching flows, and searching components on the main page to ensure proper functionality and user experience. * 📝 (frontend/tsconfig.json): update file paths in include section to match the correct directory structure for scheduled-end-to-end tests. * 🔧 (typescript_test.yml): update path in the command to change directory to run end-to-end tests in the frontend folder 📝 (typescript_test.yml): improve comments for better readability and understanding of the workflow logic * add yml configuration to choose folder to run CI * 🔧 (ci.yml): Fix formatting issues and add support for running tests in a specific folder 📝 (ci.yml): Update job dependencies to improve readability and maintainability of the workflow configuration * ♻️ (typescript_test.yml): refactor matrix values for shardIndex and shardTotal to reduce redundancy and improve readability * 🐛 (fileUploadComponent.spec.ts): fix file path for file upload to correctly locate the test file in the assets folder * changing test_folder * ✨ (fileUploadComponent.spec.ts): update file path for file upload test to match new file location in the project structure * fix input on playwright command
This commit is contained in:
parent
0d60fbf3e7
commit
a5cdab68bb
40 changed files with 65 additions and 59 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("RetrievalQA - Tooltip", async ({ page }) => {
|
||||
test("user must see on handle hover a tooltip with possibility connections", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto("/");
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("LLMChain - Filter", async ({ page }) => {
|
||||
test("user must see on handle click the possibility connections - LLMChain", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto("/");
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("GlobalVariables", async ({ page }) => {
|
||||
test("user must be able to save or delete a global variable", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto("/");
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,139 @@
|
|||
import { test } from "@playwright/test";
|
||||
|
||||
test("user should be able to download a flow or a component", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto("/");
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
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.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(3000);
|
||||
|
||||
if (await page.getByTestId("replace-button").isVisible()) {
|
||||
await page.getByTestId("replace-button").click();
|
||||
}
|
||||
|
||||
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
|
||||
timeout: 100000,
|
||||
});
|
||||
|
||||
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.waitForTimeout(2000);
|
||||
|
||||
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.waitForTimeout(2000);
|
||||
|
||||
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.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(3000);
|
||||
|
||||
if (await page.getByTestId("replace-button").isVisible()) {
|
||||
await page.getByTestId("replace-button").click();
|
||||
}
|
||||
|
||||
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
|
||||
timeout: 100000,
|
||||
});
|
||||
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();
|
||||
});
|
||||
26
src/frontend/tests/scheduled-end-to-end/autoLogin.spec.ts
Normal file
26
src/frontend/tests/scheduled-end-to-end/autoLogin.spec.ts
Normal 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);
|
||||
});
|
||||
});
|
||||
113
src/frontend/tests/scheduled-end-to-end/chatInputOutput.spec.ts
Normal file
113
src/frontend/tests/scheduled-end-to-end/chatInputOutput.spec.ts
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("chat_io_teste", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
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.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("chat output");
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page
|
||||
.getByTestId("outputsChat Output")
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
||||
await page.mouse.up();
|
||||
await page.mouse.down();
|
||||
|
||||
await page.getByPlaceholder("Search").click();
|
||||
await page.getByPlaceholder("Search").fill("chat input");
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page
|
||||
.getByTestId("inputsChat Input")
|
||||
.dragTo(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.getByTitle("zoom out").click();
|
||||
await page.getByTitle("zoom out").click();
|
||||
await page.getByTitle("zoom out").click();
|
||||
await page.getByTitle("zoom out").click();
|
||||
await page.getByTitle("zoom out").click();
|
||||
|
||||
const elementsChatInput = await page
|
||||
.locator('[data-testid="handle-chatinput-shownode-message-right"]')
|
||||
.all();
|
||||
|
||||
let visibleElementHandle;
|
||||
|
||||
for (const element of elementsChatInput) {
|
||||
if (await element.isVisible()) {
|
||||
visibleElementHandle = element;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Click and hold on the first element
|
||||
await visibleElementHandle.hover();
|
||||
await page.mouse.down();
|
||||
|
||||
// Move to the second element
|
||||
|
||||
const elementsChatOutput = await page
|
||||
.getByTestId("handle-chatoutput-shownode-text-left")
|
||||
.all();
|
||||
|
||||
for (const element of elementsChatOutput) {
|
||||
if (await element.isVisible()) {
|
||||
visibleElementHandle = element;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
await visibleElementHandle.hover();
|
||||
|
||||
// Release the mouse
|
||||
await page.mouse.up();
|
||||
|
||||
await page.getByLabel("fit view").click();
|
||||
await page.getByText("Playground", { exact: true }).click();
|
||||
await page.waitForSelector('[data-testid="input-chat-playground"]', {
|
||||
timeout: 100000,
|
||||
});
|
||||
await page.getByTestId("input-chat-playground").click();
|
||||
await page.getByTestId("input-chat-playground").fill("teste");
|
||||
await page.getByRole("button").nth(1).click();
|
||||
const chat_output = page.getByTestId("chat-message-AI-teste");
|
||||
const chat_input = page.getByTestId("chat-message-User-teste");
|
||||
await expect(chat_output).toHaveText("teste");
|
||||
await expect(chat_input).toHaveText("teste");
|
||||
});
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
import * as dotenv from "dotenv";
|
||||
import { readFileSync } from "fs";
|
||||
import path from "path";
|
||||
|
||||
test("user must be able to see output inspection", async ({ page }) => {
|
||||
test.skip(
|
||||
!process?.env?.OPENAI_API_KEY,
|
||||
"OPENAI_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.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();
|
||||
|
||||
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
|
||||
|
||||
while (outdatedComponents > 0) {
|
||||
await page.getByTestId("icon-AlertTriangle").first().click();
|
||||
await page.waitForTimeout(1000);
|
||||
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
|
||||
}
|
||||
|
||||
await page
|
||||
.getByTestId("popover-anchor-input-api_key")
|
||||
.fill(process.env.OPENAI_API_KEY ?? "");
|
||||
|
||||
await page.getByTestId("dropdown_str_model_name").click();
|
||||
await page.getByTestId("gpt-4o-1-option").click();
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
await page.getByTestId("button_run_chat output").last().click();
|
||||
|
||||
await page.waitForSelector("text=built successfully", { timeout: 30000 });
|
||||
|
||||
await page.getByText("built successfully").last().click({
|
||||
timeout: 15000,
|
||||
});
|
||||
|
||||
await page.waitForSelector('[data-testid="icon-ScanEye"]', {
|
||||
timeout: 30000,
|
||||
});
|
||||
|
||||
await page.getByTestId("icon-ScanEye").nth(4).click();
|
||||
|
||||
await page.getByText("Sender", { exact: true }).isVisible();
|
||||
await page.getByText("Type", { exact: true }).isVisible();
|
||||
await page.getByText("User", { exact: true }).last().isVisible();
|
||||
});
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
import * as dotenv from "dotenv";
|
||||
import path from "path";
|
||||
|
||||
test("user must interact with chat with Input/Output", async ({ page }) => {
|
||||
test.skip(
|
||||
!process?.env?.OPENAI_API_KEY,
|
||||
"OPENAI_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.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();
|
||||
|
||||
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
|
||||
|
||||
while (outdatedComponents > 0) {
|
||||
await page.getByTestId("icon-AlertTriangle").first().click();
|
||||
await page.waitForTimeout(1000);
|
||||
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
|
||||
}
|
||||
|
||||
await page
|
||||
.getByTestId("popover-anchor-input-api_key")
|
||||
.fill(process.env.OPENAI_API_KEY ?? "");
|
||||
|
||||
await page.getByTestId("dropdown_str_model_name").click();
|
||||
await page.getByTestId("gpt-4o-1-option").click();
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
await page.getByText("Playground", { exact: true }).click();
|
||||
|
||||
await page.waitForSelector('[data-testid="input-chat-playground"]', {
|
||||
timeout: 100000,
|
||||
});
|
||||
|
||||
await page.getByTestId("input-chat-playground").fill("Hello, how are you?");
|
||||
|
||||
await page.waitForSelector('[data-testid="icon-LucideSend"]', {
|
||||
timeout: 100000,
|
||||
});
|
||||
|
||||
await page.getByTestId("icon-LucideSend").click();
|
||||
let valueUser = await page.getByTestId("sender_name_user").textContent();
|
||||
|
||||
await page.waitForSelector('[data-testid="sender_name_ai"]', {
|
||||
timeout: 100000,
|
||||
});
|
||||
|
||||
let valueAI = await page.getByTestId("sender_name_ai").textContent();
|
||||
|
||||
expect(valueUser).toBe("User");
|
||||
expect(valueAI).toBe("AI");
|
||||
|
||||
await page.keyboard.press("Escape");
|
||||
|
||||
await page
|
||||
.getByTestId("textarea_str_input_value")
|
||||
.nth(0)
|
||||
.fill(
|
||||
"testtesttesttesttesttestte;.;.,;,.;,.;.,;,..,;;;;;;;;;;;;;;;;;;;;;,;.;,.;,.,;.,;.;.,~~çççççççççççççççççççççççççççççççççççççççisdajfdasiopjfaodisjhvoicxjiovjcxizopjviopasjioasfhjaiohf23432432432423423sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestççççççççççççççççççççççççççççççççç,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,!",
|
||||
);
|
||||
await page.getByText("Playground", { exact: true }).last().click();
|
||||
|
||||
await page.waitForSelector('[data-testid="icon-LucideSend"]', {
|
||||
timeout: 100000,
|
||||
});
|
||||
|
||||
await page.getByTestId("icon-LucideSend").click();
|
||||
await page.getByText("Close", { exact: true }).click();
|
||||
await page.getByText("Chat Input", { exact: true }).click();
|
||||
await page.getByTestId("advanced-button-modal").click();
|
||||
await page.getByTestId("showsender_name").click();
|
||||
await page.getByText("Close").last().click();
|
||||
|
||||
await page.getByText("Chat Output", { exact: true }).click();
|
||||
await page.getByTestId("advanced-button-modal").click();
|
||||
await page.getByTestId("showsender_name").click();
|
||||
await page.getByText("Close").last().click();
|
||||
|
||||
await page
|
||||
.getByTestId("popover-anchor-input-sender_name")
|
||||
.nth(1)
|
||||
.fill("TestSenderNameUser");
|
||||
await page
|
||||
.getByTestId("popover-anchor-input-sender_name")
|
||||
.nth(0)
|
||||
.fill("TestSenderNameAI");
|
||||
|
||||
await page.getByText("Playground", { exact: true }).last().click();
|
||||
|
||||
await page.waitForSelector('[data-testid="icon-LucideSend"]', {
|
||||
timeout: 100000,
|
||||
});
|
||||
|
||||
await page.getByTestId("icon-LucideSend").click();
|
||||
|
||||
valueUser = await page
|
||||
.getByTestId("sender_name_testsendernameuser")
|
||||
.textContent();
|
||||
valueAI = await page
|
||||
.getByTestId("sender_name_testsendernameai")
|
||||
.textContent();
|
||||
|
||||
expect(valueUser).toBe("TestSenderNameUser");
|
||||
expect(valueAI).toBe("TestSenderNameAI");
|
||||
|
||||
expect(
|
||||
await page
|
||||
.getByText(
|
||||
"testtesttesttesttesttestte;.;.,;,.;,.;.,;,..,;;;;;;;;;;;;;;;;;;;;;,;.;,.;,.,;.,;.;.,~~çççççççççççççççççççççççççççççççççççççççisdajfdasiopjfaodisjhvoicxjiovjcxizopjviopasjioasfhjaiohf23432432432423423sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestççççççççççççççççççççççççççççççççç,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,!",
|
||||
{ exact: true },
|
||||
)
|
||||
.isVisible(),
|
||||
);
|
||||
});
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
import { test } from "@playwright/test";
|
||||
|
||||
test("CodeAreaModalComponent", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
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.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("python function");
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page
|
||||
.getByTestId("prototypesPython Function")
|
||||
.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.getByTestId("div-generic-node").click();
|
||||
|
||||
await page.getByTestId("code-button-modal").click();
|
||||
|
||||
const wCode =
|
||||
'def python_function(text: str) -> st: """This is a default python function that returns the input text""" return text';
|
||||
|
||||
const customComponentCode = `from typing import Callable
|
||||
from langflow.field_typing import Code
|
||||
from langflow.interface.custom.custom_component import CustomComponent
|
||||
from langflow.interface.custom.utils import get_function
|
||||
|
||||
class PythonFunctionComponent(CustomComponent):
|
||||
def python_function(text: str) -> str:
|
||||
"""This is a default python function that returns the input text"""
|
||||
return text`;
|
||||
|
||||
await page
|
||||
.locator("#CodeEditor div")
|
||||
.filter({ hasText: "PythonFunctionComponent" })
|
||||
.nth(1)
|
||||
.click();
|
||||
await page.locator("textarea").press("Control+a");
|
||||
await page.locator("textarea").fill(wCode);
|
||||
await page.locator('//*[@id="checkAndSaveBtn"]').click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page.locator("textarea").press("Control+a");
|
||||
await page.locator("textarea").fill(wCode);
|
||||
await page.locator("textarea").fill(customComponentCode);
|
||||
await page.locator('//*[@id="checkAndSaveBtn"]').click();
|
||||
await page.waitForTimeout(1000);
|
||||
});
|
||||
|
|
@ -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(5000);
|
||||
modalCount = await page.getByTestId("modal-title")?.count();
|
||||
}
|
||||
await page.getByRole("heading", { name: "Basic Prompting" }).click();
|
||||
await page.waitForTimeout(2000);
|
||||
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);
|
||||
});
|
||||
|
|
@ -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(2000);
|
||||
await page.getByText("Success! Your API Key has been saved.").isVisible();
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
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();
|
||||
});
|
||||
63
src/frontend/tests/scheduled-end-to-end/deleteFlows.spec.ts
Normal file
63
src/frontend/tests/scheduled-end-to-end/deleteFlows.spec.ts
Normal 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(2000);
|
||||
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();
|
||||
});
|
||||
59
src/frontend/tests/scheduled-end-to-end/dragAndDrop.spec.ts
Normal file
59
src/frontend/tests/scheduled-end-to-end/dragAndDrop.spec.ts
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
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(5000);
|
||||
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/end-to-end/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.dispatchEvent(
|
||||
'//*[@id="root"]/div/div[2]/div[2]/div[3]/div',
|
||||
"drop",
|
||||
{
|
||||
dataTransfer,
|
||||
},
|
||||
);
|
||||
|
||||
const genericNode = page.getByTestId("div-generic-node");
|
||||
const elementCount = await genericNode?.count();
|
||||
if (elementCount > 0) {
|
||||
expect(true).toBeTruthy();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,255 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("dropDownComponent", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
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.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("amazon");
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page
|
||||
.getByTestId("modelsAmazon Bedrock")
|
||||
.first()
|
||||
.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.getByTestId("title-Amazon Bedrock").click();
|
||||
|
||||
await page.getByTestId("dropdown_str_model_id").click();
|
||||
|
||||
await page
|
||||
.getByTestId("anthropic.claude-3-haiku-20240307-v1:0-10-option")
|
||||
.click();
|
||||
|
||||
let value = await page
|
||||
.getByTestId("anthropic.claude-3-haiku-20240307-v1:0-10-option")
|
||||
.first()
|
||||
.innerText();
|
||||
if (value !== "anthropic.claude-3-haiku-20240307-v1:0") {
|
||||
expect(false).toBeTruthy();
|
||||
}
|
||||
|
||||
await page.getByTestId("dropdown_str_model_id").click();
|
||||
await page.getByText("anthropic.claude-v2").last().click();
|
||||
|
||||
value = await page.getByTestId("dropdown_str_model_id").innerText();
|
||||
if (value !== "anthropic.claude-v2:1") {
|
||||
expect(false).toBeTruthy();
|
||||
}
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByTestId("more-options-modal").click();
|
||||
await page.getByTestId("edit-button-modal").click();
|
||||
|
||||
value = await page
|
||||
.getByTestId("value-dropdown-dropdown_str_edit_model_id")
|
||||
.innerText();
|
||||
if (value !== "anthropic.claude-v2:1") {
|
||||
expect(false).toBeTruthy();
|
||||
}
|
||||
|
||||
await page.locator('//*[@id="showregion_name"]').click();
|
||||
expect(
|
||||
await page.locator('//*[@id="showregion_name"]').isChecked(),
|
||||
).toBeFalsy();
|
||||
|
||||
await page.locator('//*[@id="showregion_name"]').click();
|
||||
expect(
|
||||
await page.locator('//*[@id="showregion_name"]').isChecked(),
|
||||
).toBeTruthy();
|
||||
|
||||
// showmodel_id
|
||||
await page.locator('//*[@id="showmodel_id"]').click();
|
||||
expect(await page.locator('//*[@id="showmodel_id"]').isChecked()).toBeFalsy();
|
||||
|
||||
// showmodel_id
|
||||
await page.locator('//*[@id="showmodel_id"]').click();
|
||||
expect(
|
||||
await page.locator('//*[@id="showmodel_id"]').isChecked(),
|
||||
).toBeTruthy();
|
||||
|
||||
await page.locator('//*[@id="showregion_name"]').click();
|
||||
expect(
|
||||
await page.locator('//*[@id="showregion_name"]').isChecked(),
|
||||
).toBeFalsy();
|
||||
|
||||
await page.locator('//*[@id="showregion_name"]').click();
|
||||
expect(
|
||||
await page.locator('//*[@id="showregion_name"]').isChecked(),
|
||||
).toBeTruthy();
|
||||
|
||||
// showmodel_id
|
||||
await page.locator('//*[@id="showmodel_id"]').click();
|
||||
expect(await page.locator('//*[@id="showmodel_id"]').isChecked()).toBeFalsy();
|
||||
|
||||
// showmodel_id
|
||||
await page.locator('//*[@id="showmodel_id"]').click();
|
||||
expect(
|
||||
await page.locator('//*[@id="showmodel_id"]').isChecked(),
|
||||
).toBeTruthy();
|
||||
|
||||
await page.getByTestId("value-dropdown-dropdown_str_edit_model_id").click();
|
||||
await page.getByText("cohere").last().click();
|
||||
|
||||
value = await page
|
||||
.getByTestId("value-dropdown-dropdown_str_edit_model_id")
|
||||
.innerText();
|
||||
if (value !== "cohere.embed-multilingual-v3") {
|
||||
expect(false).toBeTruthy();
|
||||
}
|
||||
|
||||
await page.getByText("Close").last().click();
|
||||
|
||||
value = await page
|
||||
.getByTestId("value-dropdown-dropdown_str_model_id")
|
||||
.innerText();
|
||||
if (value !== "cohere.embed-multilingual-v3") {
|
||||
expect(false).toBeTruthy();
|
||||
}
|
||||
await page.getByTestId("code-button-modal").click();
|
||||
await page
|
||||
.locator("#CodeEditor div")
|
||||
.filter({ hasText: "import ChatBedrock" })
|
||||
.nth(1)
|
||||
.click();
|
||||
await page.locator("textarea").press("Control+a");
|
||||
const emptyOptionsCode = `from langchain_community.chat_models.bedrock import BedrockChat
|
||||
|
||||
from langflow.base.constants import STREAM_INFO_TEXT
|
||||
from langflow.base.models.model import LCModelComponent
|
||||
from langflow.field_typing import BaseLanguageModel, Text
|
||||
from langflow.io import BoolInput, DictInput, DropdownInput, StrInput
|
||||
from langflow.io import MessageInput
|
||||
from langflow.io import Output
|
||||
|
||||
|
||||
class AmazonBedrockComponent(LCModelComponent):
|
||||
display_name: str = "Amazon Bedrock"
|
||||
description: str = "Generate text using Amazon Bedrock LLMs."
|
||||
icon = "Amazon"
|
||||
|
||||
inputs = [
|
||||
MessageInput(name="input_value", display_name="Input"),
|
||||
DropdownInput(
|
||||
name="model_id",
|
||||
display_name="Model Id",
|
||||
options=[
|
||||
"amazon.titan-text-express-v1",
|
||||
"amazon.titan-text-lite-v1",
|
||||
"amazon.titan-text-premier-v1:0",
|
||||
"amazon.titan-embed-text-v1",
|
||||
"amazon.titan-embed-text-v2:0",
|
||||
"amazon.titan-embed-image-v1",
|
||||
"amazon.titan-image-generator-v1",
|
||||
"anthropic.claude-v2",
|
||||
"anthropic.claude-v2:1",
|
||||
"anthropic.claude-3-sonnet-20240229-v1:0",
|
||||
"anthropic.claude-3-haiku-20240307-v1:0",
|
||||
"anthropic.claude-3-opus-20240229-v1:0",
|
||||
"anthropic.claude-instant-v1",
|
||||
"ai21.j2-mid-v1",
|
||||
"ai21.j2-ultra-v1",
|
||||
"cohere.command-text-v14",
|
||||
"cohere.command-light-text-v14",
|
||||
"cohere.command-r-v1:0",
|
||||
"cohere.command-r-plus-v1:0",
|
||||
"cohere.embed-english-v3",
|
||||
"cohere.embed-multilingual-v3",
|
||||
"meta.llama2-13b-chat-v1",
|
||||
"meta.llama2-70b-chat-v1",
|
||||
"meta.llama3-8b-instruct-v1:0",
|
||||
"meta.llama3-70b-instruct-v1:0",
|
||||
"mistral.mistral-7b-instruct-v0:2",
|
||||
"mistral.mixtral-8x7b-instruct-v0:1",
|
||||
"mistral.mistral-large-2402-v1:0",
|
||||
"mistral.mistral-small-2402-v1:0",
|
||||
"stability.stable-diffusion-xl-v0",
|
||||
"stability.stable-diffusion-xl-v1",
|
||||
],
|
||||
value="anthropic.claude-3-haiku-20240307-v1:0",
|
||||
),
|
||||
StrInput(name="credentials_profile_name", display_name="Credentials Profile Name"),
|
||||
StrInput(name="region_name", display_name="Region Name"),
|
||||
DictInput(name="model_kwargs", display_name="Model Kwargs", advanced=True),
|
||||
StrInput(name="endpoint_url", display_name="Endpoint URL"),
|
||||
BoolInput(name="cache", display_name="Cache"),
|
||||
StrInput(
|
||||
name="system_message",
|
||||
display_name="System Message",
|
||||
info="System message to pass to the model.",
|
||||
advanced=True,
|
||||
),
|
||||
BoolInput(name="stream", display_name="Stream", info=STREAM_INFO_TEXT, advanced=True),
|
||||
]
|
||||
outputs = [
|
||||
Output(display_name="Text", name="text_output", method="text_response"),
|
||||
Output(display_name="Language Model", name="model_output", method="build_model"),
|
||||
]
|
||||
|
||||
def text_response(self) -> Text:
|
||||
input_value = self.input_value
|
||||
stream = self.stream
|
||||
system_message = self.system_message
|
||||
output = self.build_model()
|
||||
result = self.get_chat_result(output, stream, input_value, system_message)
|
||||
self.status = result
|
||||
return result
|
||||
|
||||
def build_model(self) -> BaseLanguageModel:
|
||||
model_id = self.model_id
|
||||
credentials_profile_name = self.credentials_profile_name
|
||||
region_name = self.region_name
|
||||
model_kwargs = self.model_kwargs
|
||||
endpoint_url = self.endpoint_url
|
||||
cache = self.cache
|
||||
stream = self.stream
|
||||
try:
|
||||
output = BedrockChat(
|
||||
credentials_profile_name=credentials_profile_name,
|
||||
model_id=model_id,
|
||||
region_name=region_name,
|
||||
model_kwargs=model_kwargs,
|
||||
endpoint_url=endpoint_url,
|
||||
streaming=stream,
|
||||
cache=cache,
|
||||
)
|
||||
except Exception as e:
|
||||
raise ValueError("Could not connect to AmazonBedrock API.") from e
|
||||
return output
|
||||
`;
|
||||
await page.locator("textarea").fill(emptyOptionsCode);
|
||||
await page.getByRole("button", { name: "Check & Save" }).click();
|
||||
await page.getByText("No parameters are available for display.").isVisible();
|
||||
});
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
import path from "path";
|
||||
|
||||
test("should be able to upload a file", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
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.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("file");
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page
|
||||
.getByTestId("dataFile")
|
||||
.first()
|
||||
.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();
|
||||
const fileChooserPromise = page.waitForEvent("filechooser");
|
||||
await page.getByTestId("icon-FileSearch2").click();
|
||||
const fileChooser = await fileChooserPromise;
|
||||
await fileChooser.setFiles(
|
||||
path.join(__dirname, "../end-to-end/assets/test_file.txt"),
|
||||
);
|
||||
await page.getByText("test_file.txt").isVisible();
|
||||
|
||||
await page.getByPlaceholder("Search").click();
|
||||
await page.getByPlaceholder("Search").fill("text output");
|
||||
|
||||
await page
|
||||
.getByTestId("outputsText Output")
|
||||
.first()
|
||||
.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("parse data");
|
||||
await page
|
||||
.getByTestId("helpersParse Data")
|
||||
.first()
|
||||
.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();
|
||||
|
||||
let visibleElementHandle;
|
||||
|
||||
const elementsFile = await page
|
||||
.getByTestId("handle-file-shownode-data-right")
|
||||
.all();
|
||||
|
||||
for (const element of elementsFile) {
|
||||
if (await element.isVisible()) {
|
||||
visibleElementHandle = element;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Click and hold on the first element
|
||||
await visibleElementHandle.hover();
|
||||
await page.mouse.down();
|
||||
|
||||
// Move to the second element
|
||||
|
||||
const parseDataElement = await page
|
||||
.getByTestId("handle-parsedata-shownode-data-left")
|
||||
.all();
|
||||
|
||||
for (const element of parseDataElement) {
|
||||
if (await element.isVisible()) {
|
||||
visibleElementHandle = element;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
await visibleElementHandle.hover();
|
||||
|
||||
// Release the mouse
|
||||
await page.mouse.up();
|
||||
|
||||
// Click and hold on the first element
|
||||
|
||||
const parseDataOutputElement = await page
|
||||
.getByTestId("handle-parsedata-shownode-text-right")
|
||||
.all();
|
||||
|
||||
for (const element of parseDataOutputElement) {
|
||||
if (await element.isVisible()) {
|
||||
visibleElementHandle = element;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
await visibleElementHandle.hover();
|
||||
await page.mouse.down();
|
||||
|
||||
// Move to the second element
|
||||
const textOutputElement = await page
|
||||
.getByTestId("handle-textoutput-shownode-text-left")
|
||||
.all();
|
||||
|
||||
for (const element of textOutputElement) {
|
||||
if (await element.isVisible()) {
|
||||
visibleElementHandle = element;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
await visibleElementHandle.hover();
|
||||
|
||||
// Release the mouse
|
||||
await page.mouse.up();
|
||||
|
||||
await page.getByText("Playground", { exact: true }).click();
|
||||
|
||||
await page.waitForSelector("text=Run Flow", {
|
||||
timeout: 30000,
|
||||
});
|
||||
|
||||
await page.getByText("Run Flow", { exact: true }).click();
|
||||
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
const textOutput = await page.getByPlaceholder("Empty").first().inputValue();
|
||||
|
||||
expect(textOutput).toContain("this is a test file");
|
||||
});
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("user must see on handle click the possibility connections - RetrievalQA", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto("/");
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
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.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,
|
||||
});
|
||||
|
||||
await expect(page.getByTestId("disclosure-inputs")).toBeVisible();
|
||||
await expect(page.getByTestId("disclosure-outputs")).toBeVisible();
|
||||
await expect(page.getByTestId("disclosure-data")).toBeVisible();
|
||||
await expect(page.getByTestId("disclosure-models")).toBeVisible();
|
||||
await expect(page.getByTestId("disclosure-helpers")).toBeVisible();
|
||||
await expect(page.getByTestId("disclosure-vector stores")).toBeVisible();
|
||||
await expect(page.getByTestId("disclosure-embeddings")).toBeVisible();
|
||||
await expect(page.getByTestId("disclosure-agents")).toBeVisible();
|
||||
await expect(page.getByTestId("disclosure-chains")).toBeVisible();
|
||||
await expect(page.getByTestId("disclosure-memories")).toBeVisible();
|
||||
await expect(page.getByTestId("disclosure-prototypes")).toBeVisible();
|
||||
await expect(page.getByTestId("disclosure-retrievers")).toBeVisible();
|
||||
await expect(page.getByTestId("disclosure-text splitters")).toBeVisible();
|
||||
|
||||
await expect(page.getByTestId("inputsChat Input").first()).toBeVisible();
|
||||
await expect(page.getByTestId("outputsChat Output").first()).toBeVisible();
|
||||
await expect(page.getByTestId("dataAPI Request").first()).toBeVisible();
|
||||
await expect(page.getByTestId("modelsAmazon Bedrock").first()).toBeVisible();
|
||||
await expect(page.getByTestId("helpersChat Memory").first()).toBeVisible();
|
||||
await expect(page.getByTestId("vectorstoresAstra DB").first()).toBeVisible();
|
||||
await expect(
|
||||
page.getByTestId("embeddingsAmazon Bedrock Embeddings").first(),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByTestId("agentsTool Calling Agent").first(),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByTestId("chainsConversationChain").first(),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByTestId("memoriesAstra DB Chat Memory").first(),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByTestId("prototypesConditional Router").first(),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByTestId("retrieversSelf Query Retriever").first(),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByTestId("textsplittersCharacterTextSplitter").first(),
|
||||
).toBeVisible();
|
||||
|
||||
await page.getByPlaceholder("Search").click();
|
||||
|
||||
await expect(page.getByTestId("model_specsVertexAI")).not.toBeVisible();
|
||||
await expect(page.getByTestId("model_specsCTransformers")).not.toBeVisible();
|
||||
await expect(page.getByTestId("model_specsAmazon Bedrock")).not.toBeVisible();
|
||||
await expect(page.getByTestId("modelsAzure OpenAI")).not.toBeVisible();
|
||||
await expect(
|
||||
page.getByTestId("model_specsAzureChatOpenAI"),
|
||||
).not.toBeVisible();
|
||||
await expect(page.getByTestId("model_specsChatAnthropic")).not.toBeVisible();
|
||||
await expect(page.getByTestId("model_specsChatLiteLLM")).not.toBeVisible();
|
||||
await expect(page.getByTestId("model_specsChatOllama")).not.toBeVisible();
|
||||
await expect(page.getByTestId("model_specsChatOpenAI")).not.toBeVisible();
|
||||
await expect(page.getByTestId("model_specsChatVertexAI")).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();
|
||||
});
|
||||
137
src/frontend/tests/scheduled-end-to-end/floatComponent.spec.ts
Normal file
137
src/frontend/tests/scheduled-end-to-end/floatComponent.spec.ts
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("FloatComponent", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
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.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.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(2000);
|
||||
await page.locator('//*[@id="float-input"]').click();
|
||||
await page.locator('//*[@id="float-input"]').fill("");
|
||||
await page.waitForTimeout(2000);
|
||||
await page.locator('//*[@id="float-input"]').fill("3");
|
||||
|
||||
let value = await page.locator('//*[@id="float-input"]').inputValue();
|
||||
|
||||
if (value != "2") {
|
||||
expect(false).toBeTruthy();
|
||||
}
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
await page.locator('//*[@id="float-input"]').click();
|
||||
await page.locator('//*[@id="float-input"]').fill("");
|
||||
await page.waitForTimeout(2000);
|
||||
await page.locator('//*[@id="float-input"]').fill("-3");
|
||||
|
||||
value = await page.locator('//*[@id="float-input"]').inputValue();
|
||||
|
||||
if (value != "-2") {
|
||||
expect(false).toBeTruthy();
|
||||
}
|
||||
|
||||
await page.getByTestId("more-options-modal").click();
|
||||
await page.getByTestId("edit-button-modal").click();
|
||||
|
||||
await page.getByTestId("showmirostat_eta").click();
|
||||
expect(
|
||||
await page.locator('//*[@id="showmirostat_eta"]').isChecked(),
|
||||
).toBeTruthy();
|
||||
|
||||
await page.getByTestId("showmirostat_eta").click();
|
||||
expect(
|
||||
await page.locator('//*[@id="showmirostat_eta"]').isChecked(),
|
||||
).toBeFalsy();
|
||||
|
||||
await page.getByTestId("showmirostat_eta").click();
|
||||
expect(
|
||||
await page.locator('//*[@id="showmirostat_eta"]').isChecked(),
|
||||
).toBeTruthy();
|
||||
|
||||
await page.getByTestId("showmirostat_eta").click();
|
||||
expect(
|
||||
await page.locator('//*[@id="showmirostat_eta"]').isChecked(),
|
||||
).toBeFalsy();
|
||||
|
||||
await page.getByTestId("showmirostat_tau").click();
|
||||
expect(
|
||||
await page.locator('//*[@id="showmirostat_tau"]').isChecked(),
|
||||
).toBeTruthy();
|
||||
|
||||
await page.getByTestId("showmirostat_tau").click();
|
||||
expect(
|
||||
await page.locator('//*[@id="showmirostat_tau"]').isChecked(),
|
||||
).toBeFalsy();
|
||||
|
||||
await page.getByText("Close").last().click();
|
||||
|
||||
const plusButtonLocator = page.locator('//*[@id="float-input"]');
|
||||
const elementCount = await plusButtonLocator?.count();
|
||||
if (elementCount === 0) {
|
||||
expect(true).toBeTruthy();
|
||||
|
||||
await page.getByTestId("more-options-modal").click();
|
||||
await page.getByTestId("edit-button-modal").click();
|
||||
|
||||
// showtemperature
|
||||
await page.locator('//*[@id="showtemperature"]').click();
|
||||
expect(
|
||||
await page.locator('//*[@id="showtemperature"]').isChecked(),
|
||||
).toBeTruthy();
|
||||
|
||||
await page.getByText("Close").last().click();
|
||||
await page.locator('//*[@id="float-input"]').click();
|
||||
await page.locator('//*[@id="float-input"]').fill("3");
|
||||
|
||||
let value = await page.locator('//*[@id="float-input"]').inputValue();
|
||||
|
||||
if (value != "1") {
|
||||
expect(false).toBeTruthy();
|
||||
}
|
||||
|
||||
await page.locator('//*[@id="float-input"]').click();
|
||||
await page.locator('//*[@id="float-input"]').fill("-3");
|
||||
|
||||
value = await page.locator('//*[@id="float-input"]').inputValue();
|
||||
|
||||
if (value != "-1") {
|
||||
expect(false).toBeTruthy();
|
||||
}
|
||||
}
|
||||
});
|
||||
44
src/frontend/tests/scheduled-end-to-end/flowPage.spec.ts
Normal file
44
src/frontend/tests/scheduled-end-to-end/flowPage.spec.ts
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import { test } from "@playwright/test";
|
||||
|
||||
test.describe("Flow Page tests", () => {
|
||||
test("save", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
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.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();
|
||||
});
|
||||
});
|
||||
72
src/frontend/tests/scheduled-end-to-end/flowSettings.spec.ts
Normal file
72
src/frontend/tests/scheduled-end-to-end/flowSettings.spec.ts
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("flowSettings", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
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.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();
|
||||
});
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
import * as dotenv from "dotenv";
|
||||
import path from "path";
|
||||
|
||||
test("erase button should clear the chat messages", async ({ page }) => {
|
||||
test.skip(
|
||||
!process?.env?.OPENAI_API_KEY,
|
||||
"OPENAI_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.getByRole("heading", { name: "Basic Prompting" }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.getByTitle("fit view").click();
|
||||
await page.getByTitle("zoom out").click();
|
||||
await page.getByTitle("zoom out").click();
|
||||
await page.getByTitle("zoom out").click();
|
||||
|
||||
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
|
||||
|
||||
while (outdatedComponents > 0) {
|
||||
await page.getByTestId("icon-AlertTriangle").first().click();
|
||||
await page.waitForTimeout(1000);
|
||||
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
|
||||
}
|
||||
|
||||
await page
|
||||
.getByTestId("popover-anchor-input-api_key")
|
||||
.fill(process.env.OPENAI_API_KEY ?? "");
|
||||
|
||||
await page.getByTestId("dropdown_str_model_name").click();
|
||||
await page.getByTestId("gpt-4o-1-option").click();
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
await page.getByText("Playground", { exact: true }).click();
|
||||
|
||||
await page.waitForSelector('[data-testid="input-chat-playground"]', {
|
||||
timeout: 100000,
|
||||
});
|
||||
|
||||
await page.getByTestId("input-chat-playground").fill("Hello, how are you?");
|
||||
|
||||
await page.waitForSelector('[data-testid="icon-LucideSend"]', {
|
||||
timeout: 100000,
|
||||
});
|
||||
|
||||
await page.getByTestId("icon-LucideSend").click();
|
||||
let valueUser = await page.getByTestId("sender_name_user").textContent();
|
||||
|
||||
await page.waitForSelector('[data-testid="sender_name_ai"]', {
|
||||
timeout: 30000,
|
||||
});
|
||||
|
||||
let valueAI = await page.getByTestId("sender_name_ai").textContent();
|
||||
|
||||
expect(valueUser).toBe("User");
|
||||
expect(valueAI).toBe("AI");
|
||||
|
||||
await page.getByTestId("icon-Eraser").last().click();
|
||||
|
||||
await page.getByText("Hello, how are you?").isHidden();
|
||||
await page.getByText("AI", { exact: true }).last().isHidden();
|
||||
await page.getByText("User", { exact: true }).last().isHidden();
|
||||
await page.getByText("Start a conversation").isVisible();
|
||||
await page.getByText("Langflow Chat").isVisible();
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
await page.getByPlaceholder("Send a message...").fill("My name is John");
|
||||
|
||||
await page.waitForSelector('[data-testid="icon-LucideSend"]', {
|
||||
timeout: 100000,
|
||||
});
|
||||
|
||||
await page.getByTestId("icon-LucideSend").click();
|
||||
|
||||
await page.waitForSelector("text=AI", { timeout: 30000 });
|
||||
|
||||
await page.getByText("Hello, how are you?").isHidden();
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue