tests: organize playwright tests by feature suites and optimize CI runtime (#4687)

* starting realocating components FE

* tagging tests

* 📝 (.github/workflows/typescript_test.yml): remove unnecessary comment before the Playwright test execution step to improve readability and maintainability

* 📝 (.github/changes-filter.yaml): Update paths in changes-filter.yaml to categorize different sections of the project for testing purposes
🔧 (.github/workflows/typescript_test.yml): Refactor workflow to use paths-filter action for determining test suites based on changes in different project sections

* ✨ (changes-filter.yaml): reorganize and update paths for test categories, starter projects, components, workspace, api, and database
✨ (components): add new components for GradientWrapper, pageLayout, and paginatorComponent
🔧 (MainPage): update import path for PageLayout component
🔧 (SettingsPage): update import path for PageLayout component
🔧 (StorePage): update import path for PageLayout component

* ✨ (frontend): Update import paths for components to use common directory instead of core directory for better organization and consistency
🔧 (frontend): Remove duplicate import of PaginatorComponent in various files and import it from the common directory to reduce redundancy and improve maintainability

* 🔧 (changes-filter.yaml): remove unnecessary release section from changes-filter.yaml
🔧 (typescript_test.yml): refactor workflow to support input suites and release flag for test runs

* 📝 (changes-filter.yaml): remove unnecessary entries from components section and add missing entries to workspace section for better organization and filtering of changes
🔧 (changes-filter.yaml): update changes-filter.yaml to include missing utils files in the frontend/src/utils directory
🔧 (typescript_test.yml): remove redundant code block that sets SUITES variable to default values as it is no longer needed due to changes in the changes-filter.yaml file

* ✨ (actionsMainPage-shard-1.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity
📝 (store-shard-2.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity
📝 (generalBugs-shard-4.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity
📝 (generalBugs-shard-9.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity
📝 (deleteComponents.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity
📝 (deleteFlows.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity

✨ (dragAndDrop.spec.ts): Refactor drag and drop test to improve readability and maintainability
✨ (flowPage.spec.ts): Refactor save test in Flow Page to improve readability and maintainability
✨ (store-shard-0.spec.ts): Refactor Store test to improve readability and maintainability
✨ (store-shard-1.spec.ts): Refactor Store test to improve readability and maintainability

✨ (store-shard-3.spec.ts): Remove unnecessary tags from test descriptions to improve clarity and consistency
✨ (userSettings.spec.ts): Remove unnecessary tags from test descriptions to improve clarity and consistency
✨ (general-bugs-shard-3909.spec.ts): Remove unnecessary tags from test descriptions to improve clarity and consistency

📝 (frontend): Update test tags in regression tests to remove unnecessary tags for better organization and clarity
📝 (frontend): Update test file paths in tsconfig.json to match the new file structure for consistency and maintainability

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes

* Update paths-filter action to v3 and adjust filter configuration file

* Add logging to matrix setup in TypeScript test workflow

* Refactor decisionFlow.spec.ts to improve test setup and execution flow

* Refactor import paths for genericIconComponent and shadTooltipComponent in PlaygroundButton component

* feat: add release input to CI workflows for enhanced deployment control

* Fix: Correct 'release' input type in CI workflow configuration

* [autofix.ci] apply automated fixes

* Refactor Blog Writer test: streamline setup and interaction steps

* Refactor test cases to improve modal handling and streamline API key input logic

* Add test grep pattern to GitHub Actions workflow for targeted test execution

- Introduced `test_grep` output in the `determine-test-suite` job to generate a grep pattern based on changed files or input suites.
- Updated Playwright test execution to use the generated grep pattern, allowing for more targeted test runs.
- Enhanced the `Set Matrix` step to include tag processing for test filtering.

* Enhance tag filtering in test workflow with regex lookaheads

* Fix syntax for default suite input in GitHub Actions workflow

* Update GitHub Actions to handle empty suite input for release builds

* Escape regex lookaheads and quotes for GitHub Actions in test workflow

* Update regex pattern and quote escaping in TypeScript test workflow

* Use single quotes for echo command in GitHub Actions script

* Refactor tag handling in GitHub Actions to use OR logic for grep patterns

* 🔧 (FlowPage/index.tsx): Remove unnecessary empty line to improve code readability and consistency

* 📝 (FlowPage/index.tsx): add missing line break for better code readability

* Refactor import path and reorder CSS classes for consistency in UpdateAllComponents component

* [autofix.ci] apply automated fixes

* Update import path for PaginatorComponent in AdminPage index.tsx

* ✨ (logs.spec.ts): introduce a new variable 'modalCount' to keep track of the number of modals opened in the test suite

* 📝 (filterSidebar.spec.ts): remove unnecessary test steps related to filter removal and sidebar interactions to simplify and improve test focus on main functionality

* ✅ (logs.spec.ts): add tests to ensure proper interaction with logs feature in the frontend application

* ✅ (similarity.spec.ts): add a test tag for release and components to categorize the test case
💡 (similarity.spec.ts): add a comment to explain the purpose of the test case and the condition for skipping the test

* ✅ (decisionFlow.spec.ts): add missing newline before async function declaration to improve code readability

* ✅ (textInputOutput.spec.ts): skip the test for TextInputOutputComponent to exclude it from the test suite temporarily

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Cristhian Zanforlin Lousa 2024-11-25 17:55:03 -03:00 • committed by GitHub
commit 989cefd0ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
331 changed files with 10386 additions and 9694 deletions

View file

@ -1,62 +1,66 @@
import { test } from "@playwright/test";
test("select and delete a flow", 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 Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
test(
"select and delete a flow",
{ tag: ["@release", "@api"] },
async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByTestId("icon-ChevronLeft").first().click();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
await page.waitForSelector('[data-testid="home-dropdown-menu"]', {
timeout: 5000,
});
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.getByTestId("home-dropdown-menu").first().click();
await page.waitForSelector('[data-testid="icon-Trash2"]', {
timeout: 1000,
});
// click on the delete button
await page.getByText("Delete").last().click();
await page.getByText("Note: This action is irreversible.").isVisible({
timeout: 1000,
});
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
//confirm the deletion in the modal
await page.getByText("Delete").last().click();
await page.getByTestId("icon-ChevronLeft").first().click();
await page.getByText("Selected items deleted successfully").isVisible();
});
await page.waitForSelector('[data-testid="home-dropdown-menu"]', {
timeout: 5000,
});
test("search flows", async ({ page }) => {
await page.getByTestId("home-dropdown-menu").first().click();
await page.waitForSelector('[data-testid="icon-Trash2"]', {
timeout: 1000,
});
// click on the delete button
await page.getByText("Delete").last().click();
await page.getByText("Note: This action is irreversible.").isVisible({
timeout: 1000,
});
//confirm the deletion in the modal
await page.getByText("Delete").last().click();
await page.getByText("Selected items deleted successfully").isVisible();
},
);
test("search flows", { tag: ["@release"] }, async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
@ -117,7 +121,7 @@ test("search flows", async ({ page }) => {
await page.getByText("Basic Prompting", { exact: true }).isHidden();
});
test("search components", async ({ page }) => {
test("search components", { tag: ["@release"] }, async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,

View file

@ -1,282 +1,286 @@
import { expect, test } from "@playwright/test";
test("when auto_login is false, admin can CRUD user's and should see just your own flows", async ({
page,
}) => {
await page.route("**/api/v1/auto_login", (route) => {
route.fulfill({
status: 500,
contentType: "application/json",
body: JSON.stringify({
detail: { auto_login: false },
}),
test(
"when auto_login is false, admin can CRUD user's and should see just your own flows",
{ tag: ["@release", "@api", "@database"] },
async ({ page }) => {
await page.route("**/api/v1/auto_login", (route) => {
route.fulfill({
status: 500,
contentType: "application/json",
body: JSON.stringify({
detail: { auto_login: false },
}),
});
});
});
const randomName = Math.random().toString(36).substring(5);
const randomPassword = Math.random().toString(36).substring(5);
const secondRandomName = Math.random().toString(36).substring(5);
const randomFlowName = Math.random().toString(36).substring(5);
const secondRandomFlowName = Math.random().toString(36).substring(5);
const randomName = Math.random().toString(36).substring(5);
const randomPassword = Math.random().toString(36).substring(5);
const secondRandomName = Math.random().toString(36).substring(5);
const randomFlowName = Math.random().toString(36).substring(5);
const secondRandomFlowName = Math.random().toString(36).substring(5);
await page.goto("/");
await page.goto("/");
await page.waitForSelector("text=sign in to langflow", { timeout: 30000 });
await page.waitForSelector("text=sign in to langflow", { timeout: 30000 });
await page.getByPlaceholder("Username").fill("langflow");
await page.getByPlaceholder("Password").fill("langflow");
await page.getByPlaceholder("Username").fill("langflow");
await page.getByPlaceholder("Password").fill("langflow");
await page.getByRole("button", { name: "Sign In" }).click();
await page.getByRole("button", { name: "Sign In" }).click();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByTestId("user-profile-settings").click();
await page.getByTestId("user-profile-settings").click();
await page.getByText("Admin Page", { exact: true }).click();
await page.getByText("Admin Page", { exact: true }).click();
//CRUD an user
await page.getByText("New User", { exact: true }).click();
//CRUD an user
await page.getByText("New User", { exact: true }).click();
await page.getByPlaceholder("Username").last().fill(randomName);
await page.locator('input[name="password"]').fill(randomPassword);
await page.locator('input[name="confirmpassword"]').fill(randomPassword);
await page.getByPlaceholder("Username").last().fill(randomName);
await page.locator('input[name="password"]').fill(randomPassword);
await page.locator('input[name="confirmpassword"]').fill(randomPassword);
await page.waitForSelector("#is_active", {
timeout: 1500,
});
await page.waitForSelector("#is_active", {
timeout: 1500,
});
await page.locator("#is_active").click();
await page.locator("#is_active").click();
await page.getByText("Save", { exact: true }).click();
await page.getByText("Save", { exact: true }).click();
await page.waitForSelector("text=new user added", { timeout: 30000 });
await page.waitForSelector("text=new user added", { timeout: 30000 });
await expect(page.getByText(randomName, { exact: true })).toBeVisible({
timeout: 2000,
});
await expect(page.getByText(randomName, { exact: true })).toBeVisible({
timeout: 2000,
});
await page.getByTestId("icon-Trash2").last().click();
await page.getByText("Delete", { exact: true }).last().click();
await page.getByTestId("icon-Trash2").last().click();
await page.getByText("Delete", { exact: true }).last().click();
await page.waitForSelector("text=user deleted", { timeout: 30000 });
await page.waitForSelector("text=user deleted", { timeout: 30000 });
await expect(page.getByText(randomName, { exact: true })).toBeVisible({
timeout: 2000,
visible: false,
});
await expect(page.getByText(randomName, { exact: true })).toBeVisible({
timeout: 2000,
visible: false,
});
await page.getByText("New User", { exact: true }).click();
await page.getByText("New User", { exact: true }).click();
await page.getByPlaceholder("Username").last().fill(randomName);
await page.locator('input[name="password"]').fill(randomPassword);
await page.locator('input[name="confirmpassword"]').fill(randomPassword);
await page.getByPlaceholder("Username").last().fill(randomName);
await page.locator('input[name="password"]').fill(randomPassword);
await page.locator('input[name="confirmpassword"]').fill(randomPassword);
await page.waitForSelector("#is_active", {
timeout: 1500,
});
await page.waitForSelector("#is_active", {
timeout: 1500,
});
await page.locator("#is_active").click();
await page.locator("#is_active").click();
await page.getByText("Save", { exact: true }).click();
await page.getByText("Save", { exact: true }).click();
await page.waitForSelector("text=new user added", { timeout: 30000 });
await page.waitForSelector("text=new user added", { timeout: 30000 });
await page.getByPlaceholder("Username").last().fill(randomName);
await page.getByPlaceholder("Username").last().fill(randomName);
await page.getByTestId("icon-Pencil").last().click();
await page.getByTestId("icon-Pencil").last().click();
await page.getByPlaceholder("Username").last().fill(secondRandomName);
await page.getByPlaceholder("Username").last().fill(secondRandomName);
await page.getByText("Save", { exact: true }).click();
await page.getByText("Save", { exact: true }).click();
await page.waitForSelector("text=user edited", { timeout: 30000 });
await page.waitForSelector("text=user edited", { timeout: 30000 });
await expect(page.getByText(secondRandomName, { exact: true })).toBeVisible({
timeout: 2000,
});
await expect(page.getByText(secondRandomName, { exact: true })).toBeVisible(
{
timeout: 2000,
},
);
//user must see just your own flows
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
//user must see just your own flows
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
await page.getByTestId("icon-ChevronLeft").first().click();
await page.getByTestId("icon-ChevronLeft").first().click();
await page.waitForSelector('[id="new-project-btn"]', {
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();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 30000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("flow-configuration-button").click();
await page.getByText("Flow Settings", { exact: true }).last().click();
await page.getByPlaceholder("Flow Name").fill(randomFlowName);
await page.getByText("Save", { exact: true }).click();
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
state: "visible",
});
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 1500,
});
await page.getByTestId("icon-ChevronLeft").first().click();
await page.waitForSelector('[data-testid="search-store-input"]:enabled', {
timeout: 30000,
state: "visible",
});
await expect(page.getByText(randomFlowName, { exact: true })).toBeVisible({
timeout: 2000,
});
await page.waitForSelector("[data-testid='user-profile-settings']", {
timeout: 1500,
});
await page.getByTestId("user-profile-settings").click();
await page.getByText("Logout", { exact: true }).click();
await page.waitForSelector("text=sign in to langflow", { timeout: 30000 });
await page.getByPlaceholder("Username").fill(secondRandomName);
await page.getByPlaceholder("Password").fill(randomPassword);
await page.waitForSelector("text=Sign in", {
timeout: 1500,
});
await page.getByRole("button", { name: "Sign In" }).click();
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
expect(
(
await page.waitForSelector(
"text=Begin with a template, or start from scratch.",
{
timeout: 30000,
},
)
).isVisible(),
);
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 30000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("flow-configuration-button").click();
await page.getByText("Flow Settings", { exact: true }).last().click();
await page.getByPlaceholder("Flow Name").fill(randomFlowName);
await page.getByText("Save", { exact: true }).click();
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
state: "visible",
});
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 1500,
});
await page.getByTestId("icon-ChevronLeft").first().click();
await page.waitForSelector('[data-testid="search-store-input"]:enabled', {
timeout: 30000,
state: "visible",
});
await expect(page.getByText(randomFlowName, { exact: true })).toBeVisible({
timeout: 2000,
});
await page.waitForSelector("[data-testid='user-profile-settings']", {
timeout: 1500,
});
await page.getByTestId("user-profile-settings").click();
await page.getByText("Logout", { exact: true }).click();
await page.waitForSelector("text=sign in to langflow", { timeout: 30000 });
await page.getByPlaceholder("Username").fill(secondRandomName);
await page.getByPlaceholder("Password").fill(randomPassword);
await page.waitForSelector("text=Sign in", {
timeout: 1500,
});
await page.getByRole("button", { name: "Sign In" }).click();
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
expect(
(
await page.waitForSelector(
"text=Begin with a template, or start from scratch.",
{
timeout: 30000,
},
)
).isVisible(),
);
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByText("New Flow", { exact: true }).click();
await page.getByText("New Flow", { exact: true }).click();
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("flow-configuration-button").click();
await page.getByText("Flow Settings", { exact: true }).last().click();
await page.getByTestId("flow-configuration-button").click();
await page.getByText("Flow Settings", { exact: true }).last().click();
await page.getByPlaceholder("Flow Name").fill(secondRandomFlowName);
await page.getByPlaceholder("Flow Name").fill(secondRandomFlowName);
await page.getByText("Save", { exact: true }).click();
await page.getByText("Save", { exact: true }).click();
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
await page.getByTestId("icon-ChevronLeft").first().click();
await page.getByTestId("icon-ChevronLeft").first().click();
await page.waitForSelector('[data-testid="search-store-input"]:enabled', {
timeout: 30000,
});
await page.waitForSelector('[data-testid="search-store-input"]:enabled', {
timeout: 30000,
});
await expect(
page.getByText(secondRandomFlowName, { exact: true }),
).toBeVisible({
timeout: 2000,
});
await expect(
page.getByText(secondRandomFlowName, { exact: true }),
).toBeVisible({
timeout: 2000,
});
await expect(page.getByText(randomFlowName, { exact: true })).toBeVisible({
timeout: 2000,
visible: false,
});
await expect(page.getByText(randomFlowName, { exact: true })).toBeVisible({
timeout: 2000,
visible: false,
});
await page.getByTestId("user-profile-settings").click();
await page.getByTestId("user-profile-settings").click();
await page.getByText("Logout", { exact: true }).click();
await page.getByText("Logout", { exact: true }).click();
await page.waitForSelector("text=sign in to langflow", { timeout: 30000 });
await page.waitForSelector("text=sign in to langflow", { timeout: 30000 });
await page.getByPlaceholder("Username").fill("langflow");
await page.getByPlaceholder("Password").fill("langflow");
await page.getByPlaceholder("Username").fill("langflow");
await page.getByPlaceholder("Password").fill("langflow");
await page.getByRole("button", { name: "Sign In" }).click();
await page.getByRole("button", { name: "Sign In" }).click();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[data-testid="search-store-input"]:enabled', {
timeout: 30000,
});
await page.waitForSelector('[data-testid="search-store-input"]:enabled', {
timeout: 30000,
});
expect(
await page.getByText(secondRandomFlowName, { exact: true }).isVisible(),
).toBe(false);
expect(
await page.getByText(secondRandomFlowName, { exact: true }).isVisible(),
).toBe(false);
await expect(page.getByText(randomFlowName, { exact: true })).toBeVisible({
timeout: 2000,
});
});
await expect(page.getByText(randomFlowName, { exact: true })).toBeVisible({
timeout: 2000,
});
},
);

View file

@ -3,130 +3,136 @@ import * as dotenv from "dotenv";
import { readFileSync } from "fs";
import path from "path";
test("user must be able to send an image on chat", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"user must be able to send an image on chat",
{ tag: ["@release", "@workspace", "@components"] },
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("/");
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.goto("/");
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForSelector('[data-testid="icon-AlertTriangle"]', {
timeout: 1000,
});
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.waitForSelector("text=Chat Input", { timeout: 30000 });
await page.getByText("Chat Input", { exact: true }).click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByText("Close").last().click();
await page.getByText("Playground", { exact: true }).last().click();
// Read the image file as a binary string
const filePath = "tests/assets/chain.png";
const fileContent = readFileSync(filePath, "base64");
// Create the DataTransfer and File objects within the browser context
const dataTransfer = await page.evaluateHandle(
({ fileContent }) => {
const dt = new DataTransfer();
const byteCharacters = atob(fileContent);
const byteNumbers = new Array(byteCharacters.length);
for (let i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
const byteArray = new Uint8Array(byteNumbers);
const file = new File([byteArray], "chain.png", { type: "image/png" });
dt.items.add(file);
return dt;
},
{ fileContent },
);
} catch (error) {
modalCount = 0;
}
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
// Locate the target element
const element = await page.getByTestId("input-chat-playground");
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
// Dispatch the drop event on the target element
await element.dispatchEvent("drop", { dataTransfer });
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
await page.getByTestId("button-send").click();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForSelector('[data-testid="icon-AlertTriangle"]', {
timeout: 1000,
});
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
await page.waitForSelector("text=chain.png", { timeout: 30000 });
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.getByText("chain.png").isVisible();
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
await page.getByText("Close", { exact: true }).click();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.waitForSelector('[data-testid="icon-ScanEye"]', {
timeout: 30000,
});
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("icon-ScanEye").nth(4).click();
await page.waitForSelector("text=Chat Input", { timeout: 30000 });
await page.getByText("Restart").isHidden();
});
await page.getByText("Chat Input", { exact: true }).click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByText("Close").last().click();
await page.getByText("Playground", { exact: true }).last().click();
// Read the image file as a binary string
const filePath = "tests/assets/chain.png";
const fileContent = readFileSync(filePath, "base64");
// Create the DataTransfer and File objects within the browser context
const dataTransfer = await page.evaluateHandle(
({ fileContent }) => {
const dt = new DataTransfer();
const byteCharacters = atob(fileContent);
const byteNumbers = new Array(byteCharacters.length);
for (let i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
const file = new File([byteArray], "chain.png", { type: "image/png" });
dt.items.add(file);
return dt;
},
{ fileContent },
);
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
// Locate the target element
const element = await page.getByTestId("input-chat-playground");
// Dispatch the drop event on the target element
await element.dispatchEvent("drop", { dataTransfer });
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
await page.getByTestId("button-send").click();
await page.waitForSelector("text=chain.png", { timeout: 30000 });
await page.getByText("chain.png").isVisible();
await page.getByText("Close", { exact: true }).click();
await page.waitForSelector('[data-testid="icon-ScanEye"]', {
timeout: 30000,
});
await page.getByTestId("icon-ScanEye").nth(4).click();
await page.getByText("Restart").isHidden();
},
);

View file

@ -1,77 +1,80 @@
import { expect, test } from "@playwright/test";
test("user can add components by hovering and clicking the plus icon", async ({
page,
}) => {
// Navigate to homepage and handle initial modal
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"user can add components by hovering and clicking the plus icon",
{ tag: ["@release", "@components", "@workspace"] },
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
async ({ page }) => {
// Navigate to homepage and handle initial modal
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
// Start with blank flow
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="sidebar-search-input"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
// Start with blank flow
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="sidebar-search-input"]', {
timeout: 3000,
});
// Search for a component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat input");
// Search for a component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat input");
await page.waitForSelector('[data-testid="inputsChat Input"]', {
timeout: 2000,
});
// Hover over the component and verify plus icon
const componentLocator = page.getByTestId("inputsChat Input");
// Find the plus icon within the specific component container
const plusIcon = componentLocator.getByTestId("icon-Plus");
await page.waitForSelector('[data-testid="inputsChat Input"]', {
timeout: 2000,
});
// Hover over the component and verify plus icon
const componentLocator = page.getByTestId("inputsChat Input");
// Find the plus icon within the specific component container
const plusIcon = componentLocator.getByTestId("icon-Plus");
// Get the opacity
const opacity = await plusIcon.evaluate((el) =>
window.getComputedStyle(el).getPropertyValue("opacity"),
);
// Get the opacity
const opacity = await plusIcon.evaluate((el) =>
window.getComputedStyle(el).getPropertyValue("opacity"),
);
await expect(plusIcon).toBeVisible();
await expect(plusIcon).toBeVisible();
await expect(opacity).toBe("0");
await expect(opacity).toBe("0");
await componentLocator.hover();
// Hover over the component
await expect(plusIcon).toBeVisible();
// Wait for the animation to change the opacity
await page.waitForTimeout(500);
await componentLocator.hover();
// Hover over the component
await expect(plusIcon).toBeVisible();
// Wait for the animation to change the opacity
await page.waitForTimeout(500);
const opacityAfterHover = await plusIcon.evaluate((el) =>
window.getComputedStyle(el).getPropertyValue("opacity"),
);
const opacityAfterHover = await plusIcon.evaluate((el) =>
window.getComputedStyle(el).getPropertyValue("opacity"),
);
expect(Number(opacityAfterHover)).toBeGreaterThan(0);
expect(Number(opacityAfterHover)).toBeGreaterThan(0);
// Click the plus icon associated with this component
await plusIcon.click();
// Wait for the component to be added to the flow
await page.waitForSelector(".react-flow__node", { timeout: 1000 });
// Click the plus icon associated with this component
await plusIcon.click();
// Wait for the component to be added to the flow
await page.waitForSelector(".react-flow__node", { timeout: 1000 });
// Verify component was added to the flow
const addedComponent = page.locator(".react-flow__node").first();
await expect(addedComponent).toBeVisible();
});
// Verify component was added to the flow
const addedComponent = page.locator(".react-flow__node").first();
await expect(addedComponent).toBeVisible();
},
);

View file

@ -1,176 +1,180 @@
import { expect, test } from "@playwright/test";
test("user must see on handle hover a tooltip with possibility connections", async ({
page,
}) => {
await page.goto("/");
await page.waitForTimeout(1000);
test(
"user must see on handle hover a tooltip with possibility connections",
{ tag: ["@release", "@components", "@api"] },
async ({ page }) => {
await page.goto("/");
await page.waitForTimeout(1000);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("retrievalqa");
await page.getByTestId("sidebar-options-trigger").click();
await page.getByTestId("sidebar-legacy-switch").isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await expect(page.getByTestId("sidebar-legacy-switch")).toBeChecked();
await page.getByTestId("sidebar-options-trigger").click();
await page.waitForTimeout(1000);
await page
.getByTestId("langchain_utilitiesRetrieval QA")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const outputElements = await page
.getByTestId("handle-retrievalqa-shownode-text-right")
.all();
let visibleElementHandle;
for (const element of outputElements) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
}
await visibleElementHandle.hover().then(async () => {
await expect(
page.getByText("Drag to connect compatible inputs").first(),
).toBeVisible();
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("retrievalqa");
await expect(
page
.getByText("Select to filter compatible inputs and components")
.first(),
).toBeVisible();
await page.getByTestId("sidebar-options-trigger").click();
await page
.getByTestId("sidebar-legacy-switch")
.isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await expect(page.getByTestId("sidebar-legacy-switch")).toBeChecked();
await page.getByTestId("sidebar-options-trigger").click();
await expect(page.getByText("Output type:").first()).toBeVisible();
await page.waitForTimeout(1000);
await page
.getByTestId("langchain_utilitiesRetrieval QA")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await expect(
page.getByTestId("output-tooltip-message").first(),
).toBeVisible();
});
const outputElements = await page
.getByTestId("handle-retrievalqa-shownode-text-right")
.all();
let visibleElementHandle;
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const rqaChainInputElements1 = await page
.getByTestId("handle-retrievalqa-shownode-language model-left")
.all();
for (const element of rqaChainInputElements1) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
for (const element of outputElements) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
}
await visibleElementHandle.hover().then(async () => {
await expect(
page.getByText("Drag to connect compatible outputs").first(),
).toBeVisible();
await visibleElementHandle.hover().then(async () => {
await expect(
page.getByText("Drag to connect compatible inputs").first(),
).toBeVisible();
await expect(
page
.getByText("Select to filter compatible outputs and components")
.first(),
).toBeVisible();
await expect(
page
.getByText("Select to filter compatible inputs and components")
.first(),
).toBeVisible();
await expect(page.getByText("Input type:").first()).toBeVisible();
await expect(page.getByText("Output type:").first()).toBeVisible();
await expect(
page.getByTestId("input-tooltip-languagemodel").first(),
).toBeVisible();
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await expect(
page.getByTestId("output-tooltip-message").first(),
).toBeVisible();
});
const rqaChainInputElements0 = await page
.getByTestId("handle-retrievalqa-shownode-retriever-left")
.all();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
for (const element of rqaChainInputElements0) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
const rqaChainInputElements1 = await page
.getByTestId("handle-retrievalqa-shownode-language model-left")
.all();
for (const element of rqaChainInputElements1) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
}
await visibleElementHandle.hover().then(async () => {
await expect(
page.getByText("Drag to connect compatible outputs").first(),
).toBeVisible();
await visibleElementHandle.hover().then(async () => {
await expect(
page.getByText("Drag to connect compatible outputs").first(),
).toBeVisible();
await expect(
page
.getByText("Select to filter compatible outputs and components")
.first(),
).toBeVisible();
await expect(
page
.getByText("Select to filter compatible outputs and components")
.first(),
).toBeVisible();
await expect(page.getByText("Input type:").first()).toBeVisible();
await expect(page.getByText("Input type:").first()).toBeVisible();
await expect(
page.getByTestId("input-tooltip-retriever").first(),
).toBeVisible();
});
await expect(
page.getByTestId("input-tooltip-languagemodel").first(),
).toBeVisible();
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const rqaChainInputElements0 = await page
.getByTestId("handle-retrievalqa-shownode-retriever-left")
.all();
const rqaChainInputElements2 = await page
.getByTestId("handle-retrievalqa-shownode-memory-left")
.all();
for (const element of rqaChainInputElements2) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
for (const element of rqaChainInputElements0) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
}
await visibleElementHandle.hover().then(async () => {
await expect(
page.getByText("Drag to connect compatible outputs").first(),
).toBeVisible();
await visibleElementHandle.hover().then(async () => {
await expect(
page.getByText("Drag to connect compatible outputs").first(),
).toBeVisible();
await expect(
page
.getByText("Select to filter compatible outputs and components")
.first(),
).toBeVisible();
await expect(
page
.getByText("Select to filter compatible outputs and components")
.first(),
).toBeVisible();
await expect(page.getByText("Input type:").first()).toBeVisible();
await expect(page.getByText("Input type:").first()).toBeVisible();
await expect(
page.getByTestId("input-tooltip-basechatmemory").first(),
).toBeVisible();
});
});
await expect(
page.getByTestId("input-tooltip-retriever").first(),
).toBeVisible();
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const rqaChainInputElements2 = await page
.getByTestId("handle-retrievalqa-shownode-memory-left")
.all();
for (const element of rqaChainInputElements2) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.hover().then(async () => {
await expect(
page.getByText("Drag to connect compatible outputs").first(),
).toBeVisible();
await expect(
page
.getByText("Select to filter compatible outputs and components")
.first(),
).toBeVisible();
await expect(page.getByText("Input type:").first()).toBeVisible();
await expect(
page.getByTestId("input-tooltip-basechatmemory").first(),
).toBeVisible();
});
},
);

View file

@ -1,164 +1,171 @@
import { expect, test } from "@playwright/test";
test("user must see on handle click the possibility connections - LLMChain", async ({
page,
}) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"user must see on handle click the possibility connections",
{ tag: ["@release", "@components", "@api"] },
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
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;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 3000,
});
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="sidebar-search-input"]', {
timeout: 3000,
});
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("api request");
await page.waitForSelector('[data-testid="dataAPI Request"]', {
timeout: 3000,
});
await page
.getByTestId("dataAPI Request")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.waitForSelector(
'[data-testid="handle-apirequest-shownode-urls-left"]',
{
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="sidebar-search-input"]', {
timeout: 3000,
},
);
await page.getByTestId("handle-apirequest-shownode-urls-left").click();
await page.waitForTimeout(500);
expect(await page.getByTestId("icon-ListFilter").first()).toBeVisible();
await page
.getByTestId("icon-X")
.first()
.hover()
.then(async () => {
await page
.getByText("Remove filter", {
exact: false,
})
.first()
.isVisible();
});
await expect(page.getByTestId("disclosure-inputs")).toBeVisible();
await expect(page.getByTestId("disclosure-outputs")).toBeVisible();
await expect(page.getByTestId("disclosure-prompts")).toBeVisible();
await expect(page.getByTestId("disclosure-models")).toBeVisible();
await expect(page.getByTestId("disclosure-helpers")).toBeVisible();
await expect(page.getByTestId("disclosure-agents")).toBeVisible();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("api request");
await page.getByTestId("sidebar-options-trigger").click();
await page.getByTestId("sidebar-legacy-switch").isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await page.getByTestId("sidebar-options-trigger").click();
await page.waitForSelector('[data-testid="dataAPI Request"]', {
timeout: 3000,
});
await page
.getByTestId("dataAPI Request")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.waitForSelector(
'[data-testid="handle-apirequest-shownode-urls-left"]',
{
timeout: 3000,
},
);
await page.getByTestId("handle-apirequest-shownode-urls-left").click();
await expect(page.getByTestId("disclosure-prototypes")).toBeVisible();
await page.waitForTimeout(500);
await expect(page.getByTestId("inputsChat Input")).toBeVisible();
await expect(page.getByTestId("outputsChat Output")).toBeVisible();
await expect(page.getByTestId("promptsPrompt")).toBeVisible();
await expect(page.getByTestId("modelsAmazon Bedrock")).toBeVisible();
await expect(page.getByTestId("helpersMessage History")).toBeVisible();
await expect(page.getByTestId("langchain_utilitiesCSVAgent")).toBeVisible();
await expect(
page.getByTestId("langchain_utilitiesConversationChain"),
).toBeVisible();
expect(await page.getByTestId("icon-ListFilter").first()).toBeVisible();
await expect(page.getByTestId("helpersCurrent Date")).toBeVisible();
await page
.getByTestId("icon-X")
.first()
.hover()
.then(async () => {
await page
.getByText("Remove filter", {
exact: false,
})
.first()
.isVisible();
});
await page.getByTestId("sidebar-options-trigger").click();
await page.getByTestId("sidebar-beta-switch").isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-beta-switch").click();
await expect(page.getByTestId("sidebar-beta-switch")).not.toBeChecked();
await page.getByTestId("sidebar-options-trigger").click();
await expect(page.getByTestId("disclosure-inputs")).toBeVisible();
await expect(page.getByTestId("disclosure-outputs")).toBeVisible();
await expect(page.getByTestId("disclosure-prompts")).toBeVisible();
await expect(page.getByTestId("disclosure-models")).toBeVisible();
await expect(page.getByTestId("disclosure-helpers")).toBeVisible();
await expect(page.getByTestId("disclosure-agents")).toBeVisible();
await expect(page.getByTestId("helpersCurrent Date")).not.toBeVisible();
await page.getByTestId("sidebar-options-trigger").click();
await page
.getByTestId("sidebar-legacy-switch")
.isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await page.getByTestId("sidebar-options-trigger").click();
await page.getByTestId("sidebar-filter-reset").click();
await expect(page.getByTestId("disclosure-prototypes")).toBeVisible();
await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();
await expect(page.getByTestId("outputsChat Output")).not.toBeVisible();
await expect(page.getByTestId("promptsPrompt")).not.toBeVisible();
await expect(page.getByTestId("modelsAmazon Bedrock")).not.toBeVisible();
await expect(page.getByTestId("helpersMessage History")).not.toBeVisible();
await expect(page.getByTestId("agentsTool Calling Agent")).not.toBeVisible();
await expect(
page.getByTestId("langchain_utilitiesConversationChain"),
).not.toBeVisible();
await expect(page.getByTestId("logicCondition")).not.toBeVisible();
await expect(page.getByTestId("inputsChat Input")).toBeVisible();
await expect(page.getByTestId("outputsChat Output")).toBeVisible();
await expect(page.getByTestId("promptsPrompt")).toBeVisible();
await expect(page.getByTestId("modelsAmazon Bedrock")).toBeVisible();
await expect(page.getByTestId("helpersMessage History")).toBeVisible();
await expect(page.getByTestId("langchain_utilitiesCSVAgent")).toBeVisible();
await expect(
page.getByTestId("langchain_utilitiesConversationChain"),
).toBeVisible();
await page.getByTestId("handle-apirequest-shownode-headers-left").click();
await expect(page.getByTestId("helpersCurrent Date")).toBeVisible();
await expect(page.getByTestId("disclosure-data")).toBeVisible();
await expect(page.getByTestId("disclosure-helpers")).toBeVisible();
await expect(page.getByTestId("disclosure-vector stores")).toBeVisible();
await expect(page.getByTestId("disclosure-prototypes")).toBeVisible();
await expect(page.getByTestId("disclosure-embeddings")).toBeVisible();
await expect(page.getByTestId("disclosure-tools")).toBeVisible();
await page.getByTestId("sidebar-options-trigger").click();
await page.getByTestId("sidebar-beta-switch").isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-beta-switch").click();
await expect(page.getByTestId("sidebar-beta-switch")).not.toBeChecked();
await page.getByTestId("sidebar-options-trigger").click();
await expect(page.getByTestId("dataAPI Request")).toBeVisible();
await expect(page.getByTestId("helpersMessage History")).toBeVisible();
await expect(page.getByTestId("vectorstoresAstra DB")).toBeVisible();
await expect(page.getByTestId("toolsSearch API")).toBeVisible();
await expect(page.getByTestId("logicSub Flow")).not.toBeVisible();
await expect(page.getByTestId("helpersCurrent Date")).not.toBeVisible();
await page.getByTestId("sidebar-options-trigger").click();
await page.getByTestId("sidebar-beta-switch").isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-beta-switch").click();
await expect(page.getByTestId("sidebar-beta-switch")).toBeChecked();
await page.getByTestId("sidebar-options-trigger").click();
await page.getByTestId("sidebar-filter-reset").click();
await expect(page.getByTestId("logicSub Flow")).toBeVisible();
await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();
await expect(page.getByTestId("outputsChat Output")).not.toBeVisible();
await expect(page.getByTestId("promptsPrompt")).not.toBeVisible();
await expect(page.getByTestId("modelsAmazon Bedrock")).not.toBeVisible();
await expect(page.getByTestId("helpersMessage History")).not.toBeVisible();
await expect(
page.getByTestId("agentsTool Calling Agent"),
).not.toBeVisible();
await expect(
page.getByTestId("langchain_utilitiesConversationChain"),
).not.toBeVisible();
await expect(page.getByTestId("logicCondition")).not.toBeVisible();
await expect(page.getByTestId("processingSplit Text")).toBeVisible();
await expect(page.getByTestId("toolsSearch API")).toBeVisible();
await page.getByTestId("handle-apirequest-shownode-headers-left").click();
await page.getByTestId("icon-X").first().click();
await expect(page.getByTestId("disclosure-data")).toBeVisible();
await expect(page.getByTestId("disclosure-helpers")).toBeVisible();
await expect(page.getByTestId("disclosure-vector stores")).toBeVisible();
await expect(page.getByTestId("disclosure-prototypes")).toBeVisible();
await expect(page.getByTestId("disclosure-embeddings")).toBeVisible();
await expect(page.getByTestId("disclosure-tools")).toBeVisible();
await expect(page.getByTestId("dataAPI Request")).not.toBeVisible();
await expect(page.getByTestId("helpersMessage History")).not.toBeVisible();
await expect(page.getByTestId("vectorstoresAstra DB")).not.toBeVisible();
await expect(page.getByTestId("toolsSearch API")).not.toBeVisible();
await expect(page.getByTestId("logicSub Flow")).not.toBeVisible();
await expect(page.getByTestId("dataAPI Request")).toBeVisible();
await expect(page.getByTestId("helpersMessage History")).toBeVisible();
await expect(page.getByTestId("vectorstoresAstra DB")).toBeVisible();
await expect(page.getByTestId("toolsSearch API")).toBeVisible();
await expect(page.getByTestId("logicSub Flow")).not.toBeVisible();
await expect(page.getByTestId("processingSplit Text")).not.toBeVisible();
await expect(page.getByTestId("toolsSearch API")).not.toBeVisible();
});
await page.getByTestId("sidebar-options-trigger").click();
await page.getByTestId("sidebar-beta-switch").isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-beta-switch").click();
await expect(page.getByTestId("sidebar-beta-switch")).toBeChecked();
await page.getByTestId("sidebar-options-trigger").click();
await expect(page.getByTestId("logicSub Flow")).toBeVisible();
await expect(page.getByTestId("processingSplit Text")).toBeVisible();
await expect(page.getByTestId("toolsSearch API")).toBeVisible();
await page.getByTestId("icon-X").first().click();
await expect(page.getByTestId("dataAPI Request")).not.toBeVisible();
await expect(page.getByTestId("helpersMessage History")).not.toBeVisible();
await expect(page.getByTestId("vectorstoresAstra DB")).not.toBeVisible();
await expect(page.getByTestId("toolsSearch API")).not.toBeVisible();
await expect(page.getByTestId("logicSub Flow")).not.toBeVisible();
await expect(page.getByTestId("processingSplit Text")).not.toBeVisible();
await expect(page.getByTestId("toolsSearch API")).not.toBeVisible();
},
);

View file

@ -1,86 +1,91 @@
import { expect, test } from "@playwright/test";
import { readFileSync } from "fs";
test("CRUD folders", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"CRUD folders",
{ tag: ["@release", "@api"] },
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
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;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
await page.getByTestId("icon-ChevronLeft").first().click();
await page.getByPlaceholder("Search flows").first().isVisible();
await page.getByText("Flows").first().isVisible();
await page.getByText("Components").first().isVisible();
await page.getByText("All").first().isVisible();
await page.getByText("Select All").first().isVisible();
await page.getByTestId("add-folder-button").click();
await page
.locator("[data-testid='folder-sidebar']")
.getByText("New Folder")
.last()
.isVisible();
await page
.locator("[data-testid='folder-sidebar']")
.getByText("New Folder")
.last()
.dblclick();
const element = await page.getByTestId("input-folder");
await element.fill("new folder test name");
await page.getByText("My Projects").last().click({
force: true,
});
await page.getByText("new folder test name").last().waitFor({
state: "visible",
timeout: 30000,
});
await page
.getByText("new folder test name")
.last()
.hover()
.then(async () => {
await page.getByTestId("more-options-button").last().click();
});
await page.getByTestId("btn-delete-folder").click();
await page.getByText("Delete").last().click();
await expect(page.getByText("Folder deleted successfully")).toBeVisible({
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
await page.getByTestId("icon-ChevronLeft").first().click();
await page.getByPlaceholder("Search flows").first().isVisible();
await page.getByText("Flows").first().isVisible();
await page.getByText("Components").first().isVisible();
await page.getByText("All").first().isVisible();
await page.getByText("Select All").first().isVisible();
await page.getByTestId("add-folder-button").click();
await page
.locator("[data-testid='folder-sidebar']")
.getByText("New Folder")
.last()
.isVisible();
await page
.locator("[data-testid='folder-sidebar']")
.getByText("New Folder")
.last()
.dblclick();
const element = await page.getByTestId("input-folder");
await element.fill("new folder test name");
await page.getByText("My Projects").last().click({
force: true,
});
await page.getByText("new folder test name").last().waitFor({
state: "visible",
timeout: 30000,
});
await page
.getByText("new folder test name")
.last()
.hover()
.then(async () => {
await page.getByTestId("more-options-button").last().click();
});
await page.getByTestId("btn-delete-folder").click();
await page.getByText("Delete").last().click();
await expect(page.getByText("Folder deleted successfully")).toBeVisible({
timeout: 3000,
});
});
},
);
test("add a flow into a folder by drag and drop", async ({ page }) => {
await page.goto("/");

View file

@ -2,187 +2,194 @@ import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("user must be able to freeze a path", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"user must be able to freeze a path",
{ tag: ["@release", "@workspace", "@components"] },
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
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 Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("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();
}
//remove all saved api keys
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page
.getByTestId("textarea_str_input_value")
.first()
.fill(
"say a random number between 1 and 100000 and a random animal that lives in the sea",
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.waitForSelector('[data-testid="float_float_temperature"]', {
timeout: 1000,
});
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.getByTestId("float_float_temperature").fill("1.0");
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.waitForSelector('[data-testid="button_run_chat output"]', {
timeout: 1000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
await page.getByTestId("button_run_chat output").click();
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("output-inspection-text").first().click();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const randomTextGeneratedByAI = await page
.getByPlaceholder("Empty")
.first()
.inputValue();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
await page.getByText("Close").first().click();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
await page.waitForSelector('[data-testid="float_float_temperature"]', {
timeout: 3000,
});
//remove all saved api keys
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.getByTestId("float_float_temperature").fill("");
await page.getByTestId("float_float_temperature").fill("1.2");
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
await page.waitForSelector('[data-testid="button_run_chat output"]', {
timeout: 1000,
});
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page
.getByTestId("textarea_str_input_value")
.first()
.fill(
"say a random number between 1 and 100000 and a random animal that lives in the sea",
);
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("output-inspection-text").first().click();
await page.waitForSelector('[data-testid="float_float_temperature"]', {
timeout: 1000,
});
const secondRandomTextGeneratedByAI = await page
.getByPlaceholder("Empty")
.first()
.inputValue();
await page.getByTestId("float_float_temperature").fill("1.0");
await page.getByText("Close").first().click();
await page.waitForSelector('[data-testid="button_run_chat output"]', {
timeout: 1000,
});
await page.waitForSelector("text=OpenAI", {
timeout: 1000,
});
await page.getByTestId("button_run_chat output").click();
await page.getByText("OpenAI", { exact: true }).last().click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.waitForSelector('[data-testid="more-options-modal"]', {
timeout: 1000,
});
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByTestId("more-options-modal").click();
await page.getByTestId("output-inspection-text").first().click();
await page.waitForSelector('[data-testid="freeze-path-button"]', {
timeout: 1000,
});
const randomTextGeneratedByAI = await page
.getByPlaceholder("Empty")
.first()
.inputValue();
await page.getByTestId("freeze-path-button").click();
await page.getByText("Close").first().click();
await page.waitForSelector('[data-testid="icon-Snowflake"]', {
timeout: 1000,
});
await page.waitForSelector('[data-testid="float_float_temperature"]', {
timeout: 3000,
});
expect(await page.getByTestId("icon-Snowflake").count()).toBeGreaterThan(0);
await page.getByTestId("float_float_temperature").fill("");
await page.getByTestId("float_float_temperature").fill("1.2");
await page.waitForSelector('[data-testid="button_run_chat output"]', {
timeout: 1000,
});
await page.waitForSelector('[data-testid="button_run_chat output"]', {
timeout: 1000,
});
await page.getByTestId("button_run_chat output").click();
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByTestId("output-inspection-text").first().click();
await page.getByTestId("output-inspection-text").first().click();
const secondRandomTextGeneratedByAI = await page
.getByPlaceholder("Empty")
.first()
.inputValue();
const thirdRandomTextGeneratedByAI = await page
.getByPlaceholder("Empty")
.first()
.inputValue();
await page.getByText("Close").first().click();
await page.getByText("Close").first().click();
await page.waitForSelector("text=OpenAI", {
timeout: 1000,
});
expect(randomTextGeneratedByAI).not.toEqual(secondRandomTextGeneratedByAI);
expect(randomTextGeneratedByAI).not.toEqual(thirdRandomTextGeneratedByAI);
expect(secondRandomTextGeneratedByAI).toEqual(thirdRandomTextGeneratedByAI);
});
await page.getByText("OpenAI", { exact: true }).last().click();
await page.waitForSelector('[data-testid="more-options-modal"]', {
timeout: 1000,
});
await page.getByTestId("more-options-modal").click();
await page.waitForSelector('[data-testid="freeze-path-button"]', {
timeout: 1000,
});
await page.getByTestId("freeze-path-button").click();
await page.waitForSelector('[data-testid="icon-Snowflake"]', {
timeout: 1000,
});
expect(await page.getByTestId("icon-Snowflake").count()).toBeGreaterThan(0);
await page.waitForSelector('[data-testid="button_run_chat output"]', {
timeout: 1000,
});
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByTestId("output-inspection-text").first().click();
const thirdRandomTextGeneratedByAI = await page
.getByPlaceholder("Empty")
.first()
.inputValue();
await page.getByText("Close").first().click();
expect(randomTextGeneratedByAI).not.toEqual(secondRandomTextGeneratedByAI);
expect(randomTextGeneratedByAI).not.toEqual(thirdRandomTextGeneratedByAI);
expect(secondRandomTextGeneratedByAI).toEqual(thirdRandomTextGeneratedByAI);
},
);

View file

@ -1,367 +1,374 @@
import { expect, test } from "@playwright/test";
test("user must be able to freeze a component", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"user must be able to freeze a component",
{ tag: ["@release", "@workspace", "@components"] },
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
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;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("blank-flow").click();
await page.getByTestId("blank-flow").click();
//first component
//first component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text input");
await page.waitForSelector('[data-testid="inputsText Input"]', {
timeout: 1000,
});
await page
.getByTestId("inputsText Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.mouse.up();
//second component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("url");
await page.waitForSelector('[data-testid="dataURL"]', {
timeout: 1000,
});
await page
.getByTestId("dataURL")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.mouse.up();
//third component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("split text");
await page.waitForSelector('[data-testid="processingSplit Text"]', {
timeout: 1000,
});
await page
.getByTestId("processingSplit Text")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.mouse.up();
//fourth component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("parse data");
await page.waitForSelector('[data-testid="processingParse Data"]', {
timeout: 1000,
});
await page
.getByTestId("processingParse Data")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.mouse.up();
//fifth component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
await page.waitForSelector('[data-testid="outputsChat Output"]', {
timeout: 1000,
});
await page
.getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.mouse.up();
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForSelector('[data-testid="icon-AlertTriangle"]', {
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text input");
await page.waitForSelector('[data-testid="inputsText Input"]', {
timeout: 1000,
});
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page
.getByTestId("inputsText Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
//connection 1
const urlOutput = await page
.getByTestId("handle-url-shownode-data-right")
.nth(0);
await urlOutput.hover();
await page.mouse.down();
const splitTextInputData = await page.getByTestId(
"handle-splittext-shownode-data inputs-left",
);
await splitTextInputData.hover();
await page.mouse.up();
await page.mouse.up();
//connection 2
const textOutput = await page
.getByTestId("handle-textinput-shownode-text-right")
.nth(0);
await textOutput.hover();
await page.mouse.down();
const splitTextInput = await page.getByTestId(
"handle-splittext-shownode-separator-left",
);
await splitTextInput.hover();
await page.mouse.up();
//second component
await page.getByTestId("fit_view").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("url");
await page.waitForSelector('[data-testid="dataURL"]', {
timeout: 1000,
});
//connection 3
const splitTextOutput = await page
.getByTestId("handle-splittext-shownode-chunks-right")
.nth(0);
await splitTextOutput.hover();
await page.mouse.down();
const parseDataInput = await page.getByTestId(
"handle-parsedata-shownode-data-left",
);
await parseDataInput.hover();
await page.mouse.up();
await page
.getByTestId("dataURL")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
//connection 4
const parseDataOutput = await page
.getByTestId("handle-parsedata-shownode-text-right")
.nth(0);
await parseDataOutput.hover();
await page.mouse.down();
const chatOutputInput = await page.getByTestId(
"handle-chatoutput-shownode-text-left",
);
await chatOutputInput.hover();
await page.mouse.up();
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.getByTestId("fit_view").click();
await page.mouse.up();
await page
.getByTestId("textarea_str_input_value")
.first()
.fill("lorem ipsum");
//third component
await page
.getByTestId("inputlist_str_urls_0")
.fill("https://www.lipsum.com/");
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("split text");
await page.waitForSelector('[data-testid="processingSplit Text"]', {
timeout: 1000,
});
await page.getByTestId("button_run_chat output").click();
await page
.getByTestId("processingSplit Text")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.mouse.up();
await page.waitForSelector('[data-testid="output-inspection-message"]', {
timeout: 1000,
});
//fourth component
await page.getByTestId("output-inspection-message").first().click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("parse data");
await page.waitForSelector('[data-testid="processingParse Data"]', {
timeout: 1000,
});
await page.getByRole("gridcell").nth(4).click();
await page
.getByTestId("processingParse Data")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
const firstRunWithoutFreezing = await page
.getByPlaceholder("Empty")
.textContent();
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.getByText("Close").last().click();
await page.getByText("Close").last().click();
await page.mouse.up();
await page.getByTestId("textarea_str_input_value").first().fill(",");
//fifth component
await page.getByTestId("button_run_chat output").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
await page.waitForSelector('[data-testid="outputsChat Output"]', {
timeout: 1000,
});
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page
.getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.waitForSelector('[data-testid="output-inspection-message"]', {
timeout: 1000,
});
await page.mouse.up();
await page.getByTestId("output-inspection-message").first().click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
await page.getByRole("gridcell").nth(4).click();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForSelector('[data-testid="icon-AlertTriangle"]', {
timeout: 1000,
});
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
const secondRunWithoutFreezing = await page
.getByPlaceholder("Empty")
.textContent();
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.getByText("Close").last().click();
await page.getByText("Close").last().click();
await page.getByTestId("fit_view").click();
await page.getByText("Split Text", { exact: true }).last().click();
//connection 1
const urlOutput = await page
.getByTestId("handle-url-shownode-data-right")
.nth(0);
await urlOutput.hover();
await page.mouse.down();
const splitTextInputData = await page.getByTestId(
"handle-splittext-shownode-data inputs-left",
);
await splitTextInputData.hover();
await page.mouse.up();
await page.waitForSelector('[data-testid="more-options-modal"]', {
timeout: 1000,
});
//connection 2
const textOutput = await page
.getByTestId("handle-textinput-shownode-text-right")
.nth(0);
await textOutput.hover();
await page.mouse.down();
const splitTextInput = await page.getByTestId(
"handle-splittext-shownode-separator-left",
);
await splitTextInput.hover();
await page.mouse.up();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("fit_view").click();
await page.waitForSelector('[data-testid="icon-Snowflake"]', {
timeout: 1000,
});
//connection 3
const splitTextOutput = await page
.getByTestId("handle-splittext-shownode-chunks-right")
.nth(0);
await splitTextOutput.hover();
await page.mouse.down();
const parseDataInput = await page.getByTestId(
"handle-parsedata-shownode-data-left",
);
await parseDataInput.hover();
await page.mouse.up();
await page.getByTestId("icon-Snowflake").click();
//connection 4
const parseDataOutput = await page
.getByTestId("handle-parsedata-shownode-text-right")
.nth(0);
await parseDataOutput.hover();
await page.mouse.down();
const chatOutputInput = await page.getByTestId(
"handle-chatoutput-shownode-text-left",
);
await chatOutputInput.hover();
await page.mouse.up();
await page.keyboard.press("Escape");
await page.getByTestId("fit_view").click();
await page.locator('//*[@id="react-flow-id"]').click();
await page
.getByTestId("textarea_str_input_value")
.first()
.fill("lorem ipsum");
await page
.getByTestId("textarea_str_input_value")
.first()
.fill("lorem ipsum");
await page
.getByTestId("inputlist_str_urls_0")
.fill("https://www.lipsum.com/");
await page.waitForSelector('[data-testid="button_run_chat output"]', {
timeout: 1000,
});
await page.getByTestId("button_run_chat output").click();
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.waitForSelector('[data-testid="output-inspection-message"]', {
timeout: 1000,
});
await page.waitForSelector('[data-testid="output-inspection-message"]', {
timeout: 1000,
});
await page.getByTestId("output-inspection-message").first().click();
await page.getByTestId("output-inspection-message").first().click();
await page.getByRole("gridcell").nth(4).click();
await page.getByRole("gridcell").nth(4).click();
const firstRunWithoutFreezing = await page
.getByPlaceholder("Empty")
.textContent();
const firstTextFreezed = await page.getByPlaceholder("Empty").textContent();
await page.getByText("Close").last().click();
await page.getByText("Close").last().click();
await page.getByText("Close").last().click();
await page.getByText("Close").last().click();
await page.getByTestId("textarea_str_input_value").first().fill(",");
await page.getByText("Split Text", { exact: true }).click();
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector('[data-testid="more-options-modal"]', {
timeout: 1000,
});
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByTestId("more-options-modal").click();
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.waitForSelector('[data-testid="icon-Snowflake"]', {
timeout: 1000,
});
await page.waitForSelector('[data-testid="output-inspection-message"]', {
timeout: 1000,
});
await page.getByText("Freeze", { exact: true }).click();
await page.getByTestId("output-inspection-message").first().click();
await page.keyboard.press("Escape");
await page.getByRole("gridcell").nth(4).click();
await page.locator('//*[@id="react-flow-id"]').click();
const secondRunWithoutFreezing = await page
.getByPlaceholder("Empty")
.textContent();
await page.getByTestId("button_run_chat output").click();
await page.getByText("Close").last().click();
await page.getByText("Close").last().click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("Split Text", { exact: true }).last().click();
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.waitForSelector('[data-testid="more-options-modal"]', {
timeout: 1000,
});
await page.waitForSelector('[data-testid="output-inspection-message"]', {
timeout: 1000,
});
await page.getByTestId("more-options-modal").click();
await page.getByTestId("output-inspection-message").first().click();
await page.waitForSelector('[data-testid="icon-Snowflake"]', {
timeout: 1000,
});
await page.getByRole("gridcell").nth(4).click();
await page.getByTestId("icon-Snowflake").click();
const thirdTextWithoutFreezing = await page
.getByPlaceholder("Empty")
.textContent();
await page.keyboard.press("Escape");
expect(secondRunWithoutFreezing).toBe(firstTextFreezed);
await page.locator('//*[@id="react-flow-id"]').click();
expect(firstRunWithoutFreezing).not.toBe(firstTextFreezed);
expect(firstRunWithoutFreezing).not.toBe(secondRunWithoutFreezing);
expect(firstRunWithoutFreezing).not.toBe(firstTextFreezed);
expect(thirdTextWithoutFreezing).not.toBe(firstTextFreezed);
});
await page
.getByTestId("textarea_str_input_value")
.first()
.fill("lorem ipsum");
await page.waitForSelector('[data-testid="button_run_chat output"]', {
timeout: 1000,
});
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.waitForSelector('[data-testid="output-inspection-message"]', {
timeout: 1000,
});
await page.getByTestId("output-inspection-message").first().click();
await page.getByRole("gridcell").nth(4).click();
const firstTextFreezed = await page.getByPlaceholder("Empty").textContent();
await page.getByText("Close").last().click();
await page.getByText("Close").last().click();
await page.getByText("Split Text", { exact: true }).click();
await page.waitForSelector('[data-testid="more-options-modal"]', {
timeout: 1000,
});
await page.getByTestId("more-options-modal").click();
await page.waitForSelector('[data-testid="icon-Snowflake"]', {
timeout: 1000,
});
await page.getByText("Freeze", { exact: true }).click();
await page.keyboard.press("Escape");
await page.locator('//*[@id="react-flow-id"]').click();
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.waitForSelector('[data-testid="output-inspection-message"]', {
timeout: 1000,
});
await page.getByTestId("output-inspection-message").first().click();
await page.getByRole("gridcell").nth(4).click();
const thirdTextWithoutFreezing = await page
.getByPlaceholder("Empty")
.textContent();
expect(secondRunWithoutFreezing).toBe(firstTextFreezed);
expect(firstRunWithoutFreezing).not.toBe(firstTextFreezed);
expect(firstRunWithoutFreezing).not.toBe(secondRunWithoutFreezing);
expect(firstRunWithoutFreezing).not.toBe(firstTextFreezed);
expect(thirdTextWithoutFreezing).not.toBe(firstTextFreezed);
},
);

View file

@ -1,94 +1,96 @@
import { expect, test } from "@playwright/test";
test("user must be able to save or delete a global variable", async ({
page,
}) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"user must be able to save or delete a global variable",
{ tag: ["@release", "@workspace", "@api"] },
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.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await page.waitForSelector('[data-testid="modelsOpenAI"]', {
timeout: 1000,
});
await page
.getByTestId("modelsOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const genericName = Math.random().toString();
const credentialName = Math.random().toString();
await page.getByTestId("icon-Globe").nth(0).click();
await page.getByText("Add New Variable", { exact: true }).click();
await page
.getByPlaceholder("Insert a name for the variable...")
.fill(genericName);
await page.getByText("Generic", { exact: true }).first().isVisible();
await page
.getByPlaceholder("Insert a value for the variable...")
.fill("This is a test of generic variable value");
await page.getByText("Save Variable", { exact: true }).click();
expect(page.getByText(genericName, { exact: true })).not.toBeNull();
await page.getByText(genericName, { exact: true }).isVisible();
await page.getByText("Add New Variable", { exact: true }).click();
await page
.getByPlaceholder("Insert a name for the variable...")
.fill(credentialName);
await page.getByTestId("select-type-global-variables").first().click();
await page.getByText("Credential", { exact: true }).last().click();
await page
.getByPlaceholder("Insert a value for the variable...")
.fill("This is a test of credential variable value");
await page.getByText("Save Variable", { exact: true }).click();
expect(page.getByText(credentialName, { exact: true })).not.toBeNull();
await page.getByText(credentialName, { exact: true }).isVisible();
await page
.getByText(credentialName, { exact: true })
.hover()
.then(async () => {
await page.getByTestId("icon-Trash2").last().click();
await page.getByText("Delete", { exact: true }).nth(1).click();
await page.waitForSelector('[data-testid="modelsOpenAI"]', {
timeout: 1000,
});
});
await page
.getByTestId("modelsOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const genericName = Math.random().toString();
const credentialName = Math.random().toString();
await page.getByTestId("icon-Globe").nth(0).click();
await page.getByText("Add New Variable", { exact: true }).click();
await page
.getByPlaceholder("Insert a name for the variable...")
.fill(genericName);
await page.getByText("Generic", { exact: true }).first().isVisible();
await page
.getByPlaceholder("Insert a value for the variable...")
.fill("This is a test of generic variable value");
await page.getByText("Save Variable", { exact: true }).click();
expect(page.getByText(genericName, { exact: true })).not.toBeNull();
await page.getByText(genericName, { exact: true }).isVisible();
await page.getByText("Add New Variable", { exact: true }).click();
await page
.getByPlaceholder("Insert a name for the variable...")
.fill(credentialName);
await page.getByTestId("select-type-global-variables").first().click();
await page.getByText("Credential", { exact: true }).last().click();
await page
.getByPlaceholder("Insert a value for the variable...")
.fill("This is a test of credential variable value");
await page.getByText("Save Variable", { exact: true }).click();
expect(page.getByText(credentialName, { exact: true })).not.toBeNull();
await page.getByText(credentialName, { exact: true }).isVisible();
await page
.getByText(credentialName, { exact: true })
.hover()
.then(async () => {
await page.getByTestId("icon-Trash2").last().click();
await page.getByText("Delete", { exact: true }).nth(1).click();
});
},
);

View file

@ -2,42 +2,46 @@ import { test } from "@playwright/test";
test.describe("group node test", () => {
/// <reference lib="dom"/>
test("group and ungroup updating values", async ({ page }) => {
await page.goto("/");
test(
"group and ungroup updating values",
{ tag: ["@release", "@workspace"] },
async ({ page }) => {
await page.goto("/");
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
modalCount = await page.getByTestId("modal-title")?.count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page
.getByRole("heading", { name: "Basic Prompting" })
.first()
.click();
await page.getByTestId("fit_view").first().click();
await page.getByTestId("side_nav_options_all-templates").click();
await page
.getByRole("heading", { name: "Basic Prompting" })
.first()
.click();
await page.getByTestId("fit_view").first().click();
await page.getByTestId("title-OpenAI").click();
await page.getByTestId("title-OpenAI").click({ modifiers: ["Control"] });
await page.getByTestId("title-Prompt").click({ modifiers: ["Control"] });
await page.getByTestId("title-OpenAI").click({ modifiers: ["Control"] });
await page.getByTestId("title-OpenAI").click();
await page.getByTestId("title-OpenAI").click({ modifiers: ["Control"] });
await page.getByTestId("title-Prompt").click({ modifiers: ["Control"] });
await page.getByTestId("title-OpenAI").click({ modifiers: ["Control"] });
await page.getByRole("button", { name: "Group" }).click();
await page.getByTestId("title-Group").dblclick();
await page.getByTestId("input-title-Group").first().fill("test");
await page.getByTestId("icon-Ungroup").first().click();
await page.keyboard.press("Control+g");
await page.getByTestId("title-OpenAI").isVisible();
await page.getByTestId("title-Prompt").isVisible();
});
await page.getByRole("button", { name: "Group" }).click();
await page.getByTestId("title-Group").dblclick();
await page.getByTestId("input-title-Group").first().fill("test");
await page.getByTestId("icon-Ungroup").first().click();
await page.keyboard.press("Control+g");
await page.getByTestId("title-OpenAI").isVisible();
await page.getByTestId("title-Prompt").isVisible();
},
);
});

View file

@ -1,99 +1,101 @@
import { expect, test } from "@playwright/test";
test("user can search and add components using keyboard shortcuts", async ({
page,
}) => {
// Navigate to homepage and handle initial modal
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
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 Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
test(
"user can search and add components using keyboard shortcuts",
{ tag: ["@release", "@workspace"] },
async ({ page }) => {
// Navigate to homepage and handle initial modal
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
// Start with blank flow
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="sidebar-search-input"]', {
timeout: 1000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
// Press "/" to activate search
await page.keyboard.press("/");
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
// Verify search is focused and disclosures are closed when search is empty
await expect(page.getByTestId("sidebar-search-input")).toBeFocused({
timeout: 1000,
});
await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();
// Start with blank flow
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="sidebar-search-input"]', {
timeout: 1000,
});
// Type "chat" to search for chat components
await page.keyboard.type("chat");
// Press "/" to activate search
await page.keyboard.press("/");
await expect(page.getByTestId("inputsChat Input")).toBeVisible({
timeout: 1000,
});
// Verify search is focused and disclosures are closed when search is empty
await expect(page.getByTestId("sidebar-search-input")).toBeFocused({
timeout: 1000,
});
await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();
// Verify disclosures open when search has content
await expect(page.getByTestId("inputsChat Input")).toBeVisible();
// Type "chat" to search for chat components
await page.keyboard.type("chat");
// Press Tab to focus first result
await page.keyboard.press("Tab");
await page.keyboard.press("Tab");
await expect(page.getByTestId("inputsChat Input")).toBeVisible({
timeout: 1000,
});
// Verify some expected chat-related components are visible
await expect(page.getByTestId("inputsChat Input")).toBeVisible();
await expect(page.getByTestId("outputsChat Output")).toBeVisible();
// Verify disclosures open when search has content
await expect(page.getByTestId("inputsChat Input")).toBeVisible();
// Press Space to select the component
await page.keyboard.press("Space");
// Press Tab to focus first result
await page.keyboard.press("Tab");
await page.keyboard.press("Tab");
// Verify component was added to flow
const addedComponent = await page.locator(".react-flow__node").first();
await expect(addedComponent).toBeVisible();
// Verify some expected chat-related components are visible
await expect(page.getByTestId("inputsChat Input")).toBeVisible();
await expect(page.getByTestId("outputsChat Output")).toBeVisible();
// Clear search input and verify disclosures are closed
await page.getByTestId("sidebar-search-input").clear();
await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();
// Press Space to select the component
await page.keyboard.press("Space");
// Test Enter key selection
await page.keyboard.press("/");
await page.keyboard.type("prompt");
// Verify component was added to flow
const addedComponent = await page.locator(".react-flow__node").first();
await expect(addedComponent).toBeVisible();
// Verify disclosures open with new search
await expect(page.getByTestId("promptsPrompt")).toBeVisible();
// Clear search input and verify disclosures are closed
await page.getByTestId("sidebar-search-input").clear();
await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();
await page.keyboard.press("Tab");
await page.keyboard.press("Tab");
await page.keyboard.press("Enter");
// Test Enter key selection
await page.keyboard.press("/");
await page.keyboard.type("prompt");
// Verify second component was added
const nodeCount = await page.locator(".react-flow__node").count();
expect(nodeCount).toBe(2);
// Verify disclosures open with new search
await expect(page.getByTestId("promptsPrompt")).toBeVisible();
// Verify search is cleared and disclosures are closed after adding component
await page.keyboard.press("/");
await page.getByTestId("sidebar-search-input").clear();
await expect(page.getByTestId("sidebar-search-input")).toHaveValue("");
await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();
await page.keyboard.press("Tab");
await page.keyboard.press("Tab");
await page.keyboard.press("Enter");
await expect(page.getByTestId("sidebar-search-input")).toBeFocused();
await page.keyboard.press("Escape");
await expect(page.getByTestId("sidebar-search-input")).not.toBeFocused();
await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();
});
// Verify second component was added
const nodeCount = await page.locator(".react-flow__node").count();
expect(nodeCount).toBe(2);
// Verify search is cleared and disclosures are closed after adding component
await page.keyboard.press("/");
await page.getByTestId("sidebar-search-input").clear();
await expect(page.getByTestId("sidebar-search-input")).toHaveValue("");
await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();
await expect(page.getByTestId("sidebar-search-input")).toBeFocused();
await page.keyboard.press("Escape");
await expect(page.getByTestId("sidebar-search-input")).not.toBeFocused();
await expect(page.getByTestId("inputsChat Input")).not.toBeVisible();
},
);

View file

@ -2,116 +2,123 @@ import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("should able to see and interact with logs", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"should able to see and interact with logs",
{ tag: ["@release", "@workspace", "@api"] },
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
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();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await expect(page.getByTestId(/.*rf__node.*/).first()).toBeVisible({
timeout: 1000,
});
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("icon-ChevronDown").click();
await page.getByText("Logs").click();
await page.getByText("No Data Available", { exact: true }).isVisible();
await page.keyboard.press("Escape");
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await expect(page.getByTestId(/.*rf__node.*/).first()).toBeVisible({
timeout: 1000,
});
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("icon-ChevronDown").click();
await page.getByText("Logs").click();
await page.getByText("No Data Available", { exact: true }).isVisible();
await page.keyboard.press("Escape");
await page.waitForSelector('[data-testid="button_run_chat output"]', {
timeout: 1000,
});
await page.getByTestId("button_run_chat output").first().click();
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page
.getByText("Chat Output built successfully", { exact: true })
.isVisible();
await page.getByTestId("icon-ChevronDown").click();
await page.getByText("Logs").click();
await page.waitForSelector('[data-testid="button_run_chat output"]', {
timeout: 1000,
});
await page.getByTestId("button_run_chat output").first().click();
await page.getByText("timestamp").first().isVisible();
await page.getByText("flow_id").first().isVisible();
await page.getByText("source").first().isVisible();
await page.getByText("target", { exact: true }).first().isVisible();
await page.getByText("target_args", { exact: true }).first().isVisible();
await page.getByRole("gridcell").first().isVisible();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.keyboard.press("Escape");
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByTestId("user-profile-settings").first().click();
await page.getByText("Settings", { exact: true }).click();
await page
.getByText("Chat Output built successfully", { exact: true })
.isVisible();
await page.getByTestId("icon-ChevronDown").click();
await page.getByText("Logs").click();
await page.getByText("Messages", { exact: true }).click();
await page.getByText("index", { exact: true }).last().isVisible();
await page.getByText("timestamp", { exact: true }).isVisible();
await page.getByText("flow_id", { exact: true }).isVisible();
await page.getByText("source", { exact: true }).isVisible();
await page.getByText("target", { exact: true }).isVisible();
await page.getByText("vertex_id", { exact: true }).isVisible();
await page.getByText("status", { exact: true }).isVisible();
await page.getByText("error", { exact: true }).isVisible();
await page.getByText("outputs", { exact: true }).isVisible();
await page.getByText("inputs", { exact: true }).isVisible();
await page.getByText("timestamp").first().isVisible();
await page.getByText("flow_id").first().isVisible();
await page.getByText("source").first().isVisible();
await page.getByText("target", { exact: true }).first().isVisible();
await page.getByText("target_args", { exact: true }).first().isVisible();
await page.getByRole("gridcell").first().isVisible();
await page.getByRole("gridcell").first().isVisible();
});
await page.keyboard.press("Escape");
await page.getByTestId("user-profile-settings").first().click();
await page.getByText("Settings", { exact: true }).click();
await page.getByText("Messages", { exact: true }).click();
await page.getByText("index", { exact: true }).last().isVisible();
await page.getByText("timestamp", { exact: true }).isVisible();
await page.getByText("flow_id", { exact: true }).isVisible();
await page.getByText("source", { exact: true }).isVisible();
await page.getByText("target", { exact: true }).isVisible();
await page.getByText("vertex_id", { exact: true }).isVisible();
await page.getByText("status", { exact: true }).isVisible();
await page.getByText("error", { exact: true }).isVisible();
await page.getByText("outputs", { exact: true }).isVisible();
await page.getByText("inputs", { exact: true }).isVisible();
await page.getByRole("gridcell").first().isVisible();
},
);

View file

@ -2,282 +2,288 @@ import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("fresh start playground", async ({ page }) => {
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
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();
test(
"fresh start playground",
{ tag: ["@release", "@workspace", "@api"] },
async ({ page }) => {
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.goto("/");
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").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.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").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('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text output");
await page.waitForTimeout(1000);
await page
.getByTestId("outputsText Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("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;
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
}
// Click and hold on the first element
await visibleElementHandle.hover();
await page.mouse.down();
// Move to the second element
const elementsTextOutput = await page
.getByTestId("handle-textoutput-shownode-text-left")
.all();
for (const element of elementsTextOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
}
await visibleElementHandle.hover();
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
// Release the mouse
await page.mouse.up();
await page.getByTestId("blank-flow").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").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();
const elementsTextOutputRight = await page
.locator('[data-testid="handle-textoutput-shownode-text-right"]')
.all();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
for (const element of elementsTextOutputRight) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").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('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text output");
await page.waitForTimeout(1000);
await page
.getByTestId("outputsText Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("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();
// Click and hold on the first element
await visibleElementHandle.hover();
await page.mouse.down();
//
const elementsChatOutput = await page
.getByTestId("handle-chatoutput-shownode-text-left")
.all();
// Move to the second element
for (const element of elementsChatOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
const elementsTextOutput = await page
.getByTestId("handle-textoutput-shownode-text-left")
.all();
for (const element of elementsTextOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
}
await visibleElementHandle.hover();
await visibleElementHandle.hover();
// Release the mouse
await page.mouse.up();
// Release the mouse
await page.mouse.up();
await page.getByTestId("fit_view").click();
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("fit_view").click();
//send message
await page.getByTestId("input-chat-playground").click();
await page.getByTestId("input-chat-playground").fill("message 1");
await page.keyboard.press("Enter");
//check message
await page.getByTestId("chat-message-User-message 1").click();
await page
.getByTestId("chat-message-AI-message 1")
.getByText("message")
.click();
//check session
await page.getByText("Default Session").first().click();
await page.getByTestId("chat-message-User-message 1").click();
//check edit message
await page.getByTestId("chat-message-User-message 1").hover();
await page
.locator("div")
.filter({ hasText: /^Usermessage 1$/ })
.getByTestId("icon-Pen")
.click();
await page.waitForTimeout(500);
//
await page.getByTestId("textarea").fill("edit_1");
await page.getByTestId("save-button").click();
await page.getByTestId("chat-message-User-edit_1").click();
await page.getByTestId("chat-message-User-edit_1").hover();
// check cancel edit
await page.getByTestId("sender_name_user").hover();
await page.getByTestId("icon-Pen").first().click();
await page.waitForTimeout(500);
const elementsTextOutputRight = await page
.locator('[data-testid="handle-textoutput-shownode-text-right"]')
.all();
await page.getByTestId("textarea").fill("cancel_edit");
await page.getByTestId("cancel-button").click();
await page.getByTestId("chat-message-User-edit_1").click();
await page.getByTestId("chat-message-User-edit_1").hover();
//check edit bot message
await page
.getByTestId("chat-message-AI-message 1")
.getByText("message")
.click();
await page.getByTestId("chat-message-AI-message 1").hover();
await page.getByTestId("icon-Pen").last().click();
await page.waitForTimeout(500);
for (const element of elementsTextOutputRight) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await page.getByTestId("textarea").fill("edit_bot_1");
await page.getByTestId("save-button").click();
await page.getByText("edit_bot_1").click();
// check cancel edit bot
await page.getByTestId("chat-message-AI-edit_bot_1").hover();
await page.getByTestId("icon-Pen").last().click();
await page.waitForTimeout(500);
// Click and hold on the first element
await visibleElementHandle.hover();
await page.mouse.down();
await page.getByTestId("textarea").fill("edit_bot_cancel");
await page.getByTestId("cancel-button").click();
await page.getByText("edit_bot_1").click();
await page.getByTestId("chat-message-AI-edit_bot_1").hover();
// check table messages view
await page.getByRole("combobox").click();
await page.getByLabel("Message logs").click();
await page.getByText("Page 1 of 1", { exact: true }).click();
// check rename session
await page.getByRole("combobox").click();
await page.getByLabel("Rename").getByText("Rename").click();
await page.getByRole("textbox").fill("new name");
await page.getByTestId("icon-Check").click();
await page.waitForTimeout(500);
//
const elementsChatOutput = await page
.getByTestId("handle-chatoutput-shownode-text-left")
.all();
await page.getByTestId("session-selector").getByText("new name").click();
// check cancel rename
await page.getByRole("combobox").click();
await page.getByLabel("Rename").getByText("Rename").click();
await page.getByRole("textbox").fill("cancel name");
await page.getByTestId("session-selector").getByTestId("icon-X").click();
await page.getByTestId("session-selector").getByText("new name").click();
// check cancel rename blur
await page.getByRole("combobox").click();
await page.getByLabel("Rename").getByText("Rename").click();
await page.getByRole("textbox").fill("cancel_blur");
await page.getByText("PlaygroundChat").click();
await page.getByTestId("session-selector").getByText("new name").click();
// check delete session
await page.getByRole("combobox").click();
await page.getByLabel("Delete").click();
await page.getByRole("heading", { name: "New chat" }).click();
// check new session
await page.getByTestId("input-chat-playground").click();
await page.getByTestId("input-chat-playground").fill("session_after_delete");
await page.keyboard.press("Enter");
await page.getByTestId("chat-message-User-session_after_delete").click();
await expect(page.getByTestId("session-selector")).toBeVisible();
for (const element of elementsChatOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
// check new chat
await page.getByTestId("new-chat").click();
await page.waitForTimeout(5000);
await page.getByText("New chat").click();
await page.getByTestId("input-chat-playground").click();
await page.getByTestId("input-chat-playground").fill("second session");
await page.keyboard.press("Enter");
await page.waitForTimeout(5000);
await visibleElementHandle.hover();
await page.getByTestId("chat-message-User-second session").click();
await page
.getByTestId("chat-message-AI-second session")
.getByText("second session")
.click();
expect(await page.getByTestId("session-selector").count()).toBe(2);
// Release the mouse
await page.mouse.up();
const sessionElements = await page.getByTestId("session-selector").all();
expect(sessionElements.length).toBe(2);
});
await page.getByTestId("fit_view").click();
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
//send message
await page.getByTestId("input-chat-playground").click();
await page.getByTestId("input-chat-playground").fill("message 1");
await page.keyboard.press("Enter");
//check message
await page.getByTestId("chat-message-User-message 1").click();
await page
.getByTestId("chat-message-AI-message 1")
.getByText("message")
.click();
//check session
await page.getByText("Default Session").first().click();
await page.getByTestId("chat-message-User-message 1").click();
//check edit message
await page.getByTestId("chat-message-User-message 1").hover();
await page
.locator("div")
.filter({ hasText: /^Usermessage 1$/ })
.getByTestId("icon-Pen")
.click();
await page.waitForTimeout(500);
await page.getByTestId("textarea").fill("edit_1");
await page.getByTestId("save-button").click();
await page.getByTestId("chat-message-User-edit_1").click();
await page.getByTestId("chat-message-User-edit_1").hover();
// check cancel edit
await page.getByTestId("sender_name_user").hover();
await page.getByTestId("icon-Pen").first().click();
await page.waitForTimeout(500);
await page.getByTestId("textarea").fill("cancel_edit");
await page.getByTestId("cancel-button").click();
await page.getByTestId("chat-message-User-edit_1").click();
await page.getByTestId("chat-message-User-edit_1").hover();
//check edit bot message
await page
.getByTestId("chat-message-AI-message 1")
.getByText("message")
.click();
await page.getByTestId("chat-message-AI-message 1").hover();
await page.getByTestId("icon-Pen").last().click();
await page.waitForTimeout(500);
await page.getByTestId("textarea").fill("edit_bot_1");
await page.getByTestId("save-button").click();
await page.getByText("edit_bot_1").click();
// check cancel edit bot
await page.getByTestId("chat-message-AI-edit_bot_1").hover();
await page.getByTestId("icon-Pen").last().click();
await page.waitForTimeout(500);
await page.getByTestId("textarea").fill("edit_bot_cancel");
await page.getByTestId("cancel-button").click();
await page.getByText("edit_bot_1").click();
await page.getByTestId("chat-message-AI-edit_bot_1").hover();
// check table messages view
await page.getByRole("combobox").click();
await page.getByLabel("Message logs").click();
await page.getByText("Page 1 of 1", { exact: true }).click();
// check rename session
await page.getByRole("combobox").click();
await page.getByLabel("Rename").getByText("Rename").click();
await page.getByRole("textbox").fill("new name");
await page.getByTestId("icon-Check").click();
await page.waitForTimeout(500);
await page.getByTestId("session-selector").getByText("new name").click();
// check cancel rename
await page.getByRole("combobox").click();
await page.getByLabel("Rename").getByText("Rename").click();
await page.getByRole("textbox").fill("cancel name");
await page.getByTestId("session-selector").getByTestId("icon-X").click();
await page.getByTestId("session-selector").getByText("new name").click();
// check cancel rename blur
await page.getByRole("combobox").click();
await page.getByLabel("Rename").getByText("Rename").click();
await page.getByRole("textbox").fill("cancel_blur");
await page.getByText("PlaygroundChat").click();
await page.getByTestId("session-selector").getByText("new name").click();
// check delete session
await page.getByRole("combobox").click();
await page.getByLabel("Delete").click();
await page.getByRole("heading", { name: "New chat" }).click();
// check new session
await page.getByTestId("input-chat-playground").click();
await page
.getByTestId("input-chat-playground")
.fill("session_after_delete");
await page.keyboard.press("Enter");
await page.getByTestId("chat-message-User-session_after_delete").click();
await expect(page.getByTestId("session-selector")).toBeVisible();
// check new chat
await page.getByTestId("new-chat").click();
await page.waitForTimeout(5000);
await page.getByText("New chat").click();
await page.getByTestId("input-chat-playground").click();
await page.getByTestId("input-chat-playground").fill("second session");
await page.keyboard.press("Enter");
await page.waitForTimeout(5000);
await page.getByTestId("chat-message-User-second session").click();
await page
.getByTestId("chat-message-AI-second session")
.getByText("second session")
.click();
expect(await page.getByTestId("session-selector").count()).toBe(2);
const sessionElements = await page.getByTestId("session-selector").all();
expect(sessionElements.length).toBe(2);
},
);

View file

@ -3,128 +3,135 @@ import { readFileSync } from "fs";
test.describe("save component tests", () => {
/// <reference lib="dom"/>
test("save group component tests", async ({ page }) => {
await page.goto("/");
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
test(
"save group component tests",
{ tag: ["@release", "@workspace", "@api"] },
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;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.getByTestId("blank-flow").click();
// Read your file into a buffer.
const jsonContent = readFileSync(
"tests/assets/flow_group_test.json",
"utf-8",
);
// Read your file into a buffer.
const jsonContent = readFileSync(
"tests/assets/flow_group_test.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], "flow_group_test.json", {
type: "application/json",
// 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], "flow_group_test.json", {
type: "application/json",
});
dt.items.add(file);
return dt;
}, jsonContent);
// Now dispatch
await page.dispatchEvent(
"//*[@id='react-flow-id']/div[1]/div[1]/div",
"drop",
{
dataTransfer,
},
);
const genericNoda = page.getByTestId("div-generic-node");
const elementCount = await genericNoda?.count();
if (elementCount > 0) {
expect(true).toBeTruthy();
}
await page
.locator('//*[@id="react-flow-id"]/div[1]/div[2]/button[3]')
.click();
await page.getByTestId("title-ChatOpenAI").click({
modifiers: ["Control"],
});
dt.items.add(file);
return dt;
}, jsonContent);
// Now dispatch
await page.dispatchEvent(
"//*[@id='react-flow-id']/div[1]/div[1]/div",
"drop",
{
dataTransfer,
},
);
await page.getByTestId("title-Agent Initializer").click({
modifiers: ["Control"],
});
const genericNoda = page.getByTestId("div-generic-node");
const elementCount = await genericNoda?.count();
if (elementCount > 0) {
expect(true).toBeTruthy();
}
await page.getByRole("button", { name: "Group" }).click();
await page
.locator('//*[@id="react-flow-id"]/div[1]/div[2]/button[3]')
.click();
await page
.locator('//*[@id="react-flow-id"]')
.first()
.click({ button: "left" });
await page.getByTestId("title-ChatOpenAI").click({
modifiers: ["Control"],
});
let textArea = page.getByTestId("div-textarea-description");
let elementCountText = await textArea?.count();
if (elementCountText > 0) {
expect(true).toBeTruthy();
}
await page.getByTestId("title-Agent Initializer").click({
modifiers: ["Control"],
});
let groupNode = page.getByTestId("title-Group");
let elementGroup = await groupNode?.count();
if (elementGroup > 0) {
expect(true).toBeTruthy();
}
await page.getByRole("button", { name: "Group" }).click();
await page.getByTestId("title-Group").click();
await page.getByTestId("more-options-modal").click();
await page
.locator('//*[@id="react-flow-id"]')
.first()
.click({ button: "left" });
await page.getByTestId("icon-SaveAll").click();
// timeout to handle case where there is already a saved component with the same name
await page.waitForTimeout(1000);
let textArea = page.getByTestId("div-textarea-description");
let elementCountText = await textArea?.count();
if (elementCountText > 0) {
expect(true).toBeTruthy();
}
const replaceButton = await page
.getByTestId("replace-button")
.isVisible();
let groupNode = page.getByTestId("title-Group");
let elementGroup = await groupNode?.count();
if (elementGroup > 0) {
expect(true).toBeTruthy();
}
if (replaceButton) {
await page.getByTestId("replace-button").click();
}
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("group");
await page.getByTestId("title-Group").click();
await page.getByTestId("more-options-modal").click();
await page
.getByText("Group")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
textArea = page.getByTestId("div-textarea-description");
elementCountText = await textArea?.count();
if (elementCountText > 0) {
expect(true).toBeTruthy();
}
await page.getByTestId("icon-SaveAll").click();
// timeout to handle case where there is already a saved component with the same name
await page.waitForTimeout(1000);
const replaceButton = await page.getByTestId("replace-button").isVisible();
if (replaceButton) {
await page.getByTestId("replace-button").click();
}
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("group");
await page
.getByText("Group")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
textArea = page.getByTestId("div-textarea-description");
elementCountText = await textArea?.count();
if (elementCountText > 0) {
expect(true).toBeTruthy();
}
groupNode = page.getByTestId("title-Group");
elementGroup = await groupNode?.count();
if (elementGroup > 0) {
expect(true).toBeTruthy();
}
});
groupNode = page.getByTestId("title-Group");
elementGroup = await groupNode?.count();
if (elementGroup > 0) {
expect(true).toBeTruthy();
}
},
);
});

View file

@ -2,216 +2,221 @@ import { test } from "@playwright/test";
import uaParser from "ua-parser-js";
// TODO: fix this test
test("user must be able to stop a building", async ({ page }) => {
test.skip(true, "Test is flaky");
await page.goto("/");
// await page.waitForTimeout(2000);
test(
"user must be able to stop a building",
{ tag: ["@release", "@workspace", "@api"] },
async ({ page }) => {
test.skip(true, "Test is flaky");
await page.goto("/");
// await page.waitForTimeout(2000);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { 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);
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.getByTestId("blank-flow").click();
await page.getByTestId("blank-flow").click();
//first component
//first component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text input");
// await page.waitForTimeout(1000);
await page
.getByTestId("inputsText Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.mouse.up();
//second component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("url");
// await page.waitForTimeout(1000);
await page
.getByTestId("dataURL")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.mouse.up();
//third component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("split text");
// await page.waitForTimeout(1000);
await page
.getByTestId("processingSplit Text")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.mouse.up();
//fourth component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("parse data");
// await page.waitForTimeout(1000);
await page
.getByTestId("processingParse Data")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.mouse.up();
//fifth component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
// await page.waitForTimeout(1000);
await page
.getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.mouse.up();
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text input");
// await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page
.getByTestId("inputsText Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
//connection 1
const urlOutput = await page
.getByTestId("handle-url-shownode-data-right")
.nth(0);
await urlOutput.hover();
await page.mouse.down();
const splitTextInputData = await page.getByTestId(
"handle-splittext-shownode-data inputs-left",
);
await splitTextInputData.hover();
await page.mouse.up();
await page.mouse.up();
//connection 2
const textOutput = await page
.getByTestId("handle-textinput-shownode-text-right")
.nth(0);
await textOutput.hover();
await page.mouse.down();
const splitTextInput = await page.getByTestId(
"handle-splittext-shownode-separator-left",
);
await splitTextInput.hover();
await page.mouse.up();
//second component
await page.getByTestId("fit_view").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("url");
// await page.waitForTimeout(1000);
//connection 3
const splitTextOutput = await page
.getByTestId("handle-splittext-shownode-chunks-right")
.nth(0);
await splitTextOutput.hover();
await page.mouse.down();
const parseDataInput = await page.getByTestId(
"handle-parsedata-shownode-data-left",
);
await parseDataInput.hover();
await page.mouse.up();
await page
.getByTestId("dataURL")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
//connection 4
const parseDataOutput = await page
.getByTestId("handle-parsedata-shownode-text-right")
.nth(0);
await parseDataOutput.hover();
await page.mouse.down();
const chatOutputInput = await page.getByTestId(
"handle-chatoutput-shownode-text-left",
);
await chatOutputInput.hover();
await page.mouse.up();
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.getByTestId("fit_view").click();
await page.mouse.up();
await page.getByTestId("textarea_str_input_value").first().fill(",");
//third component
await page
.getByTestId("inputlist_str_urls_0")
.fill("https://www.nature.com/articles/d41586-023-02870-5");
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("split text");
// await page.waitForTimeout(1000);
await page.getByTestId("int_int_chunk_size").fill("2");
await page.getByTestId("int_int_chunk_overlap").fill("1");
await page
.getByTestId("processingSplit Text")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
const timerCode = `
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.mouse.up();
//fourth component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("parse data");
// await page.waitForTimeout(1000);
await page
.getByTestId("processingParse Data")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.mouse.up();
//fifth component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
// await page.waitForTimeout(1000);
await page
.getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-800, 300);
});
await page.mouse.up();
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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.getByTestId("fit_view").click();
//connection 1
const urlOutput = await page
.getByTestId("handle-url-shownode-data-right")
.nth(0);
await urlOutput.hover();
await page.mouse.down();
const splitTextInputData = await page.getByTestId(
"handle-splittext-shownode-data inputs-left",
);
await splitTextInputData.hover();
await page.mouse.up();
//connection 2
const textOutput = await page
.getByTestId("handle-textinput-shownode-text-right")
.nth(0);
await textOutput.hover();
await page.mouse.down();
const splitTextInput = await page.getByTestId(
"handle-splittext-shownode-separator-left",
);
await splitTextInput.hover();
await page.mouse.up();
await page.getByTestId("fit_view").click();
//connection 3
const splitTextOutput = await page
.getByTestId("handle-splittext-shownode-chunks-right")
.nth(0);
await splitTextOutput.hover();
await page.mouse.down();
const parseDataInput = await page.getByTestId(
"handle-parsedata-shownode-data-left",
);
await parseDataInput.hover();
await page.mouse.up();
//connection 4
const parseDataOutput = await page
.getByTestId("handle-parsedata-shownode-text-right")
.nth(0);
await parseDataOutput.hover();
await page.mouse.down();
const chatOutputInput = await page.getByTestId(
"handle-chatoutput-shownode-text-left",
);
await chatOutputInput.hover();
await page.mouse.up();
await page.getByTestId("fit_view").click();
await page.getByTestId("textarea_str_input_value").first().fill(",");
await page
.getByTestId("inputlist_str_urls_0")
.fill("https://www.nature.com/articles/d41586-023-02870-5");
await page.getByTestId("int_int_chunk_size").fill("2");
await page.getByTestId("int_int_chunk_overlap").fill("1");
const timerCode = `
# from langflow.field_typing import Data
from langflow.custom import Component
from langflow.io import MessageTextInput, Output
@ -240,71 +245,72 @@ class CustomComponent(Component):
return data
`;
await page.getByTestId("sidebar-custom-component-button").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("sidebar-custom-component-button").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("title-Custom Component").first().click();
await page.getByTestId("title-Custom Component").first().click();
await page.waitForTimeout(500);
await page.getByTestId("code-button-modal").click();
await page.waitForTimeout(500);
await page.waitForTimeout(500);
await page.getByTestId("code-button-modal").click();
await page.waitForTimeout(500);
await page.locator("textarea").last().press(`ControlOrMeta+a`);
await page.keyboard.press("Backspace");
await page.locator("textarea").last().fill(timerCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(500);
await page.locator("textarea").last().press(`ControlOrMeta+a`);
await page.keyboard.press("Backspace");
await page.locator("textarea").last().fill(timerCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(500);
await page.getByTestId("button_run_custom component").click();
await page.getByTestId("button_run_custom component").click();
await page.waitForSelector("text=Building", {
timeout: 100000,
});
await page.waitForSelector("text=Building", {
timeout: 100000,
});
await page.waitForSelector('div[class*="animate-border-beam"]', {
state: "visible",
timeout: 5000,
});
await page.waitForSelector('div[class*="animate-border-beam"]', {
state: "visible",
timeout: 5000,
});
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page.waitForSelector('div[class*="animate-border-beam"]', {
state: "hidden",
timeout: 5000,
});
await page.waitForSelector('div[class*="animate-border-beam"]', {
state: "hidden",
timeout: 5000,
});
await page.waitForSelector("text=Saved", {
timeout: 100000,
});
await page.waitForSelector("text=Saved", {
timeout: 100000,
});
await page.getByTestId("button_run_custom component").click();
await page.getByTestId("button_run_custom component").click();
await page.waitForSelector("text=Building", {
timeout: 100000,
});
await page.waitForSelector("text=Building", {
timeout: 100000,
});
await page.waitForSelector('div[class*="animate-border-beam"]', {
state: "visible",
timeout: 5000,
});
await page.waitForSelector('div[class*="animate-border-beam"]', {
state: "visible",
timeout: 5000,
});
await page.waitForSelector("text=Building", {
timeout: 100000,
});
await page.waitForSelector("text=Building", {
timeout: 100000,
});
await page.waitForSelector("text=Saved", {
timeout: 100000,
});
await page.waitForSelector("text=Saved", {
timeout: 100000,
});
await page.getByTestId("button_run_custom component").click();
await page.getByTestId("button_run_custom component").click();
await page.waitForSelector('div[class*="animate-border-beam"]', {
state: "visible",
timeout: 5000,
});
await page.waitForSelector('div[class*="animate-border-beam"]', {
state: "visible",
timeout: 5000,
});
await page.waitForSelector("text=Saved", {
timeout: 100000,
});
});
await page.waitForSelector("text=Saved", {
timeout: 100000,
});
},
);

View file

@ -2,65 +2,69 @@ import { test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test.skip("should filter by tag", async ({ page }) => {
test.skip(
!process?.env?.STORE_API_KEY,
"STORE_API_KEY required to run this test",
);
test(
"should filter by tag",
{ tag: ["@release", "@api"] },
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") });
}
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.waitForTimeout(1000);
await page.goto("/");
await page.waitForTimeout(1000);
await page.getByTestId("button-store").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.getByTestId("api-key-button-store").click();
await page
.getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? "");
await page
.getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? "");
await page.getByTestId("api-key-save-button-store").click();
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("Success! Your API Key has been saved.").isVisible();
await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);
await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);
async function safeClick(selector: string) {
await page.getByTestId(selector).waitFor({ state: "visible" });
await page.getByTestId(selector).click();
await page.waitForTimeout(500); // Wait for UI updates
}
async function safeClick(selector: string) {
await page.getByTestId(selector).waitFor({ state: "visible" });
await page.getByTestId(selector).click();
await page.waitForTimeout(500); // Wait for UI updates
}
// Agent section
await safeClick("tag-selector-Agent");
await page.getByText("File Loader").waitFor({ state: "visible" });
await safeClick("tag-selector-Agent");
await page.getByText("Website Content").waitFor({ state: "visible" });
// Agent section
await safeClick("tag-selector-Agent");
await page.getByText("File Loader").waitFor({ state: "visible" });
await safeClick("tag-selector-Agent");
await page.getByText("Website Content").waitFor({ state: "visible" });
// Memory section
await safeClick("tag-selector-Memory");
await page.getByText("MP3 QA12").waitFor({ state: "visible" });
// Memory section
await safeClick("tag-selector-Memory");
await page.getByText("MP3 QA12").waitFor({ state: "visible" });
// Chain section
await safeClick("tag-selector-Chain");
await page.getByText("ChatOllama").waitFor({ state: "visible" });
await safeClick("tag-selector-Chain");
// Chain section
await safeClick("tag-selector-Chain");
await page.getByText("ChatOllama").waitFor({ state: "visible" });
await safeClick("tag-selector-Chain");
// Vector Store section
await safeClick("tag-selector-Vector Store");
await page.getByText("MP3 QA12").waitFor({ state: "visible" });
await safeClick("tag-selector-Vector Store");
await safeClick("tag-selector-Memory");
// Vector Store section
await safeClick("tag-selector-Vector Store");
await page.getByText("MP3 QA12").waitFor({ state: "visible" });
await safeClick("tag-selector-Vector Store");
await safeClick("tag-selector-Memory");
await page.getByText("Basic RAG").isVisible();
});
await page.getByText("Basic RAG").isVisible();
},
);
test("should share component with share button", async ({ page }) => {
test.skip(

View file

@ -1,65 +1,70 @@
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();
test(
"curl_api_generation",
{ tag: ["@release", "@workspace", "@api"] },
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;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.getByText("API", { exact: true }).click();
await page.getByRole("tab", { name: "cURL" }).click();
await page.getByTestId("icon-Copy").click();
const handle = await page.evaluateHandle(() =>
navigator.clipboard.readText(),
);
const clipboardContent = await handle.jsonValue();
const oldValue = clipboardContent;
expect(clipboardContent.length).toBeGreaterThan(0);
await page.getByRole("tab", { name: "Tweaks" }).click();
await page
.getByRole("heading", { name: "OpenAi" })
.locator("div")
.first()
.click();
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.getByText("API", { exact: true }).click();
await page.getByRole("tab", { name: "cURL" }).click();
await page.getByTestId("icon-Copy").click();
const handle = await page.evaluateHandle(() =>
navigator.clipboard.readText(),
);
const clipboardContent = await handle.jsonValue();
const oldValue = clipboardContent;
expect(clipboardContent.length).toBeGreaterThan(0);
await page.getByRole("tab", { name: "Tweaks" }).click();
await page
.getByRole("heading", { name: "OpenAi" })
.locator("div")
.first()
.click();
await page.waitForSelector(
'[data-testid="popover-anchor-input-openai_api_base-edit"]',
{
timeout: 1000,
},
);
await page.waitForSelector(
'[data-testid="popover-anchor-input-openai_api_base-edit"]',
{
timeout: 1000,
},
);
await page
.getByTestId("popover-anchor-input-openai_api_base-edit")
.first()
.fill("teste");
await page
.getByTestId("popover-anchor-input-openai_api_base-edit")
.first()
.fill("teste");
await page.getByRole("tab", { name: "cURL" }).click();
await page.getByTestId("icon-Copy").click();
const handle2 = await page.evaluateHandle(() =>
navigator.clipboard.readText(),
);
const clipboardContent2 = await handle2.jsonValue();
const newValue = clipboardContent2;
expect(oldValue).not.toBe(newValue);
expect(clipboardContent2.length).toBeGreaterThan(clipboardContent.length);
});
await page.getByRole("tab", { name: "cURL" }).click();
await page.getByTestId("icon-Copy").click();
const handle2 = await page.evaluateHandle(() =>
navigator.clipboard.readText(),
);
const clipboardContent2 = await handle2.jsonValue();
const newValue = clipboardContent2;
expect(oldValue).not.toBe(newValue);
expect(clipboardContent2.length).toBeGreaterThan(clipboardContent.length);
},
);
test("check if tweaks are updating when someothing on the flow changes", async ({
page,

View file

@ -2,126 +2,132 @@ import { test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("Basic Prompting (Hello, World)", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"Basic Prompting (Hello, World)",
{ tag: ["@release", "@starter-project"] },
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.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();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
await page.getByText("built successfully").last().click({
timeout: 15000,
});
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByText("Playground", { exact: true }).last().click();
await page
.getByText("No input message provided.", { exact: true })
.last()
.isVisible();
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page
.getByTestId("input-chat-playground")
.last()
.fill("Say hello as a pirate");
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
await page.getByText("Playground", { exact: true }).last().click();
await page
.getByText("No input message provided.", { exact: true })
.last()
.isVisible();
await page.getByTestId("button-send").last().click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.waitForSelector("text=matey", {
timeout: 100000,
});
await page
.getByTestId("input-chat-playground")
.last()
.fill("Say hello as a pirate");
await page.getByText("matey").last().isVisible();
await page.getByText("Default Session").last().click();
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
await page.getByText("timestamp", { exact: true }).last().isVisible();
await page.getByText("text", { exact: true }).last().isVisible();
await page.getByText("sender", { exact: true }).last().isVisible();
await page.getByText("sender_name", { exact: true }).last().isVisible();
await page.getByText("session_id", { exact: true }).last().isVisible();
await page.getByText("files", { exact: true }).last().isVisible();
await page.getByTestId("button-send").last().click();
await page.getByRole("gridcell").last().isVisible();
await page.getByRole("combobox").click();
await page.getByLabel("Delete").click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.waitForSelector("text=matey", {
timeout: 100000,
});
await page.getByTestId("input-chat-playground").last().isVisible();
});
await page.getByText("matey").last().isVisible();
await page.getByText("Default Session").last().click();
await page.getByText("timestamp", { exact: true }).last().isVisible();
await page.getByText("text", { exact: true }).last().isVisible();
await page.getByText("sender", { exact: true }).last().isVisible();
await page.getByText("sender_name", { exact: true }).last().isVisible();
await page.getByText("session_id", { exact: true }).last().isVisible();
await page.getByText("files", { exact: true }).last().isVisible();
await page.getByRole("gridcell").last().isVisible();
await page.getByRole("combobox").click();
await page.getByLabel("Delete").click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByTestId("input-chat-playground").last().isVisible();
},
);

View file

@ -1,113 +1,119 @@
import { expect, test } from "@playwright/test";
import { test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("Blog Writer", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"Blog Writer",
{ tag: ["@release", "@starter-project"] },
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.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();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Blog Writer" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 5000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Blog Writer" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 5000,
});
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page
.getByTestId("inputlist_str_urls_0")
.nth(0)
.fill(
"https://www.natgeokids.com/uk/discover/animals/sea-life/turtle-facts/",
);
await page
.getByTestId("inputlist_str_urls_1")
.nth(0)
.fill("https://www.originaldiving.com/blog/top-ten-turtle-facts");
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
await page
.getByTestId("textarea_str_input_value")
.fill(
"Use the references above for style to write a new blog/tutorial about turtles. Suggest non-covered topics.",
);
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("button_run_chat output").click();
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page
.getByTestId("inputlist_str_urls_0")
.nth(0)
.fill(
"https://www.natgeokids.com/uk/discover/animals/sea-life/turtle-facts/",
);
await page
.getByTestId("inputlist_str_urls_1")
.nth(0)
.fill("https://www.originaldiving.com/blog/top-ten-turtle-facts");
await page.getByText("built successfully").last().click({
timeout: 30000,
});
await page
.getByTestId("textarea_str_input_value")
.fill(
"Use the references above for style to write a new blog/tutorial about turtles. Suggest non-covered topics.",
);
await page.getByText("Playground", { exact: true }).last().click();
await page
.getByPlaceholder(
"No chat input variables found. Click to run your flow.",
{ exact: true },
)
.last()
.isVisible();
await page.getByTestId("button_run_chat output").click();
await page.getByText("turtles").last().isVisible();
await page.getByText("sea").last().isVisible();
await page.getByText("survival").last().isVisible();
});
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("built successfully").last().click({
timeout: 30000,
});
await page.getByText("Playground", { exact: true }).last().click();
await page
.getByPlaceholder(
"No chat input variables found. Click to run your flow.",
{ exact: true },
)
.last()
.isVisible();
await page.getByText("turtles").last().isVisible();
await page.getByText("sea").last().isVisible();
await page.getByText("survival").last().isVisible();
},
);

View file

@ -2,132 +2,138 @@ import { test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("Document Q&A", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"Document Q&A",
{ tag: ["@release", "@starter-project"] },
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.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();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
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 Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Document Q&A" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Document Q&A" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 3000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
const fileChooserPromise = page.waitForEvent("filechooser");
await page.getByTestId("button_upload_file").click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(
path.join(__dirname, "../../assets/test_file.txt"),
);
await page.getByText("test_file.txt").isVisible();
const fileChooserPromise = page.waitForEvent("filechooser");
await page.getByTestId("button_upload_file").click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(
path.join(__dirname, "../../assets/test_file.txt"),
);
await page.getByText("test_file.txt").isVisible();
await page.waitForSelector('[data-testid="button_run_chat output"]', {
timeout: 3000,
});
await page.waitForSelector('[data-testid="button_run_chat output"]', {
timeout: 3000,
});
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByText("Playground", { exact: true }).last().click();
await page
.getByText("No input message provided.", { exact: true })
.last()
.isVisible();
await page.getByText("Playground", { exact: true }).last().click();
await page
.getByText("No input message provided.", { exact: true })
.last()
.isVisible();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page
.getByTestId("input-chat-playground")
.last()
.fill("whats the text in the file?");
await page.getByTestId("button-send").last().click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page
.getByTestId("input-chat-playground")
.last()
.fill("whats the text in the file?");
await page.getByTestId("button-send").last().click();
await page.waitForSelector("text=this is a test file", {
timeout: 10000,
});
await page.waitForSelector("text=this is a test file", {
timeout: 10000,
});
await page.getByText("this is a test file").last().isVisible();
await page.getByText("this is a test file").last().isVisible();
await page.getByText("Default Session").last().click();
await page.getByText("Default Session").last().click();
await page.getByText("timestamp", { exact: true }).last().isVisible();
await page.getByText("text", { exact: true }).last().isVisible();
await page.getByText("sender", { exact: true }).last().isVisible();
await page.getByText("sender_name", { exact: true }).last().isVisible();
await page.getByText("session_id", { exact: true }).last().isVisible();
await page.getByText("files", { exact: true }).last().isVisible();
await page.getByText("timestamp", { exact: true }).last().isVisible();
await page.getByText("text", { exact: true }).last().isVisible();
await page.getByText("sender", { exact: true }).last().isVisible();
await page.getByText("sender_name", { exact: true }).last().isVisible();
await page.getByText("session_id", { exact: true }).last().isVisible();
await page.getByText("files", { exact: true }).last().isVisible();
await page.getByRole("gridcell").last().isVisible();
await page.getByRole("combobox").click();
await page.getByLabel("Delete").click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByRole("gridcell").last().isVisible();
await page.getByRole("combobox").click();
await page.getByLabel("Delete").click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByTestId("input-chat-playground").last().isVisible();
});
await page.getByTestId("input-chat-playground").last().isVisible();
},
);

View file

@ -2,99 +2,107 @@ import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test.skip("Dynamic Agent", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test.skip(
!process?.env?.SEARCH_API_KEY,
"SEARCH_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
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();
test.skip(
"Dynamic Agent",
{ tag: ["@release", "@starter-project"] },
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test.skip(
!process?.env?.SEARCH_API_KEY,
"SEARCH_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
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 Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Dynamic Agent" }).last().click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Dynamic Agent" }).last().click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page
.getByTestId("popover-anchor-input-api_key")
.last()
.fill(process.env.SEARCH_API_KEY ?? "");
await page.waitForTimeout(1000);
let openAiLlms = await page.getByText("OpenAI", { exact: true }).count();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
for (let i = 0; i < openAiLlms; i++) {
await page
.getByTestId("popover-anchor-input-api_key")
.nth(i)
.fill(process.env.OPENAI_API_KEY ?? "");
await page.getByTestId("zoom_in").click();
await page.getByTestId("dropdown_str_model_name").nth(i).click();
await page.getByTestId("gpt-4o-1-option").last().click();
.last()
.fill(process.env.SEARCH_API_KEY ?? "");
await page.waitForTimeout(1000);
}
await page
.getByTestId("textarea_str_input_value")
.first()
.fill("how much is an apple stock today");
await page.getByTestId("button_run_chat output").click();
let openAiLlms = await page.getByText("OpenAI", { exact: true }).count();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
for (let i = 0; i < openAiLlms; i++) {
await page
.getByTestId("popover-anchor-input-api_key")
.nth(i)
.fill(process.env.OPENAI_API_KEY ?? "");
await page.getByTestId("zoom_in").click();
await page.getByTestId("dropdown_str_model_name").nth(i).click();
await page.getByTestId("gpt-4o-1-option").last().click();
await page.waitForTimeout(1000);
}
await page
.getByTestId("textarea_str_input_value")
.first()
.fill("how much is an apple stock today");
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 60000 * 3 });
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForTimeout(1000);
expect(page.getByText("apple").last()).toBeVisible();
const textContents = await page
.getByTestId("div-chat-message")
.allTextContents();
const concatAllText = textContents.join(" ");
expect(concatAllText.toLocaleLowerCase()).toContain("apple");
expect(concatAllText.toLocaleLowerCase()).not.toContain("error");
expect(concatAllText.toLocaleLowerCase()).not.toContain("apologize");
const allTextLength = concatAllText.length;
expect(allTextLength).toBeGreaterThan(100);
});
await page.waitForSelector("text=built successfully", {
timeout: 60000 * 3,
});
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForTimeout(1000);
expect(page.getByText("apple").last()).toBeVisible();
const textContents = await page
.getByTestId("div-chat-message")
.allTextContents();
const concatAllText = textContents.join(" ");
expect(concatAllText.toLocaleLowerCase()).toContain("apple");
expect(concatAllText.toLocaleLowerCase()).not.toContain("error");
expect(concatAllText.toLocaleLowerCase()).not.toContain("apologize");
const allTextLength = concatAllText.length;
expect(allTextLength).toBeGreaterThan(100);
},
);

View file

@ -3,115 +3,121 @@ import * as dotenv from "dotenv";
import path from "path";
import uaParser from "ua-parser-js";
test.skip("Hierarchical Tasks Agent", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test.skip(
"Hierarchical Tasks Agent",
{ tag: ["@release", "@starter-project"] },
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test.skip(
!process?.env?.SEARCH_API_KEY,
"SEARCH_API_KEY required to run this test",
);
test.skip(
!process?.env?.SEARCH_API_KEY,
"SEARCH_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
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();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByTestId("side_nav_options_all-templates").click();
await page
.getByRole("heading", { name: "Hierarchical Tasks Agent" })
.first()
.click();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
await page.getByTestId("side_nav_options_all-templates").click();
await page
.getByRole("heading", { name: "Hierarchical Tasks Agent" })
.first()
.click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page
.getByTestId("popover-anchor-input-api_key")
.nth(1)
.fill(process.env.OPENAI_API_KEY ?? "");
await page
.getByTestId("popover-anchor-input-api_key")
.nth(0)
.fill(process.env.OPENAI_API_KEY ?? "");
await page.getByTestId("dropdown_str_model_name").nth(1).click();
await page.getByTestId("gpt-4o-1-option").last().click();
await page.getByTestId("dropdown_str_model_name").nth(0).click();
await page.getByTestId("gpt-4o-1-option").first().click();
await page
.getByTestId("popover-anchor-input-api_key")
.last()
.fill(process.env.SEARCH_API_KEY ?? "");
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.getByTestId("button_run_chat output").click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page
.getByTestId("popover-anchor-input-api_key")
.nth(1)
.fill(process.env.OPENAI_API_KEY ?? "");
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page
.getByTestId("popover-anchor-input-api_key")
.nth(0)
.fill(process.env.OPENAI_API_KEY ?? "");
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByTestId("dropdown_str_model_name").nth(1).click();
await page.getByTestId("gpt-4o-1-option").last().click();
await page.getByText("Playground", { exact: true }).last().click();
await page.getByTestId("dropdown_str_model_name").nth(0).click();
await page.getByTestId("gpt-4o-1-option").first().click();
expect(await page.locator(".markdown").count()).toBeGreaterThan(0);
await page
.getByTestId("popover-anchor-input-api_key")
.last()
.fill(process.env.SEARCH_API_KEY ?? "");
await page.waitForTimeout(1000);
await page.getByTestId("button_run_chat output").click();
await page.waitForTimeout(1000);
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByText("Playground", { exact: true }).last().click();
expect(await page.locator(".markdown").count()).toBeGreaterThan(0);
expect(await page.getByText("Langflow").count()).toBeGreaterThan(2);
});
expect(await page.getByText("Langflow").count()).toBeGreaterThan(2);
},
);

View file

@ -2,134 +2,140 @@ import { test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("Memory Chatbot", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"Memory Chatbot",
{ tag: ["@release", "@starter-project"] },
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.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();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Memory Chatbot" }).click();
await page.waitForTimeout(1000);
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
await page.waitForTimeout(1000);
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Memory Chatbot" }).click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.waitForTimeout(1000);
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForTimeout(1000);
await page
.getByText("No input message provided.", { exact: true })
.last()
.isVisible();
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page
.getByTestId("input-chat-playground")
.last()
.fill("Remember that I'm a lion");
await page.getByTestId("button-send").last().click();
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page
.getByText("No input message provided.", { exact: true })
.last()
.isVisible();
await page
.getByTestId("input-chat-playground")
.last()
.fill("try reproduce the sound I made in words");
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
await page
.getByTestId("input-chat-playground")
.last()
.fill("Remember that I'm a lion");
await page.getByTestId("button-send").last().click();
await page.getByTestId("button-send").last().click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.waitForSelector("text=roar", { timeout: 30000 });
await page.getByText("roar").last().isVisible();
await page.getByText("Default Session").last().click();
await page
.getByTestId("input-chat-playground")
.last()
.fill("try reproduce the sound I made in words");
await page.getByText("timestamp", { exact: true }).last().isVisible();
await page.getByText("text", { exact: true }).last().isVisible();
await page.getByText("sender", { exact: true }).last().isVisible();
await page.getByText("sender_name", { exact: true }).last().isVisible();
await page.getByText("session_id", { exact: true }).last().isVisible();
await page.getByText("files", { exact: true }).last().isVisible();
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
await page.getByRole("gridcell").last().isVisible();
await page.getByRole("combobox").click();
await page.getByLabel("Delete").click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByTestId("input-chat-playground").last().isVisible();
});
await page.getByTestId("button-send").last().click();
await page.waitForSelector("text=roar", { timeout: 30000 });
await page.getByText("roar").last().isVisible();
await page.getByText("Default Session").last().click();
await page.getByText("timestamp", { exact: true }).last().isVisible();
await page.getByText("text", { exact: true }).last().isVisible();
await page.getByText("sender", { exact: true }).last().isVisible();
await page.getByText("sender_name", { exact: true }).last().isVisible();
await page.getByText("session_id", { exact: true }).last().isVisible();
await page.getByText("files", { exact: true }).last().isVisible();
await page.getByRole("gridcell").last().isVisible();
await page.getByRole("combobox").click();
await page.getByLabel("Delete").click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByTestId("input-chat-playground").last().isVisible();
},
);

View file

@ -3,96 +3,102 @@ import * as dotenv from "dotenv";
import path from "path";
import uaParser from "ua-parser-js";
test.skip("Sequential Task Agent", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test.skip(
"Sequential Task Agent",
{ tag: ["@release", "@starter-project"] },
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.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();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByTestId("side_nav_options_all-templates").click();
await page
.getByRole("heading", { name: "Sequential Tasks Agent" })
.first()
.click();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
await page.getByTestId("side_nav_options_all-templates").click();
await page
.getByRole("heading", { name: "Sequential Tasks Agent" })
.first()
.click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").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();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.getByTestId("button_run_chat output").click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page
.getByTestId("popover-anchor-input-api_key")
.fill(process.env.OPENAI_API_KEY ?? "");
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.waitForTimeout(1000);
await page.getByText("Playground", { exact: true }).last().click();
await page.getByTestId("button_run_chat output").click();
expect(await page.locator(".markdown").count()).toBeGreaterThan(0);
await page.waitForTimeout(1000);
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByText("Playground", { exact: true }).last().click();
expect(await page.locator(".markdown").count()).toBeGreaterThan(0);
expect(await page.getByText("Agile").count()).toBeGreaterThan(0);
});
expect(await page.getByText("Agile").count()).toBeGreaterThan(0);
},
);

View file

@ -3,96 +3,103 @@ import * as dotenv from "dotenv";
import path from "path";
import uaParser from "ua-parser-js";
test("Simple Agent", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"Simple Agent",
{ tag: ["@release", "@starter-project"] },
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
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();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Simple Agent" }).first().click();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Simple Agent" }).first().click();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page
.getByTestId("popover-anchor-input-api_key")
.fill(process.env.OPENAI_API_KEY ?? "");
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
await page.getByTestId("fit_view").click();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.waitForTimeout(500);
await page
.getByTestId("popover-anchor-input-api_key")
.fill(process.env.OPENAI_API_KEY ?? "");
await page.getByTestId("button_run_chat output").last().click();
await page.getByTestId("fit_view").click();
await page.waitForSelector("text=built successfully", {
timeout: 10000 * 60 * 3,
});
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("playground-btn-flow-io").click();
await page.waitForTimeout(500);
const textContents = await page
.getByTestId("div-chat-message")
.allTextContents();
await page.getByTestId("button_run_chat output").last().click();
const concatAllText = textContents.join(" ").toLowerCase();
await page.waitForSelector("text=built successfully", {
timeout: 10000 * 60 * 3,
});
expect(concatAllText).toContain("hello! how can i assist you today?");
expect(concatAllText.length).toBeGreaterThan(20);
});
await page.getByTestId("playground-btn-flow-io").click();
const textContents = await page
.getByTestId("div-chat-message")
.allTextContents();
const concatAllText = textContents.join(" ").toLowerCase();
expect(concatAllText).toContain("hello! how can i assist you today?");
expect(concatAllText.length).toBeGreaterThan(20);
},
);

View file

@ -2,145 +2,151 @@ import { expect, Page, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("Travel Planning Agent", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test.skip(
!process?.env?.SEARCH_API_KEY,
"SEARCH_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
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 Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page
.getByRole("heading", { name: "Travel Planning Agents" })
.last()
.click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const randomCity = cities[Math.floor(Math.random() * cities.length)];
const randomCity2 = cities[Math.floor(Math.random() * cities.length)];
const randomFood = foods[Math.floor(Math.random() * foods.length)];
await page
.getByTestId("textarea_str_input_value")
.first()
.fill(
`Create a travel plan from ${randomCity} to ${randomCity2} with ${randomFood}`,
test(
"Travel Planning Agent",
{ tag: ["@release", "@starter-project"] },
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
let openAiLlms = await page.getByText("OpenAI", { exact: true }).count();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
test.skip(
!process?.env?.SEARCH_API_KEY,
"SEARCH_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
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 Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page
.getByRole("heading", { name: "Travel Planning Agents" })
.last()
.click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const randomCity = cities[Math.floor(Math.random() * cities.length)];
const randomCity2 = cities[Math.floor(Math.random() * cities.length)];
const randomFood = foods[Math.floor(Math.random() * foods.length)];
await page
.getByTestId("textarea_str_input_value")
.first()
.fill(
`Create a travel plan from ${randomCity} to ${randomCity2} with ${randomFood}`,
);
let openAiLlms = await page.getByText("OpenAI", { exact: true }).count();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
for (let i = 0; i < openAiLlms; i++) {
await page
.getByTestId("popover-anchor-input-api_key")
.nth(i + 1)
.fill(process.env.OPENAI_API_KEY ?? "");
await page.getByTestId("zoom_in").click();
await page.getByTestId("dropdown_str_model_name").nth(i).click();
await page.getByTestId("gpt-4o-1-option").last().click();
await page.waitForTimeout(1000);
}
for (let i = 0; i < openAiLlms; i++) {
await page
.getByTestId("popover-anchor-input-api_key")
.nth(i + 1)
.fill(process.env.OPENAI_API_KEY ?? "");
await page.getByTestId("zoom_in").click();
await page.getByTestId("dropdown_str_model_name").nth(i).click();
await page.getByTestId("gpt-4o-1-option").last().click();
.first()
.fill(process.env.SEARCH_API_KEY ?? "");
await page.waitForTimeout(1000);
}
await page
.getByTestId("popover-anchor-input-api_key")
.first()
.fill(process.env.SEARCH_API_KEY ?? "");
await page.getByTestId("button_run_chat output").click();
await page.waitForTimeout(1000);
await page.getByTestId("button_run_chat output").last().click();
await page.getByTestId("button_run_chat output").click();
if (await checkRateLimit(page)) {
console.log("Rate limit detected, skipping test");
test.skip();
}
await page.getByTestId("button_run_chat output").last().click();
await page.waitForSelector("text=built successfully", {
timeout: 60000 * 3,
});
if (await checkRateLimit(page)) {
console.log("Rate limit detected, skipping test");
test.skip();
}
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.waitForSelector("text=built successfully", {
timeout: 60000 * 3,
});
await page.getByText("Playground", { exact: true }).last().click();
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.waitForSelector("text=default session", {
timeout: 30000,
});
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForTimeout(1000);
await page.waitForSelector("text=default session", {
timeout: 30000,
});
const output = await page.getByTestId("div-chat-message").allTextContents();
const outputText = output.join("\n");
await page.waitForTimeout(1000);
expect(outputText.toLowerCase()).toContain("weather");
expect(outputText.toLowerCase()).toContain("budget");
const output = await page.getByTestId("div-chat-message").allTextContents();
const outputText = output.join("\n");
expect(outputText.toLowerCase()).toContain("weather");
expect(outputText.toLowerCase()).toContain("budget");
expect(outputText.toLowerCase()).toContain(randomCity.toLowerCase());
expect(outputText.toLowerCase()).toContain(randomCity2.toLowerCase());
expect(outputText.toLowerCase()).toContain(randomFood.toLowerCase());
});
expect(outputText.toLowerCase()).toContain(randomCity.toLowerCase());
expect(outputText.toLowerCase()).toContain(randomCity2.toLowerCase());
expect(outputText.toLowerCase()).toContain(randomFood.toLowerCase());
},
);
async function checkRateLimit(page: Page): Promise<boolean> {
try {

View file

@ -2,181 +2,196 @@ import { Page, test } from "@playwright/test";
import path from "path";
import uaParser from "ua-parser-js";
test("Vector Store RAG", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test.skip(
!process?.env?.ASTRA_DB_API_ENDPOINT,
"ASTRA_DB_API_ENDPOINT required to run this test",
);
test.skip(
!process?.env?.ASTRA_DB_APPLICATION_TOKEN,
"ASTRA_DB_APPLICATION_TOKEN required to run this test",
);
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 Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Vector Store RAG" }).first().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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
if (process?.env?.ASTRA_DB_API_ENDPOINT?.includes("astra-dev")) {
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.getByTestId("title-Astra DB").first().click();
await page.waitForTimeout(500);
await page.getByTestId("code-button-modal").click();
await page.waitForTimeout(500);
let cleanCode = await extractAndCleanCode(page);
cleanCode = cleanCode!.replace(
'"pre_delete_collection": self.pre_delete_collection or False,',
'"pre_delete_collection": self.pre_delete_collection or False,\n "environment": "dev",',
test(
"Vector Store RAG",
{ tag: ["@release", "@starter-project"] },
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
await page.locator("textarea").last().press(`ControlOrMeta+a`);
await page.keyboard.press("Backspace");
await page.locator("textarea").last().fill(cleanCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(500);
await page.getByTestId("title-Astra DB").last().click();
await page.waitForTimeout(500);
await page.getByTestId("code-button-modal").click();
await page.waitForTimeout(500);
await page.locator("textarea").last().press(`ControlOrMeta+a`);
await page.keyboard.press("Backspace");
await page.locator("textarea").last().fill(cleanCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(500);
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page
.getByTestId("popover-anchor-input-api_key") // input ID without "anchor-"
.nth(0)
.fill(process.env.OPENAI_API_KEY ?? "");
await page
.getByTestId("popover-anchor-input-openai_api_key")
.nth(1)
.fill(process.env.OPENAI_API_KEY ?? "");
await page
.getByTestId("popover-anchor-input-openai_api_key")
.nth(0)
.fill(process.env.OPENAI_API_KEY ?? "");
// Astra DB tokens
await page
.getByTestId("popover-anchor-input-token")
.nth(0)
.fill(process.env.ASTRA_DB_APPLICATION_TOKEN ?? "");
await page
.getByTestId("popover-anchor-input-token")
.nth(1)
.fill(process.env.ASTRA_DB_APPLICATION_TOKEN ?? "");
// Astra DB endpoints
await page
.getByTestId("popover-anchor-input-api_endpoint")
.nth(0)
.fill(process.env.ASTRA_DB_API_ENDPOINT ?? "");
await page
.getByTestId("popover-anchor-input-api_endpoint")
.nth(1)
.fill(process.env.ASTRA_DB_API_ENDPOINT ?? "");
test.skip(
!process?.env?.ASTRA_DB_API_ENDPOINT,
"ASTRA_DB_API_ENDPOINT required to run this test",
);
test.skip(
!process?.env?.ASTRA_DB_APPLICATION_TOKEN,
"ASTRA_DB_APPLICATION_TOKEN required to run this test",
);
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 Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page
.getByRole("heading", { name: "Vector Store RAG" })
.first()
.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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
if (process?.env?.ASTRA_DB_API_ENDPOINT?.includes("astra-dev")) {
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.getByTestId("title-Astra DB").first().click();
await page.waitForTimeout(500);
await page.getByTestId("code-button-modal").click();
await page.waitForTimeout(500);
let cleanCode = await extractAndCleanCode(page);
cleanCode = cleanCode!.replace(
'"pre_delete_collection": self.pre_delete_collection or False,',
'"pre_delete_collection": self.pre_delete_collection or False,\n "environment": "dev",',
);
await page.locator("textarea").last().press(`ControlOrMeta+a`);
await page.keyboard.press("Backspace");
await page.locator("textarea").last().fill(cleanCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(500);
await page.getByTestId("title-Astra DB").last().click();
await page.waitForTimeout(500);
await page.getByTestId("code-button-modal").click();
await page.waitForTimeout(500);
await page.locator("textarea").last().press(`ControlOrMeta+a`);
await page.keyboard.press("Backspace");
await page.locator("textarea").last().fill(cleanCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(500);
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page
.getByTestId("popover-anchor-input-api_key") // input ID without "anchor-"
.nth(0)
.fill(process.env.OPENAI_API_KEY ?? "");
await page
.getByTestId("popover-anchor-input-openai_api_key")
.nth(1)
.fill(process.env.OPENAI_API_KEY ?? "");
await page
.getByTestId("popover-anchor-input-openai_api_key")
.nth(0)
.fill(process.env.OPENAI_API_KEY ?? "");
// Astra DB tokens
await page
.getByTestId("popover-anchor-input-token")
.nth(0)
.fill(process.env.ASTRA_DB_APPLICATION_TOKEN ?? "");
await page
.getByTestId("popover-anchor-input-token")
.nth(1)
.fill(process.env.ASTRA_DB_APPLICATION_TOKEN ?? "");
// Astra DB endpoints
await page
.getByTestId("popover-anchor-input-api_endpoint")
.nth(0)
.fill(process.env.ASTRA_DB_API_ENDPOINT ?? "");
await page
.getByTestId("popover-anchor-input-api_endpoint")
.nth(1)
.fill(process.env.ASTRA_DB_API_ENDPOINT ?? "");
await page
.getByTestId("popover-anchor-input-collection_name")
.nth(0)
.fill("test");
const fileChooserPromise = page.waitForEvent("filechooser");
await page.getByTestId("icon-Upload").last().click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(
path.join(__dirname, "../../assets/test_file.txt"),
);
await page.getByText("test_file.txt").isVisible();
await page.waitForTimeout(1000);
await page.getByTestId("button_run_astra db").last().click();
await page.waitForSelector("text=built successfully", { timeout: 60000 * 2 });
await page.getByText("built successfully").last().click({
timeout: 30000,
});
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 60000 * 2 });
await page.getByText("built successfully").last().click({
timeout: 30000,
});
await page.getByTestId("button_run_astra db").first().click();
await page.waitForSelector("text=built successfully", { timeout: 60000 * 2 });
await page.getByText("built successfully").last().click({
timeout: 30000,
});
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByTestId("input-chat-playground").last().fill("hello");
await page.getByTestId("input-chat-playground").last().click();
await page.keyboard.press("Enter");
await page
.getByTestId("popover-anchor-input-collection_name")
.nth(0)
.fill("test");
const fileChooserPromise = page.waitForEvent("filechooser");
await page.getByTestId("icon-Upload").last().click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(
path.join(__dirname, "../../assets/test_file.txt"),
);
await page.getByText("test_file.txt").isVisible();
await page.waitForTimeout(1000);
await page.getByTestId("button_run_astra db").last().click();
await page.waitForSelector("text=built successfully", {
timeout: 60000 * 2,
});
await page.getByText("built successfully").last().click({
timeout: 30000,
});
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", {
timeout: 60000 * 2,
});
await page.getByText("built successfully").last().click({
timeout: 30000,
});
await page.getByTestId("button_run_astra db").first().click();
await page.waitForSelector("text=built successfully", {
timeout: 60000 * 2,
});
await page.getByText("built successfully").last().click({
timeout: 30000,
});
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByTestId("input-chat-playground").last().fill("hello");
await page.getByTestId("input-chat-playground").last().click();
await page.keyboard.press("Enter");
await page
.getByText("This is a test file.", { exact: true })
.last()
.isVisible();
await page.getByText("Chat", { exact: true }).last().click();
await page.getByText("Default Session").last().click();
await page.getByRole("combobox").click();
await page.getByLabel("Message logs").click();
await page.getByText("timestamp", { exact: true }).last().isVisible();
await page.getByText("text", { exact: true }).last().isVisible();
await page.getByText("sender", { exact: true }).last().isVisible();
await page.getByText("sender_name", { exact: true }).last().isVisible();
await page.getByText("session_id", { exact: true }).last().isVisible();
await page.getByText("files", { exact: true }).last().isVisible();
await page.getByRole("gridcell").last().isVisible();
await page.getByRole("combobox").click();
await page.getByLabel("Delete").click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByTestId("input-chat-playground").last().isVisible();
});
await page
.getByText("This is a test file.", { exact: true })
.last()
.isVisible();
await page.getByText("Chat", { exact: true }).last().click();
await page.getByText("Default Session").last().click();
await page.getByRole("combobox").click();
await page.getByLabel("Message logs").click();
await page.getByText("timestamp", { exact: true }).last().isVisible();
await page.getByText("text", { exact: true }).last().isVisible();
await page.getByText("sender", { exact: true }).last().isVisible();
await page.getByText("sender_name", { exact: true }).last().isVisible();
await page.getByText("session_id", { exact: true }).last().isVisible();
await page.getByText("files", { exact: true }).last().isVisible();
await page.getByRole("gridcell").last().isVisible();
await page.getByRole("combobox").click();
await page.getByLabel("Delete").click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByTestId("input-chat-playground").last().isVisible();
},
);
async function extractAndCleanCode(page: Page): Promise<string> {
const outerHTML = await page

View file

@ -8,225 +8,237 @@ async function zoomOut(page: Page, times: number = 4) {
}
}
test("should create a flow with decision", 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.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();
test(
"should create a flow with decision",
{ tag: ["@release", "@components"] },
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") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
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('[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 Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 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.getByTestId("sidebar-options-trigger").click();
await page.getByTestId("sidebar-legacy-switch").isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await page.getByTestId("sidebar-options-trigger").click();
await page
.getByTestId("sidebar-legacy-switch")
.isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
//---------------------------------- CHAT INPUT
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat input");
await page.waitForSelector('[data-testid="inputsChat Input"]', {
timeout: 500,
});
await page
.getByTestId("inputsChat Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await zoomOut(page);
//---------------------------------- CHAT INPUT
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat input");
await page.waitForSelector('[data-testid="inputsChat Input"]', {
timeout: 500,
});
await page
.getByTestId("inputsChat Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await zoomOut(page);
//---------------------------------- CREATE LIST
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("list");
await page.waitForSelector('[data-testid="helpersCreate List"]', {
timeout: 500,
});
await page
.getByTestId("helpersCreate List")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 100, y: 100 },
//---------------------------------- CREATE LIST
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("list");
await page.waitForSelector('[data-testid="helpersCreate List"]', {
timeout: 500,
});
await page
.getByTestId("helpersCreate List")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 100, y: 100 },
});
await page.getByTestId("input-list-plus-btn_texts-0").first().click();
await page.getByTestId("input-list-plus-btn_texts-0").first().click();
await page.getByTestId("input-list-plus-btn_texts-0").first().click();
await page
.getByTestId("inputlist_str_texts_0")
.first()
.fill("big news! langflow 1.0 is out");
await page
.getByTestId("inputlist_str_texts_1")
.first()
.fill("uhul that movie was awesome");
await page.getByTestId("inputlist_str_texts_2").first().fill("love you babe");
await page
.getByTestId("helpersCreate List")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 300, y: 300 },
await page.getByTestId("input-list-plus-btn_texts-0").first().click();
await page.getByTestId("input-list-plus-btn_texts-0").first().click();
await page.getByTestId("input-list-plus-btn_texts-0").first().click();
await page
.getByTestId("inputlist_str_texts_0")
.first()
.fill("big news! langflow 1.0 is out");
await page
.getByTestId("inputlist_str_texts_1")
.first()
.fill("uhul that movie was awesome");
await page
.getByTestId("inputlist_str_texts_2")
.first()
.fill("love you babe");
await page
.getByTestId("helpersCreate List")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 300, y: 300 },
});
await page.getByTestId("input-list-plus-btn_texts-0").last().click();
await page.getByTestId("input-list-plus-btn_texts-0").last().click();
await page.getByTestId("input-list-plus-btn_texts-0").last().click();
await page
.getByTestId("inputlist_str_texts_0")
.last()
.fill("oh my cat died");
await page
.getByTestId("inputlist_str_texts_1")
.last()
.fill("No one loves me");
await page.getByTestId("inputlist_str_texts_2").last().fill("not cool..");
//---------------------------------- PARSE DATA
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("parse data");
await page.waitForSelector('[data-testid="processingParse Data"]', {
timeout: 500,
});
await page.getByTestId("input-list-plus-btn_texts-0").last().click();
await page.getByTestId("input-list-plus-btn_texts-0").last().click();
await page.getByTestId("input-list-plus-btn_texts-0").last().click();
await page.getByTestId("inputlist_str_texts_0").last().fill("oh my cat died");
await page
.getByTestId("inputlist_str_texts_1")
.last()
.fill("No one loves me");
await page.getByTestId("inputlist_str_texts_2").last().fill("not cool..");
//---------------------------------- PARSE DATA
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("parse data");
await page.waitForSelector('[data-testid="processingParse Data"]', {
timeout: 500,
});
await page
.getByTestId("processingParse Data")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 350, y: 100 },
});
await zoomOut(page, 1);
await page
.getByTestId("processingParse Data")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 50, y: 300 },
});
await zoomOut(page, 2);
await page
.getByTestId("processingParse Data")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 350, y: 100 },
});
await zoomOut(page, 1);
await page
.getByTestId("processingParse Data")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 50, y: 300 },
});
await zoomOut(page, 2);
//---------------------------------- PASS
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("pass");
await page.waitForSelector('[data-testid="logicPass"]', {
timeout: 500,
});
await page
.getByTestId("logicPass")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 400, y: 100 },
//---------------------------------- PASS
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("pass");
await page.waitForSelector('[data-testid="logicPass"]', {
timeout: 500,
});
await page.waitForSelector('[data-testid="logicPass"]', {
timeout: 500,
});
//---------------------------------- PASS
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("pass");
await page.waitForSelector('[data-testid="logicPass"]', {
timeout: 500,
});
await page
.getByTestId("logicPass")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 600, y: 200 },
await page
.getByTestId("logicPass")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 400, y: 100 },
});
await page.waitForSelector('[data-testid="logicPass"]', {
timeout: 500,
});
await page.waitForSelector('[data-testid="logicPass"]', {
timeout: 500,
});
//---------------------------------- PASS
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("pass");
await page.waitForSelector('[data-testid="logicPass"]', {
timeout: 500,
});
await page
.getByTestId("logicPass")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 650, y: 350 },
//---------------------------------- PASS
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("pass");
await page.waitForSelector('[data-testid="logicPass"]', {
timeout: 500,
});
await page.waitForSelector('[data-testid="logicPass"]', {
timeout: 500,
});
zoomOut(page, 2);
//---------------------------------- PROMPT
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("prompt");
await page.waitForSelector('[data-testid="promptsPrompt"]', {
timeout: 500,
});
await page
.getByTestId("promptsPrompt")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 50, y: 150 },
await page
.getByTestId("logicPass")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 600, y: 200 },
});
await page.waitForSelector('[data-testid="logicPass"]', {
timeout: 500,
});
//---------------------------------- PASS
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("pass");
await page.waitForSelector('[data-testid="logicPass"]', {
timeout: 500,
});
await page
.getByTestId("logicPass")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 650, y: 350 },
});
await page.waitForSelector('[data-testid="logicPass"]', {
timeout: 500,
});
zoomOut(page, 2);
//---------------------------------- PROMPT
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("prompt");
await page.waitForSelector('[data-testid="promptsPrompt"]', {
timeout: 500,
});
await page
.getByTestId("promptsPrompt")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 50, y: 150 },
});
//---------------------------------- OPENAI
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await page.waitForSelector('[data-testid="modelsOpenAI"]', {
timeout: 500,
});
await page
.getByTestId("modelsOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 50, y: 300 },
//---------------------------------- OPENAI
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await page.waitForSelector('[data-testid="modelsOpenAI"]', {
timeout: 500,
});
await page
.getByTestId("modelsOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 50, y: 300 },
});
//---------------------------------- CONDITIONAL ROUTER
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("if else");
await page.waitForSelector('[data-testid="logicIf-Else"]', {
timeout: 500,
});
await page
.getByTestId("logicIf-Else")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 750, y: 150 },
//---------------------------------- CONDITIONAL ROUTER
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("if else");
await page.waitForSelector('[data-testid="logicIf-Else"]', {
timeout: 500,
});
//---------------------------------- CHAT OUTPUT
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
await page.waitForSelector('[data-testid="outputsChat Output"]', {
timeout: 500,
});
await page
.getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 100, y: 75 },
await page
.getByTestId("logicIf-Else")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 750, y: 150 },
});
//---------------------------------- CHAT OUTPUT
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
await page.waitForSelector('[data-testid="outputsChat Output"]', {
timeout: 500,
});
await page.waitForSelector('[data-testid="outputsChat Output"]', {
timeout: 500,
});
//---------------------------------- CHAT OUTPUT
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
await page.waitForSelector('[data-testid="outputsChat Output"]', {
timeout: 500,
});
await page
.getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 250, y: 75 },
await page
.getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 100, y: 75 },
});
await page.waitForSelector('[data-testid="outputsChat Output"]', {
timeout: 500,
});
await page.waitForSelector('[data-testid="outputsChat Output"]', {
timeout: 500,
});
//----------------------------------
await page.getByTestId("fit_view").click();
//---------------------------------- EDIT PROMPT
await page.getByTestId("promptarea_prompt_template").first().click();
await page.getByTestId("modal-promptarea_prompt_template").first().fill(`
//---------------------------------- CHAT OUTPUT
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
await page.waitForSelector('[data-testid="outputsChat Output"]', {
timeout: 500,
});
await page
.getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 250, y: 75 },
});
await page.waitForSelector('[data-testid="outputsChat Output"]', {
timeout: 500,
});
//----------------------------------
await page.getByTestId("fit_view").click();
//---------------------------------- EDIT PROMPT
await page.getByTestId("promptarea_prompt_template").first().click();
await page.getByTestId("modal-promptarea_prompt_template").first().fill(`
{Condition}
Answer with either TRUE or FALSE (and nothing else).
TRUE Examples:
@ -236,123 +248,142 @@ test("should create a flow with decision", async ({ page }) => {
User: {user_message}
AI:
`);
await page.getByText("Check & Save").last().click();
//---------------------------------- MAKE CONNECTIONS
await page
.getByTestId("handle-createlist-shownode-data list-right")
.nth(0)
.click();
await page.getByTestId("handle-parsedata-shownode-data-left").nth(0).click();
await page
.getByTestId("handle-createlist-shownode-data list-right")
.nth(2)
.click();
await page.getByTestId("handle-parsedata-shownode-data-left").nth(1).click();
await page
.getByTestId("handle-chatinput-shownode-message-right")
.nth(0)
.click();
await page
.getByTestId("handle-pass-shownode-input message-left")
.nth(2)
.click();
await page.getByTestId("handle-parsedata-shownode-text-right").nth(0).click();
//quebrando aqui
await page
.getByTestId("handle-prompt-shownode-true_examples-left")
.nth(0)
.click();
await page.getByTestId("handle-parsedata-shownode-text-right").nth(2).click();
await page
.getByTestId("handle-prompt-shownode-false_examples-left")
.nth(0)
.click();
await page
.getByTestId("handle-pass-shownode-output message-right")
.nth(4)
.click();
await page
.getByTestId("handle-prompt-shownode-user_message-left")
.nth(0)
.click();
await page
.getByTestId("handle-prompt-shownode-prompt message-right")
.first()
.click();
await page
.getByTestId("handle-openaimodel-shownode-input-left")
.nth(0)
.click();
await page
.getByTestId("handle-openaimodel-shownode-text-right")
.nth(0)
.click();
await page
.getByTestId("handle-conditionalrouter-shownode-text input-left")
.nth(0)
.click();
await page.getByTestId("popover-anchor-input-match_text").fill("TRUE");
await page.getByTestId("title-Pass").nth(1).click();
await page.getByTestId("edit-button-modal").click();
await page
.getByTestId("popover-anchor-input-input_message-edit")
.nth(0)
.fill("You're Happy! 🤪");
await page.getByTestId("showignored_message").last().click();
await page.getByText("Close").last().click();
await page.getByTestId("title-Pass").nth(0).click();
await page.getByTestId("edit-button-modal").click();
await page
.getByTestId("popover-anchor-input-input_message-edit")
.nth(0)
.fill("You're Sad! 🥲");
await page.getByTestId("showignored_message").last().click();
await page.getByText("Close").last().click();
await page
.getByTestId("handle-conditionalrouter-shownode-true-right")
.nth(0)
.click();
await page
.getByTestId("handle-pass-shownode-ignored message-left")
.nth(1)
.click();
await page
.getByTestId("handle-conditionalrouter-shownode-false-right")
.nth(0)
.click();
await page
.getByTestId("handle-pass-shownode-ignored message-left")
.nth(0)
.click();
await page
.getByTestId("handle-pass-shownode-output message-right")
.nth(2)
.click();
await page.getByTestId("handle-chatoutput-shownode-text-left").nth(0).click();
await page
.getByTestId("handle-pass-shownode-output message-right")
.nth(0)
.click();
await page.getByTestId("handle-chatoutput-shownode-text-left").nth(1).click();
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("fit_view").click();
await page.getByText("Playground", { exact: true }).last().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("my dog is alive and happy!");
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
await page.getByText("Check & Save").last().click();
//---------------------------------- MAKE CONNECTIONS
await page
.getByTestId("handle-createlist-shownode-data list-right")
.nth(0)
.click();
await page
.getByTestId("handle-parsedata-shownode-data-left")
.nth(0)
.click();
await page
.getByTestId("handle-createlist-shownode-data list-right")
.nth(2)
.click();
await page
.getByTestId("handle-parsedata-shownode-data-left")
.nth(1)
.click();
await page
.getByTestId("handle-chatinput-shownode-message-right")
.nth(0)
.click();
await page
.getByTestId("handle-pass-shownode-input message-left")
.nth(2)
.click();
await page
.getByTestId("handle-parsedata-shownode-text-right")
.nth(0)
.click();
//quebrando aqui
await page
.getByTestId("handle-prompt-shownode-true_examples-left")
.nth(0)
.click();
await page
.getByTestId("handle-parsedata-shownode-text-right")
.nth(2)
.click();
await page
.getByTestId("handle-prompt-shownode-false_examples-left")
.nth(0)
.click();
await page
.getByTestId("handle-pass-shownode-output message-right")
.nth(4)
.click();
await page
.getByTestId("handle-prompt-shownode-user_message-left")
.nth(0)
.click();
await page
.getByTestId("handle-prompt-shownode-prompt message-right")
.first()
.click();
await page
.getByTestId("handle-openaimodel-shownode-input-left")
.nth(0)
.click();
await page
.getByTestId("handle-openaimodel-shownode-text-right")
.nth(0)
.click();
await page
.getByTestId("handle-conditionalrouter-shownode-text input-left")
.nth(0)
.click();
await page.getByTestId("popover-anchor-input-match_text").fill("TRUE");
await page.getByTestId("title-Pass").nth(1).click();
await page.getByTestId("edit-button-modal").click();
await page
.getByTestId("popover-anchor-input-input_message-edit")
.nth(0)
.fill("You're Happy! 🤪");
await page.getByTestId("showignored_message").last().click();
await page.getByText("Close").last().click();
await page.getByTestId("title-Pass").nth(0).click();
await page.getByTestId("edit-button-modal").click();
await page
.getByTestId("popover-anchor-input-input_message-edit")
.nth(0)
.fill("You're Sad! 🥲");
await page.getByTestId("showignored_message").last().click();
await page.getByText("Close").last().click();
await page
.getByTestId("handle-conditionalrouter-shownode-true-right")
.nth(0)
.click();
await page
.getByTestId("handle-pass-shownode-ignored message-left")
.nth(1)
.click();
await page
.getByTestId("handle-conditionalrouter-shownode-false-right")
.nth(0)
.click();
await page
.getByTestId("handle-pass-shownode-ignored message-left")
.nth(0)
.click();
await page
.getByTestId("handle-pass-shownode-output message-right")
.nth(2)
.click();
await page
.getByTestId("handle-chatoutput-shownode-text-left")
.nth(0)
.click();
await page
.getByTestId("handle-pass-shownode-output message-right")
.nth(0)
.click();
await page
.getByTestId("handle-chatoutput-shownode-text-left")
.nth(1)
.click();
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("fit_view").click();
await page.getByText("Playground", { exact: true }).last().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("my dog is alive and happy!");
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
await page.getByTestId("button-send").last().click();
});
await page.getByTestId("button-send").last().click();
},
);

View file

@ -1,336 +1,341 @@
import { expect, test } from "@playwright/test";
test("user must be able to check similarity between embedding texts", async ({
page,
}) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"user must be able to check similarity between embedding texts",
{ tag: ["@release", "@components"] },
await page.goto("/");
await page.waitForTimeout(500);
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
await page.goto("/");
await page.waitForTimeout(500);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("blank-flow").click();
await page.getByTestId("blank-flow").click();
//first component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai embedding");
await page.waitForTimeout(500);
//first component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai embedding");
await page.waitForTimeout(500);
await page
.getByText("OpenAI Embeddings", { exact: true })
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page
.getByText("OpenAI Embeddings", { exact: true })
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
await page.mouse.up();
await page.mouse.up();
await page.waitForTimeout(1000);
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text embedder");
await page.waitForTimeout(500);
await page
.getByTestId("embeddingsText Embedder")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
await page.mouse.up();
//fourth component
await page
.getByTestId("embeddingsText Embedder")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
await page.mouse.up();
//fifth component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("embedding similarity");
await page.waitForTimeout(500);
await page
.getByTestId("embeddingsEmbedding Similarity")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
await page.mouse.up();
//sisxth component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("parse data");
await page.waitForTimeout(500);
await page
.getByTestId("processingParse Data")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
await page.mouse.up();
//seventh component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text output");
await page.waitForTimeout(500);
await page
.getByTestId("outputsText Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
await page.mouse.up();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("filter data");
await page.waitForTimeout(500);
await page
.getByTestId("processingFilter Data")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
await page.mouse.up();
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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.getByTestId("fit_view").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text embedder");
await page.waitForTimeout(500);
await page
.getByTestId("textarea_str_template")
.last()
.fill("{similarity_score}");
await page
.getByTestId("embeddingsText Embedder")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page
.getByTestId("popover-anchor-input-message")
.last()
.fill("datastax");
await page
.getByTestId("popover-anchor-input-message")
.first()
.fill("langflow");
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
const firstApiKeyInput = page
.getByTestId("popover-anchor-input-openai_api_key")
.nth(0);
const secondApiKeyInput = page
.getByTestId("popover-anchor-input-openai_api_key")
.nth(1);
await page.mouse.up();
const isFirstInputVisible = await firstApiKeyInput.isVisible();
const isSecondInputVisible = await secondApiKeyInput.isVisible();
//fourth component
if (isFirstInputVisible) {
await firstApiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page
.getByTestId("embeddingsText Embedder")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
if (isSecondInputVisible) {
await secondApiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
await page
.getByTestId("inputlist_str_filter_criteria_0")
.nth(0)
.fill("similarity_score");
await page.mouse.up();
await page.getByTestId("fit_view").click();
await page.mouse.wheel(0, 500);
//fifth component
await page.locator(".react-flow__pane").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("embedding similarity");
await page.waitForTimeout(500);
await page.getByTestId("fit_view").click();
await page
.getByTestId("embeddingsEmbedding Similarity")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
//connection 1
const openAiEmbeddingOutput_0 = await page
.getByTestId("handle-openaiembeddings-shownode-embeddings-right")
.nth(0);
await openAiEmbeddingOutput_0.hover();
await page.mouse.down();
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
const textEmbedderInput_0 = await page
.getByTestId("handle-textembeddercomponent-shownode-embedding model-left")
.nth(0);
await textEmbedderInput_0.hover();
await page.mouse.up();
await page.mouse.up();
//connection 2
const openAiEmbeddingOutput_1 = await page
.getByTestId("handle-openaiembeddings-shownode-embeddings-right")
.nth(0);
await openAiEmbeddingOutput_1.hover();
await page.mouse.down();
const textEmbedderInput_1 = await page
.getByTestId("handle-textembeddercomponent-shownode-embedding model-left")
.nth(1);
await textEmbedderInput_1.hover();
await page.mouse.up();
//sisxth component
//connection 3
const textEmbedderOutput_0 = await page
.getByTestId("handle-textembeddercomponent-shownode-embedding data-right")
.nth(0);
await textEmbedderOutput_0.hover();
await page.mouse.down();
const embeddingSimilarityInput = await page
.getByTestId(
"handle-embeddingsimilaritycomponent-shownode-embedding vectors-left",
)
.nth(0);
await embeddingSimilarityInput.hover();
await page.mouse.up();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("parse data");
await page.waitForTimeout(500);
//connection 4
const textEmbedderOutput_1 = await page
.getByTestId("handle-textembeddercomponent-shownode-embedding data-right")
.nth(2);
await textEmbedderOutput_1.hover();
await page.mouse.down();
await embeddingSimilarityInput.hover();
await page.mouse.up();
await page
.getByTestId("processingParse Data")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
//connection 5
const embeddingSimilarityOutput = await page
.getByTestId(
"handle-embeddingsimilaritycomponent-shownode-similarity data-right",
)
.nth(0);
await embeddingSimilarityOutput.hover();
await page.mouse.down();
const filterDataInput = await page
.getByTestId("handle-filterdata-shownode-data-left")
.nth(0);
await filterDataInput.hover();
await page.mouse.up();
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
//connection 6
const filterDataOutput = await page
.getByTestId("handle-filterdata-shownode-filtered data-right")
.nth(0);
await filterDataOutput.hover();
await page.mouse.down();
const parseDataInput = await page
.getByTestId("handle-parsedata-shownode-data-left")
.nth(0);
await parseDataInput.hover();
await page.mouse.up();
await page.mouse.up();
//connection 7
const parseDataOutput = await page
.getByTestId("handle-parsedata-shownode-text-right")
.nth(0);
await parseDataOutput.hover();
await page.mouse.down();
const textOutputInput = await page
.getByTestId("handle-textoutput-shownode-text-left")
.nth(0);
await textOutputInput.hover();
await page.mouse.up();
//seventh component
await page.waitForTimeout(3000);
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text output");
await page.waitForTimeout(500);
await page.getByTestId("button_run_text output").click();
await page
.getByTestId("outputsText Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
await page.waitForTimeout(1000);
await page
.getByTestId(/rf__node-TextOutput-[a-zA-Z0-9]{5}/)
.getByTestId("output-inspection-text")
.first()
.click();
const valueSimilarity = await page.getByTestId("textarea").textContent();
await page.mouse.up();
expect(valueSimilarity).toContain("cosine_similarity");
const valueLength = valueSimilarity!.length;
expect(valueLength).toBeGreaterThan(20);
});
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("filter data");
await page.waitForTimeout(500);
await page
.getByTestId("processingFilter Data")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-50, 50);
});
await page.mouse.up();
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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.getByTestId("fit_view").click();
await page
.getByTestId("textarea_str_template")
.last()
.fill("{similarity_score}");
await page
.getByTestId("popover-anchor-input-message")
.last()
.fill("datastax");
await page
.getByTestId("popover-anchor-input-message")
.first()
.fill("langflow");
const firstApiKeyInput = page
.getByTestId("popover-anchor-input-openai_api_key")
.nth(0);
const secondApiKeyInput = page
.getByTestId("popover-anchor-input-openai_api_key")
.nth(1);
const isFirstInputVisible = await firstApiKeyInput.isVisible();
const isSecondInputVisible = await secondApiKeyInput.isVisible();
if (isFirstInputVisible) {
await firstApiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
if (isSecondInputVisible) {
await secondApiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page
.getByTestId("inputlist_str_filter_criteria_0")
.nth(0)
.fill("similarity_score");
await page.getByTestId("fit_view").click();
await page.mouse.wheel(0, 500);
await page.locator(".react-flow__pane").click();
await page.getByTestId("fit_view").click();
//connection 1
const openAiEmbeddingOutput_0 = await page
.getByTestId("handle-openaiembeddings-shownode-embeddings-right")
.nth(0);
await openAiEmbeddingOutput_0.hover();
await page.mouse.down();
const textEmbedderInput_0 = await page
.getByTestId("handle-textembeddercomponent-shownode-embedding model-left")
.nth(0);
await textEmbedderInput_0.hover();
await page.mouse.up();
//connection 2
const openAiEmbeddingOutput_1 = await page
.getByTestId("handle-openaiembeddings-shownode-embeddings-right")
.nth(0);
await openAiEmbeddingOutput_1.hover();
await page.mouse.down();
const textEmbedderInput_1 = await page
.getByTestId("handle-textembeddercomponent-shownode-embedding model-left")
.nth(1);
await textEmbedderInput_1.hover();
await page.mouse.up();
//connection 3
const textEmbedderOutput_0 = await page
.getByTestId("handle-textembeddercomponent-shownode-embedding data-right")
.nth(0);
await textEmbedderOutput_0.hover();
await page.mouse.down();
const embeddingSimilarityInput = await page
.getByTestId(
"handle-embeddingsimilaritycomponent-shownode-embedding vectors-left",
)
.nth(0);
await embeddingSimilarityInput.hover();
await page.mouse.up();
//connection 4
const textEmbedderOutput_1 = await page
.getByTestId("handle-textembeddercomponent-shownode-embedding data-right")
.nth(2);
await textEmbedderOutput_1.hover();
await page.mouse.down();
await embeddingSimilarityInput.hover();
await page.mouse.up();
//connection 5
const embeddingSimilarityOutput = await page
.getByTestId(
"handle-embeddingsimilaritycomponent-shownode-similarity data-right",
)
.nth(0);
await embeddingSimilarityOutput.hover();
await page.mouse.down();
const filterDataInput = await page
.getByTestId("handle-filterdata-shownode-data-left")
.nth(0);
await filterDataInput.hover();
await page.mouse.up();
//connection 6
const filterDataOutput = await page
.getByTestId("handle-filterdata-shownode-filtered data-right")
.nth(0);
await filterDataOutput.hover();
await page.mouse.down();
const parseDataInput = await page
.getByTestId("handle-parsedata-shownode-data-left")
.nth(0);
await parseDataInput.hover();
await page.mouse.up();
//connection 7
const parseDataOutput = await page
.getByTestId("handle-parsedata-shownode-text-right")
.nth(0);
await parseDataOutput.hover();
await page.mouse.down();
const textOutputInput = await page
.getByTestId("handle-textoutput-shownode-text-left")
.nth(0);
await textOutputInput.hover();
await page.mouse.up();
await page.waitForTimeout(3000);
await page.getByTestId("button_run_text output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.waitForTimeout(1000);
await page
.getByTestId(/rf__node-TextOutput-[a-zA-Z0-9]{5}/)
.getByTestId("output-inspection-text")
.first()
.click();
const valueSimilarity = await page.getByTestId("textarea").textContent();
expect(valueSimilarity).toContain("cosine_similarity");
const valueLength = valueSimilarity!.length;
expect(valueLength).toBeGreaterThan(20);
},
);

View file

@ -1,92 +1,96 @@
const { test, expect } = require("@playwright/test");
test("vector store from starter projects should have its connections and nodes on the flow", async ({
page,
request,
}) => {
const response = await request.get("/api/v1/starter-projects");
expect(response.status()).toBe(200);
const responseBody = await response.json();
test(
"vector store from starter projects should have its connections and nodes on the flow",
{ tag: ["@release", "@starter-project"] },
async ({ page, request }) => {
const response = await request.get("/api/v1/starter-projects");
expect(response.status()).toBe(200);
const responseBody = await response.json();
const astraStarterProject = responseBody.find((project) => {
if (project.data.nodes) {
return project.data.nodes.some((node) => node.id.includes("Astra"));
}
});
await page.route("**/api/v1/flows/", async (route) => {
if (route.request().method() === "GET") {
try {
const response = await route.fetch();
const flowsData = await response.json();
const modifiedFlows = flowsData.map((flow) => {
if (flow.name === "Vector Store RAG" && flow.user_id === null) {
return {
...flow,
data: astraStarterProject?.data,
};
}
return flow;
});
const modifiedResponse = JSON.stringify(modifiedFlows);
route.fulfill({
status: response.status(),
headers: response.headers(),
body: modifiedResponse,
});
} catch (error) {
console.error("Error in route handler:", error);
const astraStarterProject = responseBody.find((project) => {
if (project.data.nodes) {
return project.data.nodes.some((node) => node.id.includes("Astra"));
}
} else {
// If not a GET request, continue without modifying
await route.continue();
});
await page.route("**/api/v1/flows/", async (route) => {
if (route.request().method() === "GET") {
try {
const response = await route.fetch();
const flowsData = await response.json();
const modifiedFlows = flowsData.map((flow) => {
if (flow.name === "Vector Store RAG" && flow.user_id === null) {
return {
...flow,
data: astraStarterProject?.data,
};
}
return flow;
});
const modifiedResponse = JSON.stringify(modifiedFlows);
route.fulfill({
status: response.status(),
headers: response.headers(),
body: modifiedResponse,
});
} catch (error) {
console.error("Error in route handler:", error);
}
} else {
// If not a GET request, continue without modifying
await route.continue();
}
});
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.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();
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page
.getByRole("heading", { name: "Vector Store RAG" })
.first()
.click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Vector Store RAG" }).first().click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
const edges = await page.locator(".react-flow__edge-interaction").count();
const nodes = await page.getByTestId("div-generic-node").count();
const edges = await page.locator(".react-flow__edge-interaction").count();
const nodes = await page.getByTestId("div-generic-node").count();
const edgesFromServer = astraStarterProject?.data.edges.length;
const nodesFromServer = astraStarterProject?.data.nodes.length;
const edgesFromServer = astraStarterProject?.data.edges.length;
const nodesFromServer = astraStarterProject?.data.nodes.length;
expect(edges).toBe(edgesFromServer);
expect(nodes).toBe(nodesFromServer);
});
expect(edges).toBe(edgesFromServer);
expect(nodes).toBe(nodesFromServer);
},
);

View file

@ -2,194 +2,204 @@ import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test.skip("TextInputOutputComponent", async ({ page }) => {
// commented out because new playground does not support text io yet
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.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();
test.skip(
"TextInputOutputComponent",
{ tag: ["@release", "@components"] },
async ({ page }) => {
// commented out because new playground does not support text io yet
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") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text input");
await page.waitForTimeout(1000);
await page
.getByTestId("inputsText Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await page.waitForTimeout(1000);
await page
.getByTestId("modelsOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let visibleElementHandle;
const elementsTextInputOutput = await page
.getByTestId("handle-textinput-shownode-text-right")
.all();
for (const element of elementsTextInputOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
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 visibleElementHandle.waitFor({
state: "visible",
timeout: 30000,
});
await visibleElementHandle.hover();
await page.mouse.down();
for (const element of elementsTextInputOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
}
await visibleElementHandle.waitFor({
state: "visible",
timeout: 30000,
});
// Move to the second element
await visibleElementHandle.hover();
// Release the mouse
await page.mouse.up();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text output");
await page
.getByTestId("outputsText Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const elementsOpenAiOutput = await page
.getByTestId("handle-openaimodel-shownode-text-right")
.all();
for (const element of elementsOpenAiOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.waitFor({
state: "visible",
timeout: 30000,
});
// Click and hold on the first element
await visibleElementHandle.hover();
await page.mouse.down();
const elementTextOutputInput = await page
.getByTestId("handle-textoutput-shownode-text-left")
.all();
for (const element of elementTextOutputInput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.waitFor({
state: "visible",
timeout: 30000,
});
// Move to the second element
await visibleElementHandle.hover();
// Release the mouse
await page.mouse.up();
await page
.getByTestId(/^rf__node-TextInput-[a-zA-Z0-9]+$/)
.getByTestId("textarea_str_input_value")
.fill("This is a test!");
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text input");
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page
.getByTestId("inputsText Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.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(1000);
await page.getByText("Playground", { exact: true }).last().click();
await page.getByTestId("button_run_text_output").click();
await page
.getByTestId(/^rf__node-TextOutput-[a-zA-Z0-9]+$/)
.getByTestId("output-inspection-text")
.click();
await page.getByText("Run Flow", { exact: true }).click();
await page.waitForTimeout(5000);
let textInputContent = await page
.getByPlaceholder("Enter text...")
.textContent();
expect(textInputContent).toBe("This is a test!");
await page.getByText("Outputs", { exact: true }).nth(1).click();
await page.getByText("Text Output", { exact: true }).nth(2).click();
let contentOutput = await page.getByPlaceholder("Enter text...").inputValue();
expect(contentOutput).not.toBe(null);
await page.keyboard.press("Escape");
await page
.getByTestId(/^rf__node-TextInput-[a-zA-Z0-9]+$/)
.getByTestId("textarea_str_input_value")
.fill("This is a test, again just to be sure!");
await page.getByText("Playground", { exact: true }).last().click();
await page.getByText("Run Flow", { exact: true }).click();
await page.waitForTimeout(5000);
textInputContent = await page.getByPlaceholder("Enter text...").textContent();
expect(textInputContent).toBe("This is a test, again just to be sure!");
await page.getByText("Outputs", { exact: true }).nth(1).click();
await page.getByText("Text Output", { exact: true }).nth(2).click();
contentOutput = await page.getByPlaceholder("Enter text...").inputValue();
expect(contentOutput).not.toBe(null);
});
await page
.getByTestId("modelsOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let visibleElementHandle;
const elementsTextInputOutput = await page
.getByTestId("handle-textinput-shownode-text-right")
.all();
for (const element of elementsTextInputOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.waitFor({
state: "visible",
timeout: 30000,
});
await visibleElementHandle.hover();
await page.mouse.down();
for (const element of elementsTextInputOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.waitFor({
state: "visible",
timeout: 30000,
});
// Move to the second element
await visibleElementHandle.hover();
// Release the mouse
await page.mouse.up();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text output");
await page
.getByTestId("outputsText Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const elementsOpenAiOutput = await page
.getByTestId("handle-openaimodel-shownode-text-right")
.all();
for (const element of elementsOpenAiOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.waitFor({
state: "visible",
timeout: 30000,
});
// Click and hold on the first element
await visibleElementHandle.hover();
await page.mouse.down();
const elementTextOutputInput = await page
.getByTestId("handle-textoutput-shownode-text-left")
.all();
for (const element of elementTextOutputInput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.waitFor({
state: "visible",
timeout: 30000,
});
// Move to the second element
await visibleElementHandle.hover();
// Release the mouse
await page.mouse.up();
await page
.getByTestId(/^rf__node-TextInput-[a-zA-Z0-9]+$/)
.getByTestId("textarea_str_input_value")
.fill("This is a test!");
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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.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(1000);
await page.getByText("Playground", { exact: true }).last().click();
await page.getByTestId("button_run_text_output").click();
await page
.getByTestId(/^rf__node-TextOutput-[a-zA-Z0-9]+$/)
.getByTestId("output-inspection-text")
.click();
await page.getByText("Run Flow", { exact: true }).click();
await page.waitForTimeout(5000);
let textInputContent = await page
.getByPlaceholder("Enter text...")
.textContent();
expect(textInputContent).toBe("This is a test!");
await page.getByText("Outputs", { exact: true }).nth(1).click();
await page.getByText("Text Output", { exact: true }).nth(2).click();
let contentOutput = await page
.getByPlaceholder("Enter text...")
.inputValue();
expect(contentOutput).not.toBe(null);
await page.keyboard.press("Escape");
await page
.getByTestId(/^rf__node-TextInput-[a-zA-Z0-9]+$/)
.getByTestId("textarea_str_input_value")
.fill("This is a test, again just to be sure!");
await page.getByText("Playground", { exact: true }).last().click();
await page.getByText("Run Flow", { exact: true }).click();
await page.waitForTimeout(5000);
textInputContent = await page
.getByPlaceholder("Enter text...")
.textContent();
expect(textInputContent).toBe("This is a test, again just to be sure!");
await page.getByText("Outputs", { exact: true }).nth(1).click();
await page.getByText("Text Output", { exact: true }).nth(2).click();
contentOutput = await page.getByPlaceholder("Enter text...").inputValue();
expect(contentOutput).not.toBe(null);
},
);

View file

@ -1,132 +1,140 @@
import { expect, test } from "@playwright/test";
test.skip("should be able to move flow from folder, rename it and be displayed on correct folder", async ({
page,
}) => {
test.skip(true, "this functionality doesn't work yet w/ the uplift designs");
const randomName = Math.random().toString(36).substring(2);
const secondRandomName = Math.random().toString(36).substring(2);
test(
"should be able to move flow from folder, rename it and be displayed on correct folder",
{ tag: ["@release"] },
async ({ page }) => {
test.skip(
true,
"this functionality doesn't work yet w/ the uplift designs",
);
const randomName = Math.random().toString(36).substring(2);
const secondRandomName = Math.random().toString(36).substring(2);
await page.goto("/");
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.goto("/");
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
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();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page
.getByRole("heading", { name: "Vector Store RAG" })
.first()
.click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("flow-configuration-button").click();
await page.getByText("Flow Settings").click();
await page.getByPlaceholder("Flow name").fill(randomName);
await page.getByText("Save").last().click();
await page.getByTestId("icon-ChevronLeft").last().click();
await page.getByTestId("add-folder-button").click();
let countFolders = await page.getByText("New Folder").count();
while (countFolders > 1) {
await page.getByText("New Folder").first().hover();
await page.getByTestId("more-options-button").first().click();
await page.getByTestId("btn-delete-folder").click();
await page.getByText("Delete").last().click();
countFolders--;
await page.waitForTimeout(1000);
}
// Get the bounding boxes of the elements
const sourceElement = await page.getByTestId(`card-${randomName}`).first();
const targetElement = await page.getByText("New Folder").last();
const sourceBox = await sourceElement.boundingBox();
const targetBox = await targetElement.boundingBox();
// Perform the drag and drop
await page.mouse.move(
sourceBox!.x + sourceBox!.width / 2,
sourceBox!.y + sourceBox!.height / 2,
);
await page.mouse.down();
await page.mouse.move(
targetBox!.x + targetBox!.width / 2,
targetBox!.y + targetBox!.height / 2,
);
await page.mouse.up();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Vector Store RAG" }).first().click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByText("New Folder").last().click();
await page.getByTestId("fit_view").click();
expect(await page.getByTestId(`card-${randomName}`).first().isVisible());
await page.getByTestId("flow-configuration-button").click();
await page.getByText("Flow Settings").click();
await page.getByPlaceholder("Flow name").fill(randomName);
await page.getByText("Save").last().click();
await page.getByTestId("icon-ChevronLeft").last().click();
await page.getByTestId(`card-${randomName}`).first().click();
await page.getByTestId("add-folder-button").click();
await page.getByTestId("flow-configuration-button").click();
await page.getByText("Flow Settings").click();
await page.getByPlaceholder("Flow name").fill(secondRandomName);
await page.getByText("Save").last().click();
await page.getByTestId("icon-ChevronLeft").last().click();
let countFolders = await page.getByText("New Folder").count();
await page.waitForTimeout(3000);
while (countFolders > 1) {
await page.getByText("New Folder").first().hover();
await page.getByText("New Folder").last().click();
expect(
await page.getByTestId(`card-${secondRandomName}`).first().isVisible(),
);
await page.getByTestId("more-options-button").first().click();
await page.getByTestId("btn-delete-folder").click();
await page.getByText("Delete").last().click();
countFolders--;
await page.waitForTimeout(1000);
}
// Get the bounding boxes of the elements
const secondSourceElement = await page
.getByTestId(`card-${secondRandomName}`)
.first();
const secondTargetElement = await page.getByText("New Folder").last();
// Get the bounding boxes of the elements
const sourceElement = await page.getByTestId(`card-${randomName}`).first();
const targetElement = await page.getByText("New Folder").last();
const secondSourceBox = await secondSourceElement.boundingBox();
const secondTargetBox = await secondTargetElement.boundingBox();
const sourceBox = await sourceElement.boundingBox();
const targetBox = await targetElement.boundingBox();
// Perform the drag and drop
await page.mouse.move(
secondSourceBox!.x + secondSourceBox!.width / 2,
secondSourceBox!.y + secondSourceBox!.height / 2,
);
await page.mouse.down();
await page.mouse.move(
secondTargetBox!.x + secondTargetBox!.width / 2,
secondTargetBox!.y + secondTargetBox!.height / 2,
);
await page.mouse.up();
// Perform the drag and drop
await page.mouse.move(
sourceBox!.x + sourceBox!.width / 2,
sourceBox!.y + sourceBox!.height / 2,
);
await page.mouse.down();
await page.mouse.move(
targetBox!.x + targetBox!.width / 2,
targetBox!.y + targetBox!.height / 2,
);
await page.mouse.up();
await page.waitForTimeout(3000);
await page.waitForTimeout(3000);
await page.getByText("My Projects").last().click();
await page.getByText("New Folder").last().click();
expect(await page.getByTestId(`card-${randomName}`).first().isVisible());
await page.getByTestId(`card-${randomName}`).first().click();
await page.getByTestId("flow-configuration-button").click();
await page.getByText("Flow Settings").click();
await page.getByPlaceholder("Flow name").fill(secondRandomName);
await page.getByText("Save").last().click();
await page.getByTestId("icon-ChevronLeft").last().click();
await page.waitForTimeout(3000);
await page.getByText("New Folder").last().click();
expect(
await page.getByTestId(`card-${secondRandomName}`).first().isVisible(),
);
// Get the bounding boxes of the elements
const secondSourceElement = await page
.getByTestId(`card-${secondRandomName}`)
.first();
const secondTargetElement = await page.getByText("New Folder").last();
const secondSourceBox = await secondSourceElement.boundingBox();
const secondTargetBox = await secondTargetElement.boundingBox();
// Perform the drag and drop
await page.mouse.move(
secondSourceBox!.x + secondSourceBox!.width / 2,
secondSourceBox!.y + secondSourceBox!.height / 2,
);
await page.mouse.down();
await page.mouse.move(
secondTargetBox!.x + secondTargetBox!.width / 2,
secondTargetBox!.y + secondTargetBox!.height / 2,
);
await page.mouse.up();
await page.waitForTimeout(3000);
await page.getByText("My Projects").last().click();
expect(
await page.getByTestId(`card-${secondRandomName}`).first().isVisible(),
);
});
expect(
await page.getByTestId(`card-${secondRandomName}`).first().isVisible(),
);
},
);

View file

@ -1,342 +1,344 @@
import { expect, test } from "@playwright/test";
test("should be able to see output preview from grouped components and connect components with a single click", async ({
page,
}) => {
await page.goto("/");
test(
"should be able to see output preview from grouped components and connect components with a single click",
{ tag: ["@release", "@workspace", "@components"] },
async ({ page }) => {
await page.goto("/");
let modalCount = 0;
const randomName = Math.random().toString(36).substring(2);
const secondRandomName = Math.random().toString(36).substring(2);
const thirdRandomName = Math.random().toString(36).substring(2);
let modalCount = 0;
const randomName = Math.random().toString(36).substring(2);
const secondRandomName = Math.random().toString(36).substring(2);
const thirdRandomName = Math.random().toString(36).substring(2);
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text input");
await page.waitForTimeout(1000);
await page
.getByTestId("inputsText Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-200, 100);
await page.waitForTimeout(400);
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.mouse.up();
await page.getByTestId("blank-flow").click();
await page
.getByTestId("inputsText Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text input");
await page.waitForTimeout(1000);
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("combine text");
await page.waitForTimeout(1000);
await page
.getByTestId("inputsText Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-200, 100);
await page.waitForTimeout(400);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-200, 100);
await page.waitForTimeout(400);
});
await page.mouse.up();
await page
.getByTestId("inputsText Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("combine text");
await page.waitForTimeout(1000);
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-200, 100);
await page.waitForTimeout(400);
});
await page.mouse.up();
await page
.getByTestId("processingCombine Text")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-200, 100);
await page.waitForTimeout(400);
});
await page.mouse.up();
await page
.getByTestId("processingCombine Text")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-200, 100);
await page.waitForTimeout(200);
});
await page.mouse.up();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text output");
await page.waitForTimeout(1000);
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-200, 100);
});
await page.mouse.up();
await page
.getByTestId("outputsText Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("fit_view").click({
force: true,
});
await page.waitForTimeout(500);
//connection 1
const elementCombineTextOutput0 = await page
.getByTestId("div-handle-combinetext-shownode-combined text-right")
.nth(0);
await elementCombineTextOutput0.click();
const blockedHandle = await page
.getByTestId("div-handle-textinput-shownode-text-right")
.nth(2);
const secondBlockedHandle = await page
.getByTestId("div-handle-combinetext-shownode-combined text-right")
.nth(2);
const thirdBlockedHandle = await page
.getByTestId("div-handle-textoutput-shownode-text-right")
.nth(0);
const hasGradient = await blockedHandle?.evaluate((el) => {
const style = window.getComputedStyle(el);
return style.backgroundColor === "rgb(228, 228, 231)";
});
await page.mouse.up();
await page.waitForTimeout(500);
await page
.getByTestId("processingCombine Text")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-200, 100);
await page.waitForTimeout(400);
const secondHasGradient = await secondBlockedHandle?.evaluate((el) => {
const style = window.getComputedStyle(el);
return style.backgroundColor === "rgb(228, 228, 231)";
});
await page.mouse.up();
await page.waitForTimeout(500);
await page
.getByTestId("processingCombine Text")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-200, 100);
await page.waitForTimeout(200);
const thirdHasGradient = await thirdBlockedHandle?.evaluate((el) => {
const style = window.getComputedStyle(el);
return style.backgroundColor === "rgb(228, 228, 231)";
});
await page.mouse.up();
await page.waitForTimeout(500);
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text output");
await page.waitForTimeout(1000);
expect(hasGradient).toBe(true);
expect(secondHasGradient).toBe(true);
expect(thirdHasGradient).toBe(true);
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-200, 100);
const unlockedHandle = await page
.getByTestId("div-handle-textinput-shownode-text-left")
.last();
const secondUnlockedHandle = await page
.getByTestId("div-handle-combinetext-shownode-second text-left")
.last();
const thirdUnlockedHandle = await page
.getByTestId("div-handle-combinetext-shownode-second text-left")
.first();
const fourthUnlockedHandle = await page
.getByTestId("div-handle-textoutput-shownode-text-left")
.first();
const hasGradientUnlocked = await unlockedHandle?.evaluate((el) => {
const style = window.getComputedStyle(el);
return (
style.backgroundImage.includes("conic-gradient") &&
style.backgroundImage.includes("rgb(79, 70, 229)")
);
});
await page.mouse.up();
await page.waitForTimeout(500);
await page
.getByTestId("outputsText Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("fit_view").click({
force: true,
});
await page.waitForTimeout(500);
//connection 1
const elementCombineTextOutput0 = await page
.getByTestId("div-handle-combinetext-shownode-combined text-right")
.nth(0);
await elementCombineTextOutput0.click();
const blockedHandle = await page
.getByTestId("div-handle-textinput-shownode-text-right")
.nth(2);
const secondBlockedHandle = await page
.getByTestId("div-handle-combinetext-shownode-combined text-right")
.nth(2);
const thirdBlockedHandle = await page
.getByTestId("div-handle-textoutput-shownode-text-right")
.nth(0);
const hasGradient = await blockedHandle?.evaluate((el) => {
const style = window.getComputedStyle(el);
return style.backgroundColor === "rgb(228, 228, 231)";
});
await page.waitForTimeout(500);
const secondHasGradient = await secondBlockedHandle?.evaluate((el) => {
const style = window.getComputedStyle(el);
return style.backgroundColor === "rgb(228, 228, 231)";
});
await page.waitForTimeout(500);
const thirdHasGradient = await thirdBlockedHandle?.evaluate((el) => {
const style = window.getComputedStyle(el);
return style.backgroundColor === "rgb(228, 228, 231)";
});
await page.waitForTimeout(500);
expect(hasGradient).toBe(true);
expect(secondHasGradient).toBe(true);
expect(thirdHasGradient).toBe(true);
const unlockedHandle = await page
.getByTestId("div-handle-textinput-shownode-text-left")
.last();
const secondUnlockedHandle = await page
.getByTestId("div-handle-combinetext-shownode-second text-left")
.last();
const thirdUnlockedHandle = await page
.getByTestId("div-handle-combinetext-shownode-second text-left")
.first();
const fourthUnlockedHandle = await page
.getByTestId("div-handle-textoutput-shownode-text-left")
.first();
const hasGradientUnlocked = await unlockedHandle?.evaluate((el) => {
const style = window.getComputedStyle(el);
return (
style.backgroundImage.includes("conic-gradient") &&
style.backgroundImage.includes("rgb(79, 70, 229)")
const secondHasGradientUnlocked = await secondUnlockedHandle?.evaluate(
(el) => {
const style = window.getComputedStyle(el);
return (
style.backgroundImage.includes("conic-gradient") &&
style.backgroundImage.includes("rgb(79, 70, 229)")
);
},
);
});
await page.waitForTimeout(500);
await page.waitForTimeout(500);
const secondHasGradientUnlocked = await secondUnlockedHandle?.evaluate(
(el) => {
const thirdHasGradientLocked = await thirdUnlockedHandle?.evaluate((el) => {
const style = window.getComputedStyle(el);
return (
style.backgroundImage.includes("conic-gradient") &&
style.backgroundImage.includes("rgb(79, 70, 229)")
);
},
);
return style.backgroundColor === "rgb(228, 228, 231)";
});
await page.waitForTimeout(500);
await page.waitForTimeout(500);
const thirdHasGradientLocked = await thirdUnlockedHandle?.evaluate((el) => {
const style = window.getComputedStyle(el);
return style.backgroundColor === "rgb(228, 228, 231)";
});
const fourthHasGradientUnlocked = await fourthUnlockedHandle?.evaluate(
(el) => {
const style = window.getComputedStyle(el);
return (
style.backgroundImage.includes("conic-gradient") &&
style.backgroundImage.includes("rgb(79, 70, 229)")
);
},
);
await page.waitForTimeout(500);
await page.waitForTimeout(500);
const fourthHasGradientUnlocked = await fourthUnlockedHandle?.evaluate(
(el) => {
const style = window.getComputedStyle(el);
return (
style.backgroundImage.includes("conic-gradient") &&
style.backgroundImage.includes("rgb(79, 70, 229)")
);
},
);
expect(hasGradientUnlocked).toBe(true);
expect(secondHasGradientUnlocked).toBe(true);
expect(thirdHasGradientLocked).toBe(true);
expect(fourthHasGradientUnlocked).toBe(true);
await page.waitForTimeout(500);
const elementCombineTextInput1 = await page
.getByTestId("handle-combinetext-shownode-first text-left")
.nth(1);
await elementCombineTextInput1.click();
expect(hasGradientUnlocked).toBe(true);
expect(secondHasGradientUnlocked).toBe(true);
expect(thirdHasGradientLocked).toBe(true);
expect(fourthHasGradientUnlocked).toBe(true);
await page
.getByTestId("title-Combine Text")
.first()
.click({ modifiers: ["Control"] });
await page
.getByTestId("title-delimiter")
.last()
.click({ modifiers: ["Control"] });
const elementCombineTextInput1 = await page
.getByTestId("handle-combinetext-shownode-first text-left")
.nth(1);
await elementCombineTextInput1.click();
await page.getByRole("button", { name: "Group" }).click();
await page
.getByTestId("title-Combine Text")
.first()
.click({ modifiers: ["Control"] });
await page
.getByTestId("title-delimiter")
.last()
.click({ modifiers: ["Control"] });
await page.waitForTimeout(500);
await page.getByRole("button", { name: "Group" }).click();
await page.getByTitle("fit view").click();
await page.waitForTimeout(500);
await page.waitForTimeout(500);
await page.getByTitle("fit view").click();
//connection 2
const elementTextOutput0 = await page
.getByTestId("handle-textinput-shownode-text-right")
.nth(0);
await elementTextOutput0.click();
const elementGroupInput0 = await page.getByTestId(
"handle-groupnode-shownode-first text-left",
);
await elementGroupInput0.click();
await page.waitForTimeout(500);
//connection 3
const elementTextOutput1 = await page
.getByTestId("handle-textinput-shownode-text-right")
.nth(2);
await elementTextOutput1.click();
const elementGroupInput1 = await page
.getByTestId("handle-groupnode-shownode-second text-left")
.nth(1);
await elementGroupInput1.click();
//connection 2
const elementTextOutput0 = await page
.getByTestId("handle-textinput-shownode-text-right")
.nth(0);
await elementTextOutput0.click();
const elementGroupInput0 = await page.getByTestId(
"handle-groupnode-shownode-first text-left",
);
await elementGroupInput0.click();
//connection 4
const elementGroupOutput = await page
.getByTestId("handle-groupnode-shownode-combined text-right")
.nth(0);
await elementGroupOutput.click();
const elementTextOutputInput = await page
.getByTestId("handle-textoutput-shownode-text-left")
.nth(0);
//connection 3
const elementTextOutput1 = await page
.getByTestId("handle-textinput-shownode-text-right")
.nth(2);
await elementTextOutput1.click();
const elementGroupInput1 = await page
.getByTestId("handle-groupnode-shownode-second text-left")
.nth(1);
await elementGroupInput1.click();
await elementTextOutputInput.click();
//connection 4
const elementGroupOutput = await page
.getByTestId("handle-groupnode-shownode-combined text-right")
.nth(0);
await elementGroupOutput.click();
const elementTextOutputInput = await page
.getByTestId("handle-textoutput-shownode-text-left")
.nth(0);
await page.getByTestId("textarea_str_input_value").nth(0).fill(randomName);
await elementTextOutputInput.click();
await page.waitForTimeout(500);
await page
.getByTestId("textarea_str_input_value")
.nth(1)
.fill(secondRandomName);
await page.waitForTimeout(500);
await page.getByTestId("textarea_str_input_value").nth(0).fill(randomName);
await page
.getByPlaceholder("Type something...", { exact: true })
.nth(4)
.fill(thirdRandomName);
await page.waitForTimeout(500);
await page.waitForTimeout(500);
await page
.getByTestId("textarea_str_input_value")
.nth(1)
.fill(secondRandomName);
await page.waitForTimeout(500);
await page
.getByPlaceholder("Type something...", { exact: true })
.nth(3)
.fill("-");
await page.waitForTimeout(500);
await page
.getByPlaceholder("Type something...", { exact: true })
.nth(4)
.fill(thirdRandomName);
await page.waitForTimeout(500);
await page
.getByPlaceholder("Type something...", { exact: true })
.nth(2)
.fill("-");
await page
.getByPlaceholder("Type something...", { exact: true })
.nth(3)
.fill("-");
await page.waitForTimeout(500);
await page.waitForTimeout(500);
await page
.getByPlaceholder("Type something...", { exact: true })
.nth(2)
.fill("-");
await page.getByTestId("button_run_text output").last().click();
await page.waitForTimeout(500);
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByTestId("button_run_text output").last().click();
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.waitForTimeout(500);
await page.waitForSelector("text=built successfully", { timeout: 30000 });
expect(
await page.getByTestId("output-inspection-combined text").first(),
).not.toBeDisabled();
await page.getByTestId("output-inspection-combined text").first().click();
await page.waitForTimeout(500);
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.waitForTimeout(500);
await page.getByText("Component Output").isVisible();
expect(
await page.getByTestId("output-inspection-combined text").first(),
).not.toBeDisabled();
await page.getByTestId("output-inspection-combined text").first().click();
await page.waitForTimeout(500);
const text = await page.getByPlaceholder("Empty").textContent();
await page.getByText("Component Output").isVisible();
const permutations = [
`${randomName}-${secondRandomName}-${thirdRandomName}`,
`${randomName}-${thirdRandomName}-${secondRandomName}`,
`${thirdRandomName}-${randomName}-${secondRandomName}`,
`${thirdRandomName}-${secondRandomName}-${randomName}`,
`${secondRandomName}-${randomName}-${thirdRandomName}`,
`${secondRandomName}-${thirdRandomName}-${randomName}`,
];
const text = await page.getByPlaceholder("Empty").textContent();
const isPermutationIncluded = permutations.some((permutation) =>
text!.includes(permutation),
);
const permutations = [
`${randomName}-${secondRandomName}-${thirdRandomName}`,
`${randomName}-${thirdRandomName}-${secondRandomName}`,
`${thirdRandomName}-${randomName}-${secondRandomName}`,
`${thirdRandomName}-${secondRandomName}-${randomName}`,
`${secondRandomName}-${randomName}-${thirdRandomName}`,
`${secondRandomName}-${thirdRandomName}-${randomName}`,
];
const isPermutationIncluded = permutations.some((permutation) =>
text!.includes(permutation),
);
expect(isPermutationIncluded).toBe(true);
});
expect(isPermutationIncluded).toBe(true);
},
);

View file

@ -2,117 +2,124 @@ import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("memory should work as expect", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"memory should work as expect",
{ tag: ["@release"] },
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();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.goto("/");
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForTimeout(1000);
await page.getByTestId("fit_view").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("message history");
await page.getByTestId("sidebar-options-trigger").click();
await page.getByTestId("sidebar-legacy-switch").isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
// Locate the canvas element
const canvas = page.locator("#react-flow-id"); // Update the selector if needed
// Get the bounding box of the canvas to determine its position
const canvasBox = await canvas.boundingBox();
if (!canvasBox) {
throw new Error("Canvas element bounding box not found");
}
// Starting point (center of the canvas)
const startX = canvasBox.x + canvasBox.width / 2;
const startY = canvasBox.y + canvasBox.height / 2;
// End point (move 600 pixels to the right)
const endX = startX + 600;
const endY = startY;
// Hover over the canvas to focus it
await canvas.hover();
// Start the drag operation
await page.mouse.move(startX, startY);
await page.mouse.down();
// Move to the new position
await page.mouse.move(endX, endY);
// Release the mouse button to finish the drag
await page.mouse.up();
await page
.getByTestId("helpersMessage History")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForTimeout;
await page.getByTestId("fit_view").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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
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 Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
await page.getByTestId("fit_view").click();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("message history");
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("sidebar-options-trigger").click();
await page
.getByTestId("sidebar-legacy-switch")
.isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
const prompt = `
// Locate the canvas element
const canvas = page.locator("#react-flow-id"); // Update the selector if needed
// Get the bounding box of the canvas to determine its position
const canvasBox = await canvas.boundingBox();
if (!canvasBox) {
throw new Error("Canvas element bounding box not found");
}
// Starting point (center of the canvas)
const startX = canvasBox.x + canvasBox.width / 2;
const startY = canvasBox.y + canvasBox.height / 2;
// End point (move 600 pixels to the right)
const endX = startX + 600;
const endY = startY;
// Hover over the canvas to focus it
await canvas.hover();
// Start the drag operation
await page.mouse.move(startX, startY);
await page.mouse.down();
// Move to the new position
await page.mouse.move(endX, endY);
// Release the mouse button to finish the drag
await page.mouse.up();
await page
.getByTestId("helpersMessage History")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForTimeout;
await page.getByTestId("fit_view").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();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
const prompt = `
{context}
User: {user_input}
@ -120,67 +127,68 @@ User: {user_input}
AI:
`;
await page.getByTestId("title-Prompt").last().click();
await page.getByTestId("button_open_prompt_modal").nth(0).click();
await page.getByTestId("title-Prompt").last().click();
await page.getByTestId("button_open_prompt_modal").nth(0).click();
await page.getByTestId("modal-promptarea_prompt_template").fill(prompt);
await page.getByText("Edit Prompt", { exact: true }).click();
await page.getByText("Check & Save").last().click();
await page.getByTestId("modal-promptarea_prompt_template").fill(prompt);
await page.getByText("Edit Prompt", { exact: true }).click();
await page.getByText("Check & Save").last().click();
await page.getByTestId("fit_view").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("fit_view").click();
//connection 1
const elementChatMemoryOutput = await page
.getByTestId("handle-memory-shownode-text-right")
.first();
await elementChatMemoryOutput.hover();
await page.mouse.down();
//connection 1
const elementChatMemoryOutput = await page
.getByTestId("handle-memory-shownode-text-right")
.first();
await elementChatMemoryOutput.hover();
await page.mouse.down();
const promptInput = await page.getByTestId(
"handle-prompt-shownode-context-left",
);
const promptInput = await page.getByTestId(
"handle-prompt-shownode-context-left",
);
await promptInput.hover();
await page.mouse.up();
await promptInput.hover();
await page.mouse.up();
await page.locator('//*[@id="react-flow-id"]').hover();
await page.locator('//*[@id="react-flow-id"]').hover();
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page.getByText("Playground", { exact: true }).last().click();
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
await page
.getByPlaceholder("Send a message...")
.fill("hi, my car is blue and I like to eat pizza");
await page
.getByPlaceholder("Send a message...")
.fill("hi, my car is blue and I like to eat pizza");
await page.getByTestId("button-send").click();
await page.getByTestId("button-send").click();
await page.waitForSelector("text=AI", { timeout: 30000 });
await page.waitForSelector("text=AI", { timeout: 30000 });
await page
.getByPlaceholder("Send a message...")
.fill("what color is my car and what do I like to eat?");
await page
.getByPlaceholder("Send a message...")
.fill("what color is my car and what do I like to eat?");
await page.getByTestId("button-send").click();
await page.getByTestId("button-send").click();
await page.waitForTimeout(400);
await page.waitForTimeout(400);
const textLocator = page.locator("text=AI");
await textLocator.nth(6).waitFor({ timeout: 30000 });
await expect(textLocator.nth(1)).toBeVisible();
const textLocator = page.locator("text=AI");
await textLocator.nth(6).waitFor({ timeout: 30000 });
await expect(textLocator.nth(1)).toBeVisible();
await page.waitForTimeout(3000);
await page.waitForTimeout(3000);
const memoryResponseText = await page
.locator(".form-modal-chat-text")
.nth(1)
.allTextContents();
const memoryResponseText = await page
.locator(".form-modal-chat-text")
.nth(1)
.allTextContents();
expect(memoryResponseText[0].includes("pizza")).toBeTruthy();
expect(memoryResponseText[0].includes("blue")).toBeTruthy();
});
expect(memoryResponseText[0].includes("pizza")).toBeTruthy();
expect(memoryResponseText[0].includes("blue")).toBeTruthy();
},
);

View file

@ -1,6 +1,6 @@
import { expect, test } from "@playwright/test";
test("chat_io_teste", async ({ page }) => {
test("chat_io_teste", { tag: ["@release", "@workspace"] }, async ({ page }) => {
await page.goto("/");
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {

View file

@ -1,64 +1,69 @@
import { test } from "@playwright/test";
test("CodeAreaModalComponent", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"CodeAreaModalComponent",
{ tag: ["@release", "@workspace"] },
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.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { 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.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("python function");
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("python function");
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page.getByTestId("sidebar-options-trigger").click();
await page.getByTestId("sidebar-legacy-switch").isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await page.getByTestId("sidebar-options-trigger").click();
await page
.getByTestId("sidebar-legacy-switch")
.isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await page.waitForTimeout(1000);
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.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("div-generic-node").click();
await page
.getByTestId("prototypesPython Function")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("code-button-modal").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 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
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
@ -68,18 +73,19 @@ class PythonFunctionComponent(CustomComponent):
"""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);
});
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);
},
);

View file

@ -1,150 +1,157 @@
import { expect, test } from "@playwright/test";
test("dropDownComponent", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"dropDownComponent",
{ tag: ["@release", "@workspace"] },
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.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("amazon");
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("amazon");
await page.waitForTimeout(1000);
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.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("title-Amazon Bedrock").click();
await page
.getByTestId("modelsAmazon Bedrock")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("title-Amazon Bedrock").click();
await page.getByTestId("dropdown_str_model_id").click();
await page.getByTestId("dropdown_str_model_id").click();
await page
.getByTestId(/anthropic\.claude-3-haiku-20240307-v1:0.*option/)
.click();
await page
.getByTestId(/anthropic\.claude-3-haiku-20240307-v1:0.*option/)
.click();
let value = await page
.getByTestId(/anthropic\.claude-3-haiku-20240307-v1:0.*option/)
.first()
.innerText();
if (value !== "anthropic.claude-3-haiku-20240307-v1:0") {
expect(false).toBeTruthy();
}
let value = await page
.getByTestId(/anthropic\.claude-3-haiku-20240307-v1:0.*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();
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();
}
value = await page.getByTestId("dropdown_str_model_id").innerText();
if (value !== "anthropic.claude-v2:1") {
expect(false).toBeTruthy();
}
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
value = await page
.getByTestId("value-dropdown-dropdown_str_edit_model_id")
.innerText();
if (value !== "anthropic.claude-v2:1") {
expect(false).toBeTruthy();
}
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(),
).toBeFalsy();
await page.locator('//*[@id="showregion_name"]').click();
expect(
await page.locator('//*[@id="showregion_name"]').isChecked(),
).toBeTruthy();
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(),
).toBeFalsy();
// showmodel_id
await page.locator('//*[@id="showmodel_id"]').click();
expect(
await page.locator('//*[@id="showmodel_id"]').isChecked(),
).toBeTruthy();
// 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(),
).toBeFalsy();
await page.locator('//*[@id="showregion_name"]').click();
expect(
await page.locator('//*[@id="showregion_name"]').isChecked(),
).toBeTruthy();
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(),
).toBeFalsy();
// showmodel_id
await page.locator('//*[@id="showmodel_id"]').click();
expect(
await page.locator('//*[@id="showmodel_id"]').isChecked(),
).toBeTruthy();
// 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();
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.command-r-plus-v1:0") {
expect(false).toBeTruthy();
}
value = await page
.getByTestId("value-dropdown-dropdown_str_edit_model_id")
.innerText();
if (value !== "cohere.command-r-plus-v1:0") {
expect(false).toBeTruthy();
}
await page.getByText("Close").last().click();
await page.getByText("Close").last().click();
value = await page
.getByTestId("value-dropdown-dropdown_str_model_id")
.innerText();
if (value !== "cohere.command-r-plus-v1:0") {
expect(false).toBeTruthy();
}
await page.getByTestId("code-button-modal").click();
await page.waitForTimeout(1000);
value = await page
.getByTestId("value-dropdown-dropdown_str_model_id")
.innerText();
if (value !== "cohere.command-r-plus-v1:0") {
expect(false).toBeTruthy();
}
await page.getByTestId("code-button-modal").click();
await page.waitForTimeout(1000);
await page.locator("textarea").press("Control+a");
const emptyOptionsCode = `from langchain_community.chat_models.bedrock import BedrockChat
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
@ -248,7 +255,10 @@ class AmazonBedrockComponent(LCModelComponent):
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();
});
await page.locator("textarea").fill(emptyOptionsCode);
await page.getByRole("button", { name: "Check & Save" }).click();
await page
.getByText("No parameters are available for display.")
.isVisible();
},
);

View file

@ -1,165 +1,171 @@
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.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"should be able to upload a file",
{
tag: ["@release", "@workspace"],
},
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.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").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.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const fileChooserPromise = page.waitForEvent("filechooser");
await page.getByTestId("button_upload_file").click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(
path.join(__dirname, "../../assets/test_file.txt"),
);
await page.getByText("test_file.txt").isVisible();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
await page
.getByTestId("outputsChat Output")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("parse data");
await page
.getByTestId("processingParse Data")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("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 page.getByTitle("fit view").click();
await visibleElementHandle.hover();
await page.mouse.down();
// Move to the second element
const chatOutputElement = await page
.getByTestId("handle-chatoutput-shownode-text-left")
.all();
for (const element of chatOutputElement) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.hover();
// Release the mouse
await page.mouse.up();
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForSelector("text=Run Flow", {
timeout: 30000,
});
await page.getByText("Run Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").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.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const fileChooserPromise = page.waitForEvent("filechooser");
await page.getByTestId("button_upload_file").click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(
path.join(__dirname, "../../assets/test_file.txt"),
);
await page.getByText("test_file.txt").isVisible();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
await page
.getByTestId("outputsChat Output")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("parse data");
await page
.getByTestId("processingParse Data")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("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 page.getByTitle("fit view").click();
await visibleElementHandle.hover();
await page.mouse.down();
// Move to the second element
const chatOutputElement = await page
.getByTestId("handle-chatoutput-shownode-text-left")
.all();
for (const element of chatOutputElement) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.hover();
// Release the mouse
await page.mouse.up();
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForSelector("text=Run Flow", {
timeout: 30000,
});
await page.getByText("Run Flow", { exact: true }).click();
await page.waitForTimeout(3000);
expect(await page.getByText("this is a test file").isVisible()).toBe(true);
});
expect(await page.getByText("this is a test file").isVisible()).toBe(true);
},
);

View file

@ -1,149 +1,157 @@
import { expect, test } from "@playwright/test";
test("FloatComponent", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"FloatComponent",
{ tag: ["@release", "@workspace"] },
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.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("ollama");
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("ollama");
await page.waitForTimeout(1000);
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.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page
.getByTestId("modelsOllama")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.waitForTimeout(1000);
await page.locator('//*[@id="float_float_temperature"]').click();
await page.locator('//*[@id="float_float_temperature"]').fill("");
await page.waitForTimeout(1000);
await page.locator('//*[@id="float_float_temperature"]').fill("3");
let value = await page
.locator('//*[@id="float_float_temperature"]')
.inputValue();
if (value != "2") {
expect(false).toBeTruthy();
}
await page.waitForTimeout(1000);
await page.locator('//*[@id="float_float_temperature"]').click();
await page.locator('//*[@id="float_float_temperature"]').fill("");
await page.waitForTimeout(1000);
await page.locator('//*[@id="float_float_temperature"]').fill("-3");
value = await page.locator('//*[@id="float_float_temperature"]').inputValue();
if (value != "-2") {
expect(false).toBeTruthy();
}
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-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_float_temperature"]');
const elementCount = await plusButtonLocator?.count();
if (elementCount === 0) {
expect(true).toBeTruthy();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-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.waitForTimeout(1000);
await page.locator('//*[@id="float_float_temperature"]').click();
await page.getByTestId("float_float_temperature").fill("");
await page.locator('//*[@id="float_float_temperature"]').fill("");
await page.waitForTimeout(1000);
await page.locator('//*[@id="float_float_temperature"]').fill("3");
let value = await page
.locator('//*[@id="float_float_temperature"]')
.inputValue();
if (value != "1") {
if (value != "2") {
expect(false).toBeTruthy();
}
await page.waitForTimeout(1000);
await page.locator('//*[@id="float_float_temperature"]').click();
await page.getByTestId("float_float_temperature").fill("");
await page.locator('//*[@id="float_float_temperature"]').fill("");
await page.waitForTimeout(1000);
await page.locator('//*[@id="float_float_temperature"]').fill("-3");
value = await page
.locator('//*[@id="float_float_temperature"]')
.inputValue();
if (value != "-1") {
if (value != "-2") {
expect(false).toBeTruthy();
}
}
});
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-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_float_temperature"]',
);
const elementCount = await plusButtonLocator?.count();
if (elementCount === 0) {
expect(true).toBeTruthy();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-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_float_temperature"]').click();
await page.getByTestId("float_float_temperature").fill("");
await page.locator('//*[@id="float_float_temperature"]').fill("3");
let value = await page
.locator('//*[@id="float_float_temperature"]')
.inputValue();
if (value != "1") {
expect(false).toBeTruthy();
}
await page.locator('//*[@id="float_float_temperature"]').click();
await page.getByTestId("float_float_temperature").fill("");
await page.locator('//*[@id="float_float_temperature"]').fill("-3");
value = await page
.locator('//*[@id="float_float_temperature"]')
.inputValue();
if (value != "-1") {
expect(false).toBeTruthy();
}
}
},
);

View file

@ -1,157 +1,169 @@
import { expect, test } from "@playwright/test";
test("InputComponent", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"InputComponent",
{ tag: ["@release", "@workspace"] },
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.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("Chroma");
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("Chroma");
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page
.getByTestId("vectorstoresChroma DB")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("popover-anchor-input-collection_name").click();
await page
.getByTestId("popover-anchor-input-collection_name")
.fill("collection_name_test_123123123!@#$&*(&%$@");
let value = await page
.getByTestId("popover-anchor-input-collection_name")
.inputValue();
if (value != "collection_name_test_123123123!@#$&*(&%$@") {
expect(false).toBeTruthy();
}
await page.getByTestId("div-generic-node").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.locator('//*[@id="showchroma_server_cors_allow_origins"]').click();
expect(
await page
.locator('//*[@id="showchroma_server_cors_allow_origins"]')
.isChecked(),
).toBeTruthy();
.getByTestId("vectorstoresChroma DB")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.locator('//*[@id="showchroma_server_grpc_port"]').click();
expect(
await page.locator('//*[@id="showchroma_server_grpc_port"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showchroma_server_host"]').click();
expect(
await page.locator('//*[@id="showchroma_server_host"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showchroma_server_http_port"]').click();
expect(
await page.locator('//*[@id="showchroma_server_http_port"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showchroma_server_ssl_enabled"]').click();
expect(
await page.locator('//*[@id="showchroma_server_ssl_enabled"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showchroma_server_cors_allow_origins"]').click();
expect(
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("popover-anchor-input-collection_name").click();
await page
.locator('//*[@id="showchroma_server_cors_allow_origins"]')
.isChecked(),
).toBeFalsy();
.getByTestId("popover-anchor-input-collection_name")
.fill("collection_name_test_123123123!@#$&*(&%$@");
await page.locator('//*[@id="showchroma_server_grpc_port"]').click();
expect(
await page.locator('//*[@id="showchroma_server_grpc_port"]').isChecked(),
).toBeFalsy();
let value = await page
.getByTestId("popover-anchor-input-collection_name")
.inputValue();
await page.locator('//*[@id="showchroma_server_host"]').click();
expect(
await page.locator('//*[@id="showchroma_server_host"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showchroma_server_http_port"]').click();
expect(
await page.locator('//*[@id="showchroma_server_http_port"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showchroma_server_ssl_enabled"]').click();
expect(
await page.locator('//*[@id="showchroma_server_ssl_enabled"]').isChecked(),
).toBeFalsy();
let valueEditNode = await page
.getByTestId("popover-anchor-input-collection_name-edit")
.inputValue();
if (valueEditNode != "collection_name_test_123123123!@#$&*(&%$@") {
expect(false).toBeTruthy();
}
await page
.getByTestId("popover-anchor-input-collection_name-edit")
.fill("NEW_collection_name_test_123123123!@#$&*(&%$@ÇÇÇÀõe");
await page.waitForTimeout(1000);
await page.getByText("Close").last().click();
const plusButtonLocator = page.getByTestId("input-collection_name");
const elementCount = await plusButtonLocator?.count();
if (elementCount === 0) {
expect(true).toBeTruthy();
if (value != "collection_name_test_123123123!@#$&*(&%$@") {
expect(false).toBeTruthy();
}
await page.getByTestId("div-generic-node").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByText("Close").last().click();
await page
.locator('//*[@id="showchroma_server_cors_allow_origins"]')
.click();
expect(
await page
.locator('//*[@id="showchroma_server_cors_allow_origins"]')
.isChecked(),
).toBeTruthy();
let value = await page
.getByTestId("popover-anchor-input-collection_name")
await page.locator('//*[@id="showchroma_server_grpc_port"]').click();
expect(
await page.locator('//*[@id="showchroma_server_grpc_port"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showchroma_server_host"]').click();
expect(
await page.locator('//*[@id="showchroma_server_host"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showchroma_server_http_port"]').click();
expect(
await page.locator('//*[@id="showchroma_server_http_port"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showchroma_server_ssl_enabled"]').click();
expect(
await page
.locator('//*[@id="showchroma_server_ssl_enabled"]')
.isChecked(),
).toBeTruthy();
await page
.locator('//*[@id="showchroma_server_cors_allow_origins"]')
.click();
expect(
await page
.locator('//*[@id="showchroma_server_cors_allow_origins"]')
.isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showchroma_server_grpc_port"]').click();
expect(
await page.locator('//*[@id="showchroma_server_grpc_port"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showchroma_server_host"]').click();
expect(
await page.locator('//*[@id="showchroma_server_host"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showchroma_server_http_port"]').click();
expect(
await page.locator('//*[@id="showchroma_server_http_port"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showchroma_server_ssl_enabled"]').click();
expect(
await page
.locator('//*[@id="showchroma_server_ssl_enabled"]')
.isChecked(),
).toBeFalsy();
let valueEditNode = await page
.getByTestId("popover-anchor-input-collection_name-edit")
.inputValue();
if (value != "NEW_collection_name_test_123123123!@#$&*(&%$@ÇÇÇÀõe") {
if (valueEditNode != "collection_name_test_123123123!@#$&*(&%$@") {
expect(false).toBeTruthy();
}
}
});
await page
.getByTestId("popover-anchor-input-collection_name-edit")
.fill("NEW_collection_name_test_123123123!@#$&*(&%$@ÇÇÇÀõe");
await page.waitForTimeout(1000);
await page.getByText("Close").last().click();
const plusButtonLocator = page.getByTestId("input-collection_name");
const elementCount = await plusButtonLocator?.count();
if (elementCount === 0) {
expect(true).toBeTruthy();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByText("Close").last().click();
let value = await page
.getByTestId("popover-anchor-input-collection_name")
.inputValue();
if (value != "NEW_collection_name_test_123123123!@#$&*(&%$@ÇÇÇÀõe") {
expect(false).toBeTruthy();
}
}
},
);

View file

@ -1,157 +1,161 @@
import { expect, test } from "@playwright/test";
test("InputListComponent", async ({ page }) => {
await page.goto("/");
await page.waitForTimeout(1000);
test(
"InputListComponent",
{ tag: ["@release", "@workspace"] },
async ({ page }) => {
await page.goto("/");
await page.waitForTimeout(1000);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("url");
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("url");
await page.waitForTimeout(1000);
await page
.getByTestId("dataURL")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.waitForTimeout(1000);
await page
.getByTestId("dataURL")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("inputlist_str_urls_0").fill("test test test test");
await page.getByTestId("inputlist_str_urls_0").fill("test test test test");
await page.getByTestId("input-list-plus-btn_urls-0").click();
await page.getByTestId("input-list-plus-btn_urls-0").click();
await page.getByTestId("input-list-plus-btn_urls-0").click();
await page.getByTestId("input-list-plus-btn_urls-0").click();
await page
.getByTestId("inputlist_str_urls_1")
.fill("test1 test1 test1 test1");
await page
.getByTestId("inputlist_str_urls_1")
.fill("test1 test1 test1 test1");
await page
.getByTestId("inputlist_str_urls_2")
.fill("test2 test2 test2 test2");
await page
.getByTestId("inputlist_str_urls_2")
.fill("test2 test2 test2 test2");
await page.getByTestId("div-generic-node").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
const value0 = await page.getByTestId("inputlist_str_urls_0").inputValue();
const value1 = await page.getByTestId("inputlist_str_urls_1").inputValue();
const value0 = await page.getByTestId("inputlist_str_urls_0").inputValue();
const value1 = await page.getByTestId("inputlist_str_urls_1").inputValue();
const value2 = await page.getByTestId("inputlist_str_urls_2").inputValue();
const value2 = await page.getByTestId("inputlist_str_urls_2").inputValue();
if (
value0 !== "test test test test" ||
value1 !== "test1 test1 test1 test1" ||
value2 !== "test2 test2 test2 test2"
) {
expect(false).toBeTruthy();
}
if (
value0 !== "test test test test" ||
value1 !== "test1 test1 test1 test1" ||
value2 !== "test2 test2 test2 test2"
) {
expect(false).toBeTruthy();
}
await page.getByTestId("input-list-minus-btn-edit_urls-1").click();
await page.getByTestId("input-list-minus-btn-edit_urls-1").click();
const plusButtonLocator = page.getByTestId(
"input-list-minus-btn-edit_urls-1",
);
const elementCount = await plusButtonLocator?.count();
const plusButtonLocator = page.getByTestId(
"input-list-minus-btn-edit_urls-1",
);
const elementCount = await plusButtonLocator?.count();
if (elementCount > 1) {
expect(false).toBeTruthy();
}
if (elementCount > 1) {
expect(false).toBeTruthy();
}
await page.getByText("Close").last().click();
await page.getByText("Close").last().click();
await page.getByTestId("input-list-minus-btn_urls-2").isHidden();
await page.getByTestId("input-list-minus-btn_urls-2").isHidden();
await page.getByTestId("input-list-plus-btn_urls-0").click();
await page.getByTestId("input-list-plus-btn_urls-0").click();
await page.getByTestId("input-list-plus-btn_urls-0").click();
await page.getByTestId("input-list-plus-btn_urls-0").click();
await page.getByTestId("inputlist_str_urls_0").fill("test test test test");
await page
.getByTestId("inputlist_str_urls_1")
.fill("test1 test1 test1 test1");
await page
.getByTestId("inputlist_str_urls_2")
.fill("test2 test2 test2 test2");
await page
.getByTestId("inputlist_str_urls_3")
.fill("test3 test3 test3 test3");
await page.getByTestId("inputlist_str_urls_0").fill("test test test test");
await page
.getByTestId("inputlist_str_urls_1")
.fill("test1 test1 test1 test1");
await page
.getByTestId("inputlist_str_urls_2")
.fill("test2 test2 test2 test2");
await page
.getByTestId("inputlist_str_urls_3")
.fill("test3 test3 test3 test3");
await page.getByTestId("div-generic-node").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
const value0Edit = await page
.getByTestId("inputlist_str_edit_urls_0")
.inputValue();
const value1Edit = await page
.getByTestId("inputlist_str_edit_urls_1")
.inputValue();
const value2Edit = await page
.getByTestId("inputlist_str_edit_urls_2")
.inputValue();
const value3Edit = await page
.getByTestId("inputlist_str_edit_urls_3")
.inputValue();
const value0Edit = await page
.getByTestId("inputlist_str_edit_urls_0")
.inputValue();
const value1Edit = await page
.getByTestId("inputlist_str_edit_urls_1")
.inputValue();
const value2Edit = await page
.getByTestId("inputlist_str_edit_urls_2")
.inputValue();
const value3Edit = await page
.getByTestId("inputlist_str_edit_urls_3")
.inputValue();
if (
value0Edit !== "test test test test" ||
value1Edit !== "test1 test1 test1 test1" ||
value2Edit !== "test2 test2 test2 test2" ||
value3Edit !== "test3 test3 test3 test3"
) {
expect(false).toBeTruthy();
}
if (
value0Edit !== "test test test test" ||
value1Edit !== "test1 test1 test1 test1" ||
value2Edit !== "test2 test2 test2 test2" ||
value3Edit !== "test3 test3 test3 test3"
) {
expect(false).toBeTruthy();
}
await page.getByTestId("input-list-minus-btn-edit_urls-1").click();
await page.getByTestId("input-list-minus-btn-edit_urls-1").click();
await page.getByTestId("input-list-minus-btn-edit_urls-1").click();
await page.getByTestId("input-list-minus-btn-edit_urls-1").click();
await page.getByTestId("input-list-minus-btn-edit_urls-1").click();
await page.getByTestId("input-list-minus-btn-edit_urls-1").click();
const plusButtonLocatorEdit0 = await page.getByTestId(
"input-list-plus-btn-edit_urls-0",
);
const elementCountEdit0 = await plusButtonLocatorEdit0?.count();
const plusButtonLocatorEdit0 = await page.getByTestId(
"input-list-plus-btn-edit_urls-0",
);
const elementCountEdit0 = await plusButtonLocatorEdit0?.count();
const plusButtonLocatorEdit2 = await page.getByTestId(
"input-list-plus-btn-edit_urls-1",
);
const elementCountEdit2 = await plusButtonLocatorEdit2?.count();
const plusButtonLocatorEdit2 = await page.getByTestId(
"input-list-plus-btn-edit_urls-1",
);
const elementCountEdit2 = await plusButtonLocatorEdit2?.count();
if (elementCountEdit0 > 1 || elementCountEdit2 > 0) {
expect(false).toBeTruthy();
}
if (elementCountEdit0 > 1 || elementCountEdit2 > 0) {
expect(false).toBeTruthy();
}
const minusButtonLocatorEdit1 = await page.getByTestId(
"input-list-minus-btn-edit_urls-1",
);
const minusButtonLocatorEdit1 = await page.getByTestId(
"input-list-minus-btn-edit_urls-1",
);
const elementCountMinusEdit1 = await minusButtonLocatorEdit1?.count();
const elementCountMinusEdit1 = await minusButtonLocatorEdit1?.count();
const minusButtonLocatorEdit2 = await page.getByTestId(
"input-list-minus-btn-edit_urls-2",
);
const minusButtonLocatorEdit2 = await page.getByTestId(
"input-list-minus-btn-edit_urls-2",
);
const elementCountMinusEdit2 = await minusButtonLocatorEdit2?.count();
const elementCountMinusEdit2 = await minusButtonLocatorEdit2?.count();
if (elementCountMinusEdit1 > 1 || elementCountMinusEdit2 > 0) {
expect(false).toBeTruthy();
}
});
if (elementCountMinusEdit1 > 1 || elementCountMinusEdit2 > 0) {
expect(false).toBeTruthy();
}
},
);

View file

@ -1,6 +1,6 @@
import { expect, test } from "@playwright/test";
test("IntComponent", async ({ page }) => {
test("IntComponent", { tag: ["@release", "@workspace"] }, async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,

View file

@ -1,133 +1,139 @@
import { expect, test } from "@playwright/test";
test("KeypairListComponent", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"KeypairListComponent",
{ tag: ["@release", "@workspace"] },
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.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("amazon bedrock");
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("amazon bedrock");
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page
.getByTestId("modelsAmazon Bedrock")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByTestId("showmodel_kwargs").click();
expect(await page.getByTestId("showmodel_kwargs").isChecked()).toBeTruthy();
await page.getByText("Close").last().click();
await page.locator('//*[@id="keypair0"]').click();
await page.locator('//*[@id="keypair0"]').fill("testtesttesttest");
await page.locator('//*[@id="keypair100"]').click();
await page
.locator('//*[@id="keypair100"]')
.fill("test test test test test test");
await page.getByTestId("div-generic-node").click();
const valueWithSpace = await page.getByTestId("keypair100").inputValue();
await page.getByTestId("div-generic-node").click();
if (valueWithSpace !== "test test test test test test") {
expect(false).toBeTruthy();
}
const plusButtonLocatorNode = page.locator('//*[@id="plusbtn0"]');
const elementCountNode = await plusButtonLocatorNode?.count();
if (elementCountNode > 0) {
await plusButtonLocatorNode.click();
}
await page.getByTestId("div-generic-node").click();
await page.locator('//*[@id="keypair0"]').click();
await page.locator('//*[@id="keypair0"]').fill("testtesttesttest1");
await page.getByTestId("div-generic-node").click();
const keyPairVerification = page.locator('//*[@id="keypair100"]');
const elementKeyCount = await keyPairVerification?.count();
if (elementKeyCount === 1) {
expect(true).toBeTruthy();
} else {
expect(false).toBeTruthy();
}
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByText("Close").last().click();
const plusButtonLocator = page.locator('//*[@id="plusbtn0"]');
const elementCount = await plusButtonLocator?.count();
if (elementCount === 1) {
expect(true).toBeTruthy();
await page.getByTestId("div-generic-node").click();
await page
.getByTestId("modelsAmazon Bedrock")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.locator('//*[@id="editNodekeypair0"]').click();
await page.locator('//*[@id="editNodekeypair0"]').fill("testtesttesttest");
await page.getByTestId("showmodel_kwargs").click();
expect(await page.getByTestId("showmodel_kwargs").isChecked()).toBeTruthy();
await page.getByText("Close").last().click();
const keyPairVerification = page.locator('//*[@id="editNodekeypair0"]');
await page.locator('//*[@id="keypair0"]').click();
await page.locator('//*[@id="keypair0"]').fill("testtesttesttest");
await page.locator('//*[@id="keypair100"]').click();
await page
.locator('//*[@id="keypair100"]')
.fill("test test test test test test");
await page.getByTestId("div-generic-node").click();
const valueWithSpace = await page.getByTestId("keypair100").inputValue();
await page.getByTestId("div-generic-node").click();
if (valueWithSpace !== "test test test test test test") {
expect(false).toBeTruthy();
}
const plusButtonLocatorNode = page.locator('//*[@id="plusbtn0"]');
const elementCountNode = await plusButtonLocatorNode?.count();
if (elementCountNode > 0) {
await plusButtonLocatorNode.click();
}
await page.getByTestId("div-generic-node").click();
await page.locator('//*[@id="keypair0"]').click();
await page.locator('//*[@id="keypair0"]').fill("testtesttesttest1");
await page.getByTestId("div-generic-node").click();
const keyPairVerification = page.locator('//*[@id="keypair100"]');
const elementKeyCount = await keyPairVerification?.count();
if (elementKeyCount === 1) {
await page.getByText("Close").last().click();
expect(true).toBeTruthy();
} else {
expect(false).toBeTruthy();
}
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByText("Close").last().click();
const plusButtonLocator = page.locator('//*[@id="plusbtn0"]');
const elementCount = await plusButtonLocator?.count();
if (elementCount === 1) {
expect(true).toBeTruthy();
await page.getByTestId("div-generic-node").click();
const key1 = await page.locator('//*[@id="keypair0"]').inputValue();
const value1 = await page.locator('//*[@id="keypair100"]').inputValue();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
if (
key1 === "testtesttesttest" &&
value1 === "test test test test test test"
) {
expect(true).toBeTruthy();
await page.locator('//*[@id="editNodekeypair0"]').click();
await page
.locator('//*[@id="editNodekeypair0"]')
.fill("testtesttesttest");
const keyPairVerification = page.locator('//*[@id="editNodekeypair0"]');
const elementKeyCount = await keyPairVerification?.count();
if (elementKeyCount === 1) {
await page.getByText("Close").last().click();
await page.getByTestId("div-generic-node").click();
const key1 = await page.locator('//*[@id="keypair0"]').inputValue();
const value1 = await page.locator('//*[@id="keypair100"]').inputValue();
await page.getByTestId("div-generic-node").click();
if (
key1 === "testtesttesttest" &&
value1 === "test test test test test test"
) {
expect(true).toBeTruthy();
} else {
expect(false).toBeTruthy();
}
} else {
expect(false).toBeTruthy();
}
} else {
expect(false).toBeTruthy();
}
} else {
expect(false).toBeTruthy();
}
});
},
);

View file

@ -2,94 +2,98 @@ import { expect, Page, test } from "@playwright/test";
import uaParser from "ua-parser-js";
// TODO: This test might not be needed anymore
test("user should interact with link component", async ({ context, page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"user should interact with link component",
{ tag: ["@release", "@workspace"] },
async ({ context, page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
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();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { 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);
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page.getByTestId("sidebar-custom-component-button").click();
await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTestId("sidebar-custom-component-button").click();
await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTestId("title-Custom Component").first().click();
await page.getByTestId("title-Custom Component").first().click();
await page.waitForTimeout(500);
await page.getByTestId("code-button-modal").click();
await page.waitForTimeout(500);
await page.waitForTimeout(500);
await page.getByTestId("code-button-modal").click();
await page.waitForTimeout(500);
let cleanCode = await extractAndCleanCode(page);
let cleanCode = await extractAndCleanCode(page);
// Use regex pattern to match the imports section more flexibly
cleanCode = updateComponentCode(cleanCode, {
imports: ["MessageTextInput", "Output", "LinkInput"],
inputs: [
{
name: "MessageTextInput",
config: {
name: "input_value",
display_name: "Input Value",
info: "This is a custom component Input",
value: "Hello, World!",
tool_mode: true,
// Use regex pattern to match the imports section more flexibly
cleanCode = updateComponentCode(cleanCode, {
imports: ["MessageTextInput", "Output", "LinkInput"],
inputs: [
{
name: "MessageTextInput",
config: {
name: "input_value",
display_name: "Input Value",
info: "This is a custom component Input",
value: "Hello, World!",
tool_mode: true,
},
},
},
{
name: "LinkInput",
config: {
name: "link",
display_name: "BUTTON",
value: "https://www.datastax.com",
text: "Click me",
{
name: "LinkInput",
config: {
name: "link",
display_name: "BUTTON",
value: "https://www.datastax.com",
text: "Click me",
},
},
},
],
});
],
});
await page.locator("textarea").last().press(`ControlOrMeta+a`);
await page.keyboard.press("Backspace");
await page.locator("textarea").last().fill(cleanCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(500);
await page.locator("textarea").last().press(`ControlOrMeta+a`);
await page.keyboard.press("Backspace");
await page.locator("textarea").last().fill(cleanCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(500);
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
expect(await page.getByText("BUTTON").isVisible()).toBeTruthy();
expect(await page.getByText("Click me").isVisible()).toBeTruthy();
expect(await page.getByTestId("link_link_link")).toBeEnabled();
await page.getByTestId("link_link_link").click();
});
expect(await page.getByText("BUTTON").isVisible()).toBeTruthy();
expect(await page.getByText("Click me").isVisible()).toBeTruthy();
expect(await page.getByTestId("link_link_link")).toBeEnabled();
await page.getByTestId("link_link_link").click();
},
);
async function extractAndCleanCode(page: Page): Promise<string> {
const outerHTML = await page

View file

@ -1,102 +1,106 @@
import { expect, test } from "@playwright/test";
test("NestedComponent", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"NestedComponent",
{ tag: ["@release", "@workspace"] },
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.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("api request");
await page.waitForTimeout(1000);
await page
.getByTestId("dataAPI Request")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.click('//*[@id="react-flow-id"]');
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("dict_nesteddict_headers").first().click();
await page
.getByText("{")
.last()
.hover()
.then(async () => {
await page.locator(".json-view--edit").first().click();
await page.locator(".json-view--input").first().fill("keytest");
await page.locator(".json-view--edit").first().click();
await page.locator(".json-view--edit").first().click();
await page.locator(".json-view--input").first().fill("keytest1");
await page.locator(".json-view--edit").first().click();
await page.locator(".json-view--edit").first().click();
await page.locator(".json-view--input").first().fill("keytest2");
await page.locator(".json-view--edit").first().click();
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("api request");
await page
.locator(".json-view--pair")
.first()
.hover()
.then(async () => {
await page.locator(".json-view--edit").nth(2).click();
await page.locator(".json-view--null").first().fill("proptest1");
await page.locator(".json-view--edit").nth(2).click();
});
await page.waitForTimeout(1000);
await page.getByText("Save").last().click();
await page
.getByTestId("dataAPI Request")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.click('//*[@id="react-flow-id"]');
await page.getByTestId("div-generic-node").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByTestId("dict_nesteddict_headers").first().click();
await page
.getByText("{")
.last()
.hover()
.then(async () => {
await page.locator(".json-view--edit").first().click();
await page.locator(".json-view--input").first().fill("keytest");
await page.locator(".json-view--edit").first().click();
await page.getByTestId("dict_nesteddict_edit_headers").first().click();
await page.locator(".json-view--edit").first().click();
await page.locator(".json-view--input").first().fill("keytest1");
await page.locator(".json-view--edit").first().click();
expect(await page.getByText("keytest", { exact: true }).count()).toBe(1);
expect(await page.getByText("keytest1", { exact: true }).count()).toBe(1);
expect(await page.getByText("keytest2", { exact: true }).count()).toBe(1);
expect(await page.getByText("proptest1").count()).toBe(1);
await page.locator(".json-view--edit").first().click();
await page.locator(".json-view--input").first().fill("keytest2");
await page.locator(".json-view--edit").first().click();
});
await page
.locator(".json-view--pair")
.first()
.hover()
.then(async () => {
await page.locator(".json-view--edit").nth(3).click();
await page.locator(".json-view--edit").nth(2).click();
});
await page
.locator(".json-view--pair")
.first()
.hover()
.then(async () => {
await page.locator(".json-view--edit").nth(2).click();
await page.locator(".json-view--null").first().fill("proptest1");
await page.locator(".json-view--edit").nth(2).click();
});
expect(await page.getByText("keytest", { exact: true }).count()).toBe(0);
expect(await page.getByText("proptest1").count()).toBe(0);
});
await page.getByText("Save").last().click();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByTestId("dict_nesteddict_edit_headers").first().click();
expect(await page.getByText("keytest", { exact: true }).count()).toBe(1);
expect(await page.getByText("keytest1", { exact: true }).count()).toBe(1);
expect(await page.getByText("keytest2", { exact: true }).count()).toBe(1);
expect(await page.getByText("proptest1").count()).toBe(1);
await page
.locator(".json-view--pair")
.first()
.hover()
.then(async () => {
await page.locator(".json-view--edit").nth(3).click();
await page.locator(".json-view--edit").nth(2).click();
});
expect(await page.getByText("keytest", { exact: true }).count()).toBe(0);
expect(await page.getByText("proptest1").count()).toBe(0);
},
);

View file

@ -1,221 +1,245 @@
import { expect, test } from "@playwright/test";
test("PromptTemplateComponent", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"PromptTemplateComponent",
{ tag: ["@release", "@workspace"] },
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.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("prompt");
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("prompt");
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page
.locator('//*[@id="promptsPrompt"]')
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("promptarea_prompt_template").click();
await page
.locator('//*[@id="promptsPrompt"]')
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("promptarea_prompt_template").click();
await page
.getByTestId("modal-promptarea_prompt_template")
.fill("{prompt} example {prompt1}");
await page
.getByTestId("modal-promptarea_prompt_template")
.fill("{prompt} example {prompt1}");
let value = await page
.getByTestId("modal-promptarea_prompt_template")
.inputValue();
let value = await page
.getByTestId("modal-promptarea_prompt_template")
.inputValue();
if (value != "{prompt} example {prompt1}") {
expect(false).toBeTruthy();
}
if (value != "{prompt} example {prompt1}") {
expect(false).toBeTruthy();
}
let valueBadgeOne = await page.locator('//*[@id="badge0"]').innerText();
if (valueBadgeOne != "prompt") {
expect(false).toBeTruthy();
}
let valueBadgeOne = await page.locator('//*[@id="badge0"]').innerText();
if (valueBadgeOne != "prompt") {
expect(false).toBeTruthy();
}
let valueBadgeTwo = await page.locator('//*[@id="badge1"]').innerText();
if (valueBadgeTwo != "prompt1") {
expect(false).toBeTruthy();
}
let valueBadgeTwo = await page.locator('//*[@id="badge1"]').innerText();
if (valueBadgeTwo != "prompt1") {
expect(false).toBeTruthy();
}
await page.getByTestId("genericModalBtnSave").click();
await page.getByTestId("genericModalBtnSave").click();
await page.getByTestId("textarea_str_prompt").click();
await page.getByTestId("textarea_str_prompt").fill("prompt_value_!@#!@#");
await page.getByTestId("textarea_str_prompt").click();
await page.getByTestId("textarea_str_prompt").fill("prompt_value_!@#!@#");
value = await page.getByTestId("textarea_str_prompt").inputValue();
value = await page.getByTestId("textarea_str_prompt").inputValue();
if (value != "prompt_value_!@#!@#") {
expect(false).toBeTruthy();
}
if (value != "prompt_value_!@#!@#") {
expect(false).toBeTruthy();
}
await page.getByTestId("div-generic-node").click();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("save-button-modal").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("save-button-modal").click();
const replace = await page.getByTestId("replace-button").isVisible();
const replace = await page.getByTestId("replace-button").isVisible();
if (replace) {
await page.getByTestId("replace-button").click();
}
if (replace) {
await page.getByTestId("replace-button").click();
}
await page.getByTestId("textarea_str_prompt1").click();
await page
.getByTestId("textarea_str_prompt1")
.fill("prompt_name_test_123123!@#!@#");
await page.getByTestId("textarea_str_prompt1").click();
await page
.getByTestId("textarea_str_prompt1")
.fill("prompt_name_test_123123!@#!@#");
value = await page.getByTestId("textarea_str_prompt1").inputValue();
value = await page.getByTestId("textarea_str_prompt1").inputValue();
if (value != "prompt_name_test_123123!@#!@#") {
expect(false).toBeTruthy();
}
if (value != "prompt_name_test_123123!@#!@#") {
expect(false).toBeTruthy();
}
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
value =
(await page.locator('//*[@id="textarea_str_edit_prompt"]').inputValue()) ??
"";
value =
(await page
.locator('//*[@id="textarea_str_edit_prompt"]')
.inputValue()) ?? "";
if (value != "prompt_value_!@#!@#") {
expect(false).toBeTruthy();
}
if (value != "prompt_value_!@#!@#") {
expect(false).toBeTruthy();
}
value =
(await page.locator('//*[@id="textarea_str_edit_prompt1"]').inputValue()) ??
"";
value =
(await page
.locator('//*[@id="textarea_str_edit_prompt1"]')
.inputValue()) ?? "";
if (value != "prompt_name_test_123123!@#!@#") {
expect(false).toBeTruthy();
}
if (value != "prompt_name_test_123123!@#!@#") {
expect(false).toBeTruthy();
}
value = await page
.locator('//*[@id="promptarea_prompt_edit_template"]')
.innerText();
value = await page
.locator('//*[@id="promptarea_prompt_edit_template"]')
.innerText();
if (value != "{prompt} example {prompt1}") {
expect(false).toBeTruthy();
}
if (value != "{prompt} example {prompt1}") {
expect(false).toBeTruthy();
}
await page
.getByTestId(
"button_open_text_area_modal_textarea_str_edit_prompt1_advanced",
)
.click();
await page
.getByTestId("text-area-modal")
.fill("prompt_edit_test_12312312321!@#$");
await page
.getByTestId(
"button_open_text_area_modal_textarea_str_edit_prompt1_advanced",
)
.click();
await page
.getByTestId("text-area-modal")
.fill("prompt_edit_test_12312312321!@#$");
await page.getByText("Finish Editing", { exact: true }).click();
await page.getByText("Finish Editing", { exact: true }).click();
await page
.getByTestId(
"button_open_text_area_modal_textarea_str_edit_prompt_advanced",
)
.nth(0)
.click();
await page
.getByTestId("text-area-modal")
.fill("prompt_edit_test_44444444444!@#$");
await page
.getByTestId(
"button_open_text_area_modal_textarea_str_edit_prompt_advanced",
)
.nth(0)
.click();
await page
.getByTestId("text-area-modal")
.fill("prompt_edit_test_44444444444!@#$");
await page.getByText("Finish Editing", { exact: true }).click();
await page.getByText("Finish Editing", { exact: true }).click();
await page.locator('//*[@id="showtemplate"]').click();
expect(await page.locator('//*[@id="showtemplate"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showtemplate"]').click();
expect(
await page.locator('//*[@id="showtemplate"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showprompt"]').click();
expect(await page.locator('//*[@id="showprompt"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showprompt"]').click();
expect(await page.locator('//*[@id="showprompt"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showprompt1"]').click();
expect(await page.locator('//*[@id="showprompt1"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showprompt1"]').click();
expect(
await page.locator('//*[@id="showprompt1"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showtemplate"]').click();
expect(
await page.locator('//*[@id="showtemplate"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showtemplate"]').click();
expect(
await page.locator('//*[@id="showtemplate"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showprompt"]').click();
expect(await page.locator('//*[@id="showprompt"]').isChecked()).toBeTruthy();
await page.locator('//*[@id="showprompt"]').click();
expect(
await page.locator('//*[@id="showprompt"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showprompt1"]').click();
expect(await page.locator('//*[@id="showprompt1"]').isChecked()).toBeTruthy();
await page.locator('//*[@id="showprompt1"]').click();
expect(
await page.locator('//*[@id="showprompt1"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showtemplate"]').click();
expect(await page.locator('//*[@id="showtemplate"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showtemplate"]').click();
expect(
await page.locator('//*[@id="showtemplate"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showprompt"]').click();
expect(await page.locator('//*[@id="showprompt"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showprompt"]').click();
expect(await page.locator('//*[@id="showprompt"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showprompt1"]').click();
expect(await page.locator('//*[@id="showprompt1"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showprompt1"]').click();
expect(
await page.locator('//*[@id="showprompt1"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showtemplate"]').click();
expect(
await page.locator('//*[@id="showtemplate"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showtemplate"]').click();
expect(
await page.locator('//*[@id="showtemplate"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showprompt"]').click();
expect(await page.locator('//*[@id="showprompt"]').isChecked()).toBeTruthy();
await page.locator('//*[@id="showprompt"]').click();
expect(
await page.locator('//*[@id="showprompt"]').isChecked(),
).toBeTruthy();
await page.getByText("Close").last().click();
await page.getByText("Close").last().click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.locator('//*[@id="showprompt1"]').click();
expect(await page.locator('//*[@id="showprompt1"]').isChecked()).toBeTruthy();
await page.locator('//*[@id="showprompt1"]').click();
expect(
await page.locator('//*[@id="showprompt1"]').isChecked(),
).toBeTruthy();
value =
(await page.locator('//*[@id="textarea_str_edit_prompt"]').inputValue()) ??
"";
value =
(await page
.locator('//*[@id="textarea_str_edit_prompt"]')
.inputValue()) ?? "";
if (value != "prompt_edit_test_44444444444!@#$") {
expect(false).toBeTruthy();
}
if (value != "prompt_edit_test_44444444444!@#$") {
expect(false).toBeTruthy();
}
value =
(await page.locator('//*[@id="textarea_str_edit_prompt1"]').inputValue()) ??
"";
value =
(await page
.locator('//*[@id="textarea_str_edit_prompt1"]')
.inputValue()) ?? "";
if (value != "prompt_edit_test_12312312321!@#$") {
expect(false).toBeTruthy();
}
if (value != "prompt_edit_test_12312312321!@#$") {
expect(false).toBeTruthy();
}
value = await page
.locator('//*[@id="promptarea_prompt_edit_template"]')
.innerText();
value = await page
.locator('//*[@id="promptarea_prompt_edit_template"]')
.innerText();
if (value != "{prompt} example {prompt1}") {
expect(false).toBeTruthy();
}
});
if (value != "{prompt} example {prompt1}") {
expect(false).toBeTruthy();
}
},
);

View file

@ -2,106 +2,112 @@ import { expect, Page, test } from "@playwright/test";
import uaParser from "ua-parser-js";
// TODO: This component doesn't have slider needs updating
test("user should be able to use slider input", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"user should be able to use slider input",
{
tag: ["@release", "@workspace"],
},
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.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { 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);
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("ollama");
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("ollama");
await page.waitForTimeout(1000);
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.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page
.getByTestId("modelsOllama")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("title-Ollama").click();
await page.getByTestId("code-button-modal").click();
await page.getByTestId("title-Ollama").click();
await page.getByTestId("code-button-modal").click();
let cleanCode = await extractAndCleanCode(page);
let cleanCode = await extractAndCleanCode(page);
// Replace the import statement
cleanCode = cleanCode.replace("FloatInput(", "SliderInput(");
cleanCode = cleanCode.replace(
"from langflow.io import BoolInput, DictInput, DropdownInput, FloatInput, IntInput, StrInput",
"from langflow.io import BoolInput, DictInput, DropdownInput, FloatInput, IntInput, StrInput, SliderInput",
);
// Replace the import statement
cleanCode = cleanCode.replace("FloatInput(", "SliderInput(");
cleanCode = cleanCode.replace(
"from langflow.io import BoolInput, DictInput, DropdownInput, FloatInput, IntInput, StrInput",
"from langflow.io import BoolInput, DictInput, DropdownInput, FloatInput, IntInput, StrInput, SliderInput",
);
cleanCode = cleanCode.replace(
"value=0.2,",
"value=0.2, range_spec=RangeSpec(min=3, max=30, step=1), min_label='test', max_label='test2', min_label_icon='pencil-ruler', max_label_icon='palette', slider_buttons=False, slider_buttons_options=[], slider_input=False,",
);
cleanCode = cleanCode.replace(
"value=0.2,",
"value=0.2, range_spec=RangeSpec(min=3, max=30, step=1), min_label='test', max_label='test2', min_label_icon='pencil-ruler', max_label_icon='palette', slider_buttons=False, slider_buttons_options=[], slider_input=False,",
);
await page.locator("textarea").last().press(`ControlOrMeta+a`);
await page.keyboard.press("Backspace");
await page.locator("textarea").last().fill(cleanCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(500);
await page.locator("textarea").last().press(`ControlOrMeta+a`);
await page.keyboard.press("Backspace");
await page.locator("textarea").last().fill(cleanCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(500);
await page.getByTestId("fit_view").click();
await page.getByTestId("fit_view").click();
await mutualValidation(page);
await mutualValidation(page);
await moveSlider(page, "right", false);
await moveSlider(page, "right", false);
await page.waitForTimeout(500);
await page.waitForTimeout(500);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("more-options-modal").click();
await page.getByText("Controls", { exact: true }).last().click();
await expect(
page.getByTestId("default_slider_display_value_advanced"),
).toHaveText("19.00");
await page.getByTestId("more-options-modal").click();
await page.getByText("Controls", { exact: true }).last().click();
await expect(
page.getByTestId("default_slider_display_value_advanced"),
).toHaveText("19.00");
await moveSlider(page, "left", true);
// Wait for any potential updates
await page.waitForTimeout(500);
await moveSlider(page, "left", true);
// Wait for any potential updates
await page.waitForTimeout(500);
await expect(
page.getByTestId("default_slider_display_value_advanced"),
).toHaveText("14.00");
await expect(
page.getByTestId("default_slider_display_value_advanced"),
).toHaveText("14.00");
await page.getByText("Close").last().click();
await page.getByText("Close").last().click();
await expect(page.getByTestId("default_slider_display_value")).toHaveText(
"14.00",
);
});
await expect(page.getByTestId("default_slider_display_value")).toHaveText(
"14.00",
);
},
);
async function extractAndCleanCode(page: Page): Promise<string> {
const outerHTML = await page

View file

@ -2,56 +2,59 @@ import { expect, test } from "@playwright/test";
import uaParser from "ua-parser-js";
// TODO: This component doesn't have table input needs updating
test("user must be able to interact with table input component", async ({
page,
}) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"user must be able to interact with table input component",
{
tag: ["@release", "@workspace"],
},
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.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
const randomText = Math.random().toString(36).substring(7);
const secondRandomText = Math.random().toString(36).substring(7);
const thirdRandomText = Math.random().toString(36).substring(7);
const randomText = Math.random().toString(36).substring(7);
const secondRandomText = Math.random().toString(36).substring(7);
const thirdRandomText = Math.random().toString(36).substring(7);
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
while (modalCount === 0) {
await page.getByText("New Flow", { 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();
while (modalCount === 0) {
await page.getByText("New Flow", { 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.waitForTimeout(1000);
await page.getByTestId("sidebar-custom-component-button").click();
await page.getByTestId("sidebar-custom-component-button").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("code-button-modal").click();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("code-button-modal").click();
const customCodeWithError = `
const customCodeWithError = `
# from langflow.field_typing import Data
from langflow.custom import Component
from langflow.io import TableInput, Output
@ -96,94 +99,95 @@ class CustomComponent(Component):
return data
`;
await page.locator("textarea").press(`ControlOrMeta+a`);
await page.locator("textarea").fill(customCodeWithError);
await page.locator("textarea").press(`ControlOrMeta+a`);
await page.locator("textarea").fill(customCodeWithError);
await page.getByText("Check & Save").last().click();
await page.getByText("Check & Save").last().click();
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page.getByText("Open Table").click();
await page.getByText("Open Table").click();
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
const visibleTextsGroup1 = ["Alpha", "Bravo", "Charlie", "Delta", "Echo"];
const visibleTextsGroup2 = ["X1", "Y2", "Z3", "W4", "V5"];
const visibleTextsGroup3 = ["P1", "Q2", "R3", "S4", "T5"];
const visibleTextsGroup4 = ["F1", "G2", "H3", "I4", "J5"];
const visibleTextsGroup1 = ["Alpha", "Bravo", "Charlie", "Delta", "Echo"];
const visibleTextsGroup2 = ["X1", "Y2", "Z3", "W4", "V5"];
const visibleTextsGroup3 = ["P1", "Q2", "R3", "S4", "T5"];
const visibleTextsGroup4 = ["F1", "G2", "H3", "I4", "J5"];
const allVisibleTexts = [
...visibleTextsGroup1,
...visibleTextsGroup2,
...visibleTextsGroup3,
...visibleTextsGroup4,
];
const allVisibleTexts = [
...visibleTextsGroup1,
...visibleTextsGroup2,
...visibleTextsGroup3,
...visibleTextsGroup4,
];
for (const text of allVisibleTexts) {
await expect(page.getByText(text).last()).toBeVisible();
}
for (const text of allVisibleTexts) {
await expect(page.getByText(text).last()).toBeVisible();
}
await page.locator(".ag-cell-value").first().click();
await page.locator(".ag-cell-value").first().click();
await page.getByPlaceholder("Empty").fill(randomText);
await page.getByText("Save").last().click();
await page.waitForTimeout(500);
await page.getByPlaceholder("Empty").fill(randomText);
await page.getByText("Save").last().click();
await page.waitForTimeout(500);
await page.locator(".ag-cell-value").nth(12).click();
await page.locator(".ag-cell-value").nth(12).click();
await page.getByPlaceholder("Empty").fill(secondRandomText);
await page.getByText("Save").last().click();
await page.waitForTimeout(500);
await page.getByPlaceholder("Empty").fill(secondRandomText);
await page.getByText("Save").last().click();
await page.waitForTimeout(500);
await page.locator(".ag-cell-value").nth(24).click();
await page.waitForTimeout(500);
await page.locator(".ag-cell-value").nth(24).click();
await page.waitForTimeout(500);
await page.getByPlaceholder("Empty").fill(thirdRandomText);
await page.getByText("Save").last().click();
await page.getByPlaceholder("Empty").fill(thirdRandomText);
await page.getByText("Save").last().click();
await page.waitForTimeout(500);
await page.waitForTimeout(500);
expect(page.getByText(randomText)).toBeVisible();
expect(page.getByText(secondRandomText)).toBeVisible();
expect(page.getByText(thirdRandomText)).toBeVisible();
expect(page.getByText(randomText)).toBeVisible();
expect(page.getByText(secondRandomText)).toBeVisible();
expect(page.getByText(thirdRandomText)).toBeVisible();
await page.locator('input[type="checkbox"]').last().click();
await page.locator('input[type="checkbox"]').last().click();
await page.getByTestId("icon-Copy").last().click();
await page.getByTestId("icon-Copy").last().click();
await page.waitForTimeout(500);
await page.waitForTimeout(500);
let numberOfCopiedRows = await page.getByText(thirdRandomText).count();
expect(numberOfCopiedRows).toBe(2);
let numberOfCopiedRows = await page.getByText(thirdRandomText).count();
expect(numberOfCopiedRows).toBe(2);
await page.locator('input[type="checkbox"]').last().click();
await page.getByTestId("icon-Trash2").last().click();
await page.locator('input[type="checkbox"]').last().click();
await page.getByTestId("icon-Trash2").last().click();
await page.waitForTimeout(500);
await page.waitForTimeout(500);
await page.locator('input[type="checkbox"]').last().click();
await page.getByTestId("icon-Trash2").click();
await page.locator('input[type="checkbox"]').last().click();
await page.getByTestId("icon-Trash2").click();
numberOfCopiedRows = await page.getByText(thirdRandomText).count();
expect(numberOfCopiedRows).toBe(0);
numberOfCopiedRows = await page.getByText(thirdRandomText).count();
expect(numberOfCopiedRows).toBe(0);
await page.getByText("Close").last().click();
await page.getByText("Close").last().click();
await page.waitForTimeout(500);
await page.waitForTimeout(500);
await page.getByText("Open Table").click();
await page.getByText("Open Table").click();
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
const visibleTexts = ["Alpha", "Bravo", "Charlie", "Delta", "Echo"];
const notVisibleTexts = ["X1", "thirdRandomText"];
const visibleTexts = ["Alpha", "Bravo", "Charlie", "Delta", "Echo"];
const notVisibleTexts = ["X1", "thirdRandomText"];
await Promise.all(
visibleTexts.map((text) => expect(page.getByText(text)).toBeVisible()),
);
await Promise.all(
notVisibleTexts.map((text) =>
expect(page.getByText(text)).not.toBeVisible(),
),
);
});
await Promise.all(
visibleTexts.map((text) => expect(page.getByText(text)).toBeVisible()),
);
await Promise.all(
notVisibleTexts.map((text) =>
expect(page.getByText(text)).not.toBeVisible(),
),
);
},
);

View file

@ -1,88 +1,92 @@
import { expect, test } from "@playwright/test";
test("TextAreaModalComponent", async ({ page }) => {
await page.goto("/");
await page.waitForTimeout(1000);
test(
"TextAreaModalComponent",
{ tag: ["@release", "@workspace"] },
async ({ page }) => {
await page.goto("/");
await page.waitForTimeout(1000);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { 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();
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("prompt");
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("prompt");
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page
.locator('//*[@id="promptsPrompt"]')
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page
.locator('//*[@id="promptsPrompt"]')
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("promptarea_prompt_template").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("promptarea_prompt_template").click();
await page.getByTestId("modal-promptarea_prompt_template").fill("{text}");
await page.getByTestId("modal-promptarea_prompt_template").fill("{text}");
let valueBadgeOne = await page.locator('//*[@id="badge0"]').innerText();
if (valueBadgeOne != "text") {
expect(false).toBeTruthy();
}
let valueBadgeOne = await page.locator('//*[@id="badge0"]').innerText();
if (valueBadgeOne != "text") {
expect(false).toBeTruthy();
}
await page.getByTestId("genericModalBtnSave").click();
await page.getByTestId("genericModalBtnSave").click();
await page
.getByTestId("textarea_str_text")
.fill(
"test test test test test test test test test test test !@#%*)( 123456789101010101010101111111111 !!!!!!!!!!",
);
await page
.getByTestId("textarea_str_text")
.fill(
"test test test test test test test test test test test !@#%*)( 123456789101010101010101111111111 !!!!!!!!!!",
);
await page
.getByTestId("button_open_text_area_modal_textarea_str_text")
.click();
await page
.getByTestId("button_open_text_area_modal_textarea_str_text")
.click();
await page.waitForTimeout(500);
await page.waitForTimeout(500);
const value = await page.getByTestId("text-area-modal").inputValue();
const value = await page.getByTestId("text-area-modal").inputValue();
if (
value !=
"test test test test test test test test test test test !@#%*)( 123456789101010101010101111111111 !!!!!!!!!!"
) {
expect(false).toBeTruthy();
}
if (
value !=
"test test test test test test test test test test test !@#%*)( 123456789101010101010101111111111 !!!!!!!!!!"
) {
expect(false).toBeTruthy();
}
await page.getByTestId("text-area-modal").fill("test123123");
await page.getByTestId("text-area-modal").fill("test123123");
await page.getByTestId("genericModalBtnSave").click();
await page.getByTestId("genericModalBtnSave").click();
const valueTextArea = await page
.getByTestId("textarea_str_text")
.inputValue();
const valueTextArea = await page
.getByTestId("textarea_str_text")
.inputValue();
if (valueTextArea != "test123123") {
expect(false).toBeTruthy();
}
});
if (valueTextArea != "test123123") {
expect(false).toBeTruthy();
}
},
);

View file

@ -1,172 +1,56 @@
import { expect, test } from "@playwright/test";
test("ToggleComponent", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"ToggleComponent",
{ tag: ["@release", "@workspace"] },
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.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { 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();
while (modalCount === 0) {
await page.getByText("New Flow", { 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.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("directory");
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("directory");
await page.waitForTimeout(1000);
await page
.getByTestId("dataDirectory")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForTimeout(1000);
await page
.getByTestId("dataDirectory")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.locator('//*[@id="showload_hidden"]').click();
expect(
await page.locator('//*[@id="showload_hidden"]').isChecked(),
).toBeTruthy();
await page.getByText("Close").last().click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeTruthy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeFalsy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeTruthy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeFalsy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeTruthy();
await page.getByTestId("div-generic-node").click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showload_hidden"]').click();
expect(
await page.locator('//*[@id="showload_hidden"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showmax_concurrency"]').click();
expect(
await page.locator('//*[@id="showmax_concurrency"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showpath"]').click();
expect(await page.locator('//*[@id="showpath"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showrecursive"]').click();
expect(
await page.locator('//*[@id="showrecursive"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showsilent_errors"]').click();
expect(
await page.locator('//*[@id="showsilent_errors"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showuse_multithreading"]').click();
expect(
await page.locator('//*[@id="showuse_multithreading"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showmax_concurrency"]').click();
expect(
await page.locator('//*[@id="showmax_concurrency"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showpath"]').click();
expect(await page.locator('//*[@id="showpath"]').isChecked()).toBeTruthy();
await page.locator('//*[@id="showrecursive"]').click();
expect(
await page.locator('//*[@id="showrecursive"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showsilent_errors"]').click();
expect(
await page.locator('//*[@id="showsilent_errors"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showuse_multithreading"]').click();
expect(
await page.locator('//*[@id="showuse_multithreading"]').isChecked(),
).toBeFalsy();
await page.getByText("Close").last().click();
const plusButtonLocator = page.getByTestId("toggle_bool_load_hidden");
const elementCount = await plusButtonLocator?.count();
if (elementCount === 0) {
expect(true).toBeTruthy();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("div-generic-node").click();
@ -178,35 +62,155 @@ test("ToggleComponent", async ({ page }) => {
await page.locator('//*[@id="showload_hidden"]').isChecked(),
).toBeTruthy();
await page.getByText("Close").last().click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeTruthy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeFalsy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeTruthy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeFalsy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeTruthy();
await page.getByTestId("div-generic-node").click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showload_hidden"]').click();
expect(
await page.locator('//*[@id="showload_hidden"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showmax_concurrency"]').click();
expect(
await page.locator('//*[@id="showmax_concurrency"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showpath"]').click();
expect(await page.locator('//*[@id="showpath"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showrecursive"]').click();
expect(
await page.locator('//*[@id="showrecursive"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showsilent_errors"]').click();
expect(
await page.locator('//*[@id="showsilent_errors"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showuse_multithreading"]').click();
expect(
await page.locator('//*[@id="showuse_multithreading"]').isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showmax_concurrency"]').click();
expect(
await page.locator('//*[@id="showmax_concurrency"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showpath"]').click();
expect(await page.locator('//*[@id="showpath"]').isChecked()).toBeTruthy();
await page.locator('//*[@id="showrecursive"]').click();
expect(
await page.locator('//*[@id="showrecursive"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showsilent_errors"]').click();
expect(
await page.locator('//*[@id="showsilent_errors"]').isChecked(),
).toBeFalsy();
await page.locator('//*[@id="showuse_multithreading"]').click();
expect(
await page.locator('//*[@id="showuse_multithreading"]').isChecked(),
).toBeFalsy();
await page.getByText("Close").last().click();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeFalsy();
const plusButtonLocator = page.getByTestId("toggle_bool_load_hidden");
const elementCount = await plusButtonLocator?.count();
if (elementCount === 0) {
expect(true).toBeTruthy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeTruthy();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeFalsy();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeTruthy();
await page.locator('//*[@id="showload_hidden"]').click();
expect(
await page.locator('//*[@id="showload_hidden"]').isChecked(),
).toBeTruthy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeFalsy();
}
});
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeTruthy();
await page.getByText("Close").last().click();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeFalsy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeTruthy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeFalsy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeTruthy();
await page.getByTestId("toggle_bool_load_hidden").click();
expect(
await page.getByTestId("toggle_bool_load_hidden").isChecked(),
).toBeFalsy();
}
},
);