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

View file

@ -1,64 +1,69 @@
import { test } from "@playwright/test";
test("CodeAreaModalComponent", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"CodeAreaModalComponent",
{ tag: ["@release", "@workspace"] },
async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("python function");
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("python function");
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page.getByTestId("sidebar-options-trigger").click();
await page.getByTestId("sidebar-legacy-switch").isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await page.getByTestId("sidebar-options-trigger").click();
await page
.getByTestId("sidebar-legacy-switch")
.isVisible({ timeout: 5000 });
await page.getByTestId("sidebar-legacy-switch").click();
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page
.getByTestId("prototypesPython Function")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("div-generic-node").click();
await page
.getByTestId("prototypesPython Function")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("code-button-modal").click();
await page.getByTestId("code-button-modal").click();
const wCode =
'def python_function(text: str) -> st: """This is a default python function that returns the input text""" return text';
const wCode =
'def python_function(text: str) -> st: """This is a default python function that returns the input text""" return text';
const customComponentCode = `from typing import Callable
const customComponentCode = `from typing import Callable
from langflow.field_typing import Code
from langflow.interface.custom.custom_component import CustomComponent
from langflow.interface.custom.utils import get_function
@ -68,18 +73,19 @@ class PythonFunctionComponent(CustomComponent):
"""This is a default python function that returns the input text"""
return text`;
await page
.locator("#CodeEditor div")
.filter({ hasText: "PythonFunctionComponent" })
.nth(1)
.click();
await page.locator("textarea").press("Control+a");
await page.locator("textarea").fill(wCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(1000);
await page.locator("textarea").press("Control+a");
await page.locator("textarea").fill(wCode);
await page.locator("textarea").fill(customComponentCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(1000);
});
await page
.locator("#CodeEditor div")
.filter({ hasText: "PythonFunctionComponent" })
.nth(1)
.click();
await page.locator("textarea").press("Control+a");
await page.locator("textarea").fill(wCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(1000);
await page.locator("textarea").press("Control+a");
await page.locator("textarea").fill(wCode);
await page.locator("textarea").fill(customComponentCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.waitForTimeout(1000);
},
);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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