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,