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

@ -2,124 +2,128 @@ import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("user must be able to send an image on chat using advanced tool on ChatInputComponent", async ({
page,
}) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"user must be able to send an image on chat using advanced tool on ChatInputComponent",
{ tag: ["@release", "@components"] },
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.waitForTimeout(1000);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.goto("/");
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").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.waitForSelector("text=Chat Input", { timeout: 30000 });
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
await page.getByText("Chat Input", { exact: true }).click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByTestId("showfiles").click();
await page.getByText("Close").last().click();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
await page.waitForTimeout(500);
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const userQuestion = "What is this image?";
await page.getByTestId("textarea_str_input_value").fill(userQuestion);
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
const filePath = "tests/assets/chain.png";
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.click('[data-testid="button_upload_file"]');
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
const [fileChooser] = await Promise.all([
page.waitForEvent("filechooser"),
page.click('[data-testid="button_upload_file"]'),
]);
await page.waitForSelector("text=Chat Input", { timeout: 30000 });
await fileChooser.setFiles(filePath);
await page.getByText("Chat Input", { exact: true }).click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
await page.getByTestId("showfiles").click();
await page.getByText("Close").last().click();
await page.keyboard.press("Escape");
await page.waitForTimeout(500);
await page.getByTestId("button_run_chat output").click();
await page.getByText("built successfully").last().click({
timeout: 15000,
});
const userQuestion = "What is this image?";
await page.getByTestId("textarea_str_input_value").fill(userQuestion);
await page.getByText("Playground", { exact: true }).last().click();
const filePath = "tests/assets/chain.png";
await page.waitForTimeout(500);
await page.click('[data-testid="button_upload_file"]');
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
const [fileChooser] = await Promise.all([
page.waitForEvent("filechooser"),
page.click('[data-testid="button_upload_file"]'),
]);
await page.waitForSelector("text=chain.png", { timeout: 30000 });
await fileChooser.setFiles(filePath);
expect(await page.getByAltText("generated image").isVisible()).toBeTruthy();
await page.keyboard.press("Escape");
expect(
await page.getByTestId(`chat-message-User-${userQuestion}`).isVisible(),
).toBeTruthy();
await page.getByTestId("button_run_chat output").click();
await page.getByText("built successfully").last().click({
timeout: 15000,
});
const textContents = await page
.getByTestId("div-chat-message")
.allTextContents();
await page.getByText("Playground", { exact: true }).last().click();
expect(textContents[0]).toContain("chain");
});
await page.waitForTimeout(500);
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
await page.waitForSelector("text=chain.png", { timeout: 30000 });
expect(await page.getByAltText("generated image").isVisible()).toBeTruthy();
expect(
await page.getByTestId(`chat-message-User-${userQuestion}`).isVisible(),
).toBeTruthy();
const textContents = await page
.getByTestId("div-chat-message")
.allTextContents();
expect(textContents[0]).toContain("chain");
},
);

View file

@ -2,72 +2,78 @@ import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("user must be able to create a new flow clicking on New Flow button", async ({
page,
}) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"user must be able to create a new flow clicking on New Flow button",
{ tag: ["@release"] },
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.waitForTimeout(1000);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.goto("/");
await page.waitForTimeout(1000);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByText("Close").last().click();
await page.getByTestId("add-folder-button").click();
await page.getByText("New Folder").last().click();
await page.waitForSelector("text=new flow", { timeout: 30000 });
await page.waitForTimeout(1000);
expect(
(
await page.waitForSelector("text=new flow", {
timeout: 30000,
})
).isVisible(),
);
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByText("Close").last().click();
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector("text=playground", { timeout: 30000 });
await page.waitForSelector("text=api", { timeout: 30000 });
await page.waitForSelector("text=share", { timeout: 30000 });
await page.getByTestId("add-folder-button").click();
await page.waitForTimeout(1000);
await page.getByText("New Folder").last().click();
await page.waitForSelector("text=new flow", { timeout: 30000 });
await page.waitForTimeout(1000);
expect(
(
await page.waitForSelector("text=new flow", {
timeout: 30000,
})
).isVisible(),
);
await page.getByText("New Flow", { exact: true }).click();
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector("text=playground", { timeout: 30000 });
await page.waitForSelector("text=api", { timeout: 30000 });
await page.waitForSelector("text=share", { timeout: 30000 });
await page.waitForTimeout(1000);
expect(
await page.getByTestId("button_run_chat output").isVisible(),
).toBeTruthy();
expect(await page.getByTestId("button_run_openai").isVisible()).toBeTruthy();
expect(await page.getByTestId("button_run_prompt").isVisible()).toBeTruthy();
expect(
await page.getByTestId("button_run_chat input").isVisible(),
).toBeTruthy();
});
expect(
await page.getByTestId("button_run_chat output").isVisible(),
).toBeTruthy();
expect(
await page.getByTestId("button_run_openai").isVisible(),
).toBeTruthy();
expect(
await page.getByTestId("button_run_prompt").isVisible(),
).toBeTruthy();
expect(
await page.getByTestId("button_run_chat input").isVisible(),
).toBeTruthy();
},
);

View file

@ -2,106 +2,112 @@ import { test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("should delete rows from table message", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
test(
"should delete rows from table message",
{ tag: ["@release"] },
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
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('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
await page.getByText("built successfully").last().click({
timeout: 30000,
});
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.waitForTimeout(2000);
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("user-profile-settings").click();
await page.waitForTimeout(1000);
await page.waitForTimeout(500);
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.waitForSelector('text="Settings"');
await page.getByText("Settings").last().click();
await page.getByText("built successfully").last().click({
timeout: 30000,
});
await page.waitForSelector('text="Messages"');
await page.getByText("Messages").last().click();
await page.waitForTimeout(2000);
await page.waitForSelector(".ag-checkbox-input");
await page.locator(".ag-checkbox-input").first().click();
await page.getByTestId("user-profile-settings").click();
await page.waitForTimeout(500);
await page.waitForTimeout(500);
await page.waitForSelector('[data-testid="icon-Trash2"]:first-child');
await page.getByTestId("icon-Trash2").first().click();
await page.waitForSelector('text="Settings"');
await page.getByText("Settings").last().click();
await page.waitForTimeout(500);
await page.waitForSelector('text="Messages"');
await page.getByText("Messages").last().click();
await page.waitForSelector(".ag-checkbox-input");
await page.locator(".ag-checkbox-input").first().click();
await page.waitForTimeout(500);
await page.waitForSelector('[data-testid="icon-Trash2"]:first-child');
await page.getByTestId("icon-Trash2").first().click();
await page.waitForTimeout(500);
await page.waitForSelector("text=No Data Available", { timeout: 30000 });
await page.getByText("No Data Available").isVisible();
});
await page.waitForSelector("text=No Data Available", { timeout: 30000 });
await page.getByText("No Data Available").isVisible();
},
);

View file

@ -2,121 +2,125 @@ import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("freeze must work correctly", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"freeze must work correctly",
{ tag: ["@release", "@api", "@components"] },
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.waitForTimeout(1000);
const promptText = "answer as you are a dog";
const newPromptText = "answer as you are a bird";
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.goto("/");
await page.waitForTimeout(1000);
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForTimeout(1000);
const promptText = "answer as you are a dog";
const newPromptText = "answer as you are a bird";
await page.getByTestId("fit_view").click();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
await page.getByText("openai").first().click();
await page.keyboard.press("Delete");
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
//connection 1
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForTimeout(1000);
const elementPrompt = await page
.getByTestId("handle-prompt-shownode-prompt message-right")
.first();
await elementPrompt.hover();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.locator('//*[@id="react-flow-id"]').hover();
await page.getByText("openai").first().click();
await page.keyboard.press("Delete");
const elementChatOutput = await page
.getByTestId("handle-chatoutput-shownode-text-left")
.first();
await elementChatOutput.hover();
await page.mouse.up();
//connection 1
await page.locator('//*[@id="react-flow-id"]').hover();
const elementPrompt = await page
.getByTestId("handle-prompt-shownode-prompt message-right")
.first();
await elementPrompt.hover();
await page.mouse.down();
await page.getByTestId("button_open_prompt_modal").click();
await page.locator('//*[@id="react-flow-id"]').hover();
await page.getByTestId("modal-promptarea_prompt_template").fill(promptText);
const elementChatOutput = await page
.getByTestId("handle-chatoutput-shownode-text-left")
.first();
await elementChatOutput.hover();
await page.mouse.up();
await page.getByText("Check & Save").click();
await page.locator('//*[@id="react-flow-id"]').hover();
await page.waitForTimeout(1000);
await page.getByTestId("button_open_prompt_modal").click();
await page.getByTestId("button_run_chat output").click();
await page.getByTestId("modal-promptarea_prompt_template").fill(promptText);
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("Check & Save").click();
await page.getByTestId("playground-btn-flow-io").click();
await page.waitForTimeout(1000);
const textContents = await page
.getByTestId("div-chat-message")
.allTextContents();
await page.getByTestId("button_run_chat output").click();
const concatAllText = textContents.join(" ");
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.waitForTimeout(1000);
await page.getByText("Close").last().click();
await page.getByTestId("playground-btn-flow-io").click();
await page.getByText("Prompt", { exact: true }).click();
await page.getByTestId("more-options-modal").click();
const textContents = await page
.getByTestId("div-chat-message")
.allTextContents();
await page.getByText("Freeze", { exact: true }).last().click();
const concatAllText = textContents.join(" ");
await page.waitForTimeout(1000);
await page.locator('//*[@id="react-flow-id"]').click();
await page.waitForTimeout(1000);
await page.getByText("Close").last().click();
expect(page.getByTestId("icon-Snowflake").first()).toBeVisible();
await page.getByText("Prompt", { exact: true }).click();
await page.getByTestId("more-options-modal").click();
await page.locator('//*[@id="react-flow-id"]').click();
await page.getByText("Freeze", { exact: true }).last().click();
await page.getByTestId("button_open_prompt_modal").click();
await page.waitForTimeout(1000);
await page.locator('//*[@id="react-flow-id"]').click();
await page.getByTestId("edit-prompt-sanitized").first().click();
expect(page.getByTestId("icon-Snowflake").first()).toBeVisible();
await page
.getByTestId("modal-promptarea_prompt_template")
.fill(newPromptText);
await page.locator('//*[@id="react-flow-id"]').click();
await page.getByText("Check & Save").click();
await page.getByTestId("button_open_prompt_modal").click();
await page.getByTestId("button_run_chat output").click();
await page.getByTestId("edit-prompt-sanitized").first().click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page
.getByTestId("modal-promptarea_prompt_template")
.fill(newPromptText);
await page.getByTestId("playground-btn-flow-io").click();
await page.getByText("Check & Save").click();
const textContents2 = await page
.getByTestId("div-chat-message")
.allTextContents();
await page.getByTestId("button_run_chat output").click();
const concatAllText2 = textContents2.join(" ");
await page.waitForSelector("text=built successfully", { timeout: 30000 });
expect(concatAllText2).toBe(concatAllText);
});
await page.getByTestId("playground-btn-flow-io").click();
const textContents2 = await page
.getByTestId("div-chat-message")
.allTextContents();
const concatAllText2 = textContents2.join(" ");
expect(concatAllText2).toBe(concatAllText);
},
);

View file

@ -1,133 +1,139 @@
import { expect, test } from "@playwright/test";
test("user should be able to use ComposIO without getting api_key error", async ({
page,
}) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"user should be able to use ComposIO without getting api_key error",
{ tag: ["@release"] },
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");
modalCount = await modalTitleElement.count();
} catch (error) {
modalCount = 0;
}
let modalCount = 0;
try {
const modalTitleElement = await page.getByTestId("modal-title");
modalCount = await modalTitleElement.count();
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title").count();
}
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("composio");
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("composio");
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
const modelElement = await page.getByTestId("composioComposio Tools");
const targetElement = await page.locator('//*[@id="react-flow-id"]');
await modelElement.dragTo(targetElement);
const modelElement = await page.getByTestId("composioComposio Tools");
const targetElement = await page.locator('//*[@id="react-flow-id"]');
await modelElement.dragTo(targetElement);
await page.mouse.up();
await page.mouse.down();
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("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
expect(await page.getByText("api_key").isVisible()).toBe(false);
});
expect(await page.getByText("api_key").isVisible()).toBe(false);
},
);
test("user should be able to use connect tools", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"user should be able to use connect tools",
{ tag: ["@release", "@api", "@components"] },
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");
modalCount = await modalTitleElement.count();
} catch (error) {
modalCount = 0;
}
let modalCount = 0;
try {
const modalTitleElement = await page.getByTestId("modal-title");
modalCount = await modalTitleElement.count();
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title").count();
}
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("search api");
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("search api");
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
let modelElement = await page.getByTestId("toolsSearch API");
let targetElement = await page.locator('//*[@id="react-flow-id"]');
await modelElement.dragTo(targetElement);
let modelElement = await page.getByTestId("toolsSearch API");
let targetElement = await page.locator('//*[@id="react-flow-id"]');
await modelElement.dragTo(targetElement);
await page.mouse.up();
await page.mouse.down();
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("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("tool calling agent");
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("tool calling agent");
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
modelElement = await page.getByTestId(
"langchain_utilitiesTool Calling Agent",
);
targetElement = await page.locator('//*[@id="react-flow-id"]');
await modelElement.dragTo(targetElement);
modelElement = await page.getByTestId(
"langchain_utilitiesTool Calling Agent",
);
targetElement = await page.locator('//*[@id="react-flow-id"]');
await modelElement.dragTo(targetElement);
await page.mouse.up();
await page.mouse.down();
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("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
//connection
const searchApiOutput = await page
.getByTestId("handle-searchapi-shownode-tool-right")
.nth(0);
await searchApiOutput.hover();
await page.mouse.down();
const toolCallingAgentInput = await page
.getByTestId("handle-toolcallingagent-shownode-tools-left")
.nth(0);
await toolCallingAgentInput.hover();
await page.mouse.up();
//connection
const searchApiOutput = await page
.getByTestId("handle-searchapi-shownode-tool-right")
.nth(0);
await searchApiOutput.hover();
await page.mouse.down();
const toolCallingAgentInput = await page
.getByTestId("handle-toolcallingagent-shownode-tools-left")
.nth(0);
await toolCallingAgentInput.hover();
await page.mouse.up();
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
expect(await page.locator(".react-flow__edge-interaction").count()).toBe(1);
});
expect(await page.locator(".react-flow__edge-interaction").count()).toBe(1);
},
);

View file

@ -1,93 +1,95 @@
import { expect, test } from "@playwright/test";
test("user should be able to connect RetrieverTool to another components", async ({
page,
}) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page.getByTestId("modal-title");
modalCount = await modalTitleElement.count();
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title").count();
}
await page.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("retriever");
await page.waitForTimeout(1000);
let modelElement = await page.getByTestId("toolsRetrieverTool");
let targetElement = await page.locator('//*[@id="react-flow-id"]');
await modelElement.dragTo(targetElement);
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.waitForTimeout(1000);
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-300, 300);
test(
"user should be able to connect RetrieverTool to another components",
{ tag: ["@release"] },
async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.mouse.up();
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chroma");
let modalCount = 0;
try {
const modalTitleElement = await page.getByTestId("modal-title");
modalCount = await modalTitleElement.count();
} catch (error) {
modalCount = 0;
}
await page.waitForTimeout(1000);
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title").count();
}
modelElement = await page.getByTestId("vectorstoresChroma DB");
targetElement = await page.locator('//*[@id="react-flow-id"]');
await modelElement.dragTo(targetElement);
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("retriever");
await page.mouse.up();
await page.mouse.down();
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
let modelElement = await page.getByTestId("toolsRetrieverTool");
let targetElement = await page.locator('//*[@id="react-flow-id"]');
await modelElement.dragTo(targetElement);
await page.getByTestId("fit_view").click();
await page.getByTestId("fit_view").click();
await page.mouse.up();
await page.mouse.down();
//connection
const chromaDbOutput = await page
.getByTestId("handle-chroma-shownode-retriever-right")
.nth(0);
await chromaDbOutput.hover();
await page.mouse.down();
const retrieverToolInput = await page
.getByTestId("handle-retrievertool-shownode-retriever-left")
.nth(0);
await retrieverToolInput.hover();
await page.mouse.up();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
expect(await page.locator(".react-flow__edge-interaction").count()).toBe(1);
});
await page.getByTestId("zoom_out").click();
await page
.locator('//*[@id="react-flow-id"]')
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-300, 300);
});
await page.mouse.up();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chroma");
await page.waitForTimeout(1000);
modelElement = await page.getByTestId("vectorstoresChroma DB");
targetElement = await page.locator('//*[@id="react-flow-id"]');
await modelElement.dragTo(targetElement);
await page.mouse.up();
await page.mouse.down();
await page.waitForTimeout(1000);
await page.getByTestId("fit_view").click();
await page.getByTestId("fit_view").click();
//connection
const chromaDbOutput = await page
.getByTestId("handle-chroma-shownode-retriever-right")
.nth(0);
await chromaDbOutput.hover();
await page.mouse.down();
const retrieverToolInput = await page
.getByTestId("handle-retrievertool-shownode-retriever-left")
.nth(0);
await retrieverToolInput.hover();
await page.mouse.up();
await page.waitForTimeout(1000);
expect(await page.locator(".react-flow__edge-interaction").count()).toBe(1);
},
);

View file

@ -2,126 +2,128 @@ import { test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("should be able to share a component on the store by clicking on the share button on the canvas", async ({
page,
}) => {
test.skip(
!process?.env?.STORE_API_KEY,
"STORE_API_KEY required to run this test",
);
test(
"should be able to share a component on the store by clicking on the share button on the canvas",
{ tag: ["@release"] },
async ({ page }) => {
test.skip(
!process?.env?.STORE_API_KEY,
"STORE_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.waitForTimeout(1000);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.goto("/");
await page.waitForTimeout(1000);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByText("Close", { exact: true }).click();
await page.waitForTimeout(1000);
await page.getByTestId("user-profile-settings").click();
await page.waitForTimeout(500);
await page.getByText("Settings", { exact: true }).first().click();
await page.waitForTimeout(1000);
await page
.getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? "");
await page.getByTestId("api-key-save-button-store").click();
await page.waitForTimeout(1000);
await page.getByText("Success! Your API Key has been saved.").isVisible();
await page.waitForTimeout(1000);
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
await page.getByTestId("icon-ChevronLeft").first().click();
await page.waitForTimeout(1000);
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByText("Close", { exact: true }).click();
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector("text=share", { timeout: 10000 });
await page.waitForSelector("text=playground", { timeout: 10000 });
await page.waitForSelector("text=api", { timeout: 10000 });
await page.waitForTimeout(1000);
await page.getByTestId("shared-button-flow").click();
await page.getByTestId("user-profile-settings").click();
await page.waitForTimeout(500);
await page.waitForTimeout(500);
await page.getByText("Settings", { exact: true }).first().click();
await page.waitForSelector("text=Share Flow", {
timeout: 10000,
});
await page.waitForSelector('[data-testid="shared-button-flow"]', {
timeout: 10000,
});
await page.waitForSelector("text=Share Flow", { timeout: 10000 });
await page.waitForTimeout(1000);
await page.getByTestId("share-modal-button-flow").click();
await page
.getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? "");
let replace = await page.getByTestId("replace-button").isVisible();
await page.getByTestId("api-key-save-button-store").click();
if (replace) {
await page.getByTestId("replace-button").click();
}
await page.waitForTimeout(1000);
await page.waitForSelector("text=flow shared successfully ", {
timeout: 10000,
});
await page.getByText("Success! Your API Key has been saved.").isVisible();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);
await page.waitForSelector("text=share", { timeout: 10000 });
await page.waitForSelector("text=playground", { timeout: 10000 });
await page.waitForSelector("text=api", { timeout: 10000 });
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
await page.getByTestId("shared-button-flow").click();
await page.getByTestId("icon-ChevronLeft").first().click();
await page.waitForTimeout(1000);
await page.waitForTimeout(500);
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector("text=Publish workflow to the Langflow Store.", {
timeout: 10000,
});
await page.waitForSelector('[data-testid="shared-button-flow"]', {
timeout: 10000,
});
await page.waitForSelector("text=Share Flow", { timeout: 10000 });
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector("text=share", { timeout: 10000 });
await page.waitForSelector("text=playground", { timeout: 10000 });
await page.waitForSelector("text=api", { timeout: 10000 });
await page.getByTestId("share-modal-button-flow").click();
await page.getByTestId("shared-button-flow").click();
replace = await page.getByTestId("replace-button").isVisible();
await page.waitForTimeout(500);
if (replace) {
await page.getByTestId("replace-button").click();
}
await page.waitForSelector("text=Share Flow", {
timeout: 10000,
});
await page.waitForSelector('[data-testid="shared-button-flow"]', {
timeout: 10000,
});
await page.waitForSelector("text=Share Flow", { timeout: 10000 });
await page.getByTestId("share-modal-button-flow").click();
let replace = await page.getByTestId("replace-button").isVisible();
if (replace) {
await page.getByTestId("replace-button").click();
}
await page.waitForSelector("text=flow shared successfully ", {
timeout: 10000,
});
await page.waitForTimeout(500);
await page.waitForSelector("text=share", { timeout: 10000 });
await page.waitForSelector("text=playground", { timeout: 10000 });
await page.waitForSelector("text=api", { timeout: 10000 });
await page.getByTestId("shared-button-flow").click();
await page.waitForTimeout(500);
await page.waitForSelector("text=Publish workflow to the Langflow Store.", {
timeout: 10000,
});
await page.waitForSelector('[data-testid="shared-button-flow"]', {
timeout: 10000,
});
await page.waitForSelector("text=Share Flow", { timeout: 10000 });
await page.getByTestId("share-modal-button-flow").click();
replace = await page.getByTestId("replace-button").isVisible();
if (replace) {
await page.getByTestId("replace-button").click();
}
await page.waitForSelector("text=flow shared successfully ", {
timeout: 10000,
});
});
await page.waitForSelector("text=flow shared successfully ", {
timeout: 10000,
});
},
);

View file

@ -2,75 +2,81 @@ import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("should use webhook component on API", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
test(
"should use webhook component on API",
{
tag: ["@release"],
},
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
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('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("webhook");
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForTimeout(1000);
await page.getByTestId("blank-flow").click();
await page
.getByTestId("dataWebhook")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("webhook");
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.waitForTimeout(1000);
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("dataWebhook")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForTimeout(1000);
await page.getByText("API", { exact: true }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByText("Webhook cURL", { exact: true }).click();
await page.getByRole("tab", { name: "Webhook cURL" }).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("icon-Copy").last().click();
await page.waitForTimeout(1000);
await page.getByText("API", { exact: true }).click();
const handle = await page.evaluateHandle(() =>
navigator.clipboard.readText(),
);
const clipboardContent = await handle.jsonValue();
expect(clipboardContent.length).toBeGreaterThan(0);
expect(clipboardContent).toContain("curl -X POST");
expect(clipboardContent).toContain("webhook");
await page.getByRole("tab", { name: "Tweaks" }).click();
});
await page.getByText("Webhook cURL", { exact: true }).click();
await page.getByRole("tab", { name: "Webhook cURL" }).click();
await page.getByTestId("icon-Copy").last().click();
const handle = await page.evaluateHandle(() =>
navigator.clipboard.readText(),
);
const clipboardContent = await handle.jsonValue();
expect(clipboardContent.length).toBeGreaterThan(0);
expect(clipboardContent).toContain("curl -X POST");
expect(clipboardContent).toContain("webhook");
await page.getByRole("tab", { name: "Tweaks" }).click();
},
);

View file

@ -2,278 +2,292 @@ import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
test("should copy code from playground modal", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
test(
"should copy code from playground modal",
{
tag: ["@release"],
},
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await page.goto("/");
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.goto("/");
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
await page.waitForTimeout(1000);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
await page
.getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat input");
await page.waitForTimeout(1000);
await page
.getByTestId("inputsChat Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await page.waitForTimeout(1000);
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("modelsOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page
.getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat input");
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
await page
.getByTestId("inputsChat Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await page.waitForTimeout(1000);
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const elementsChatInput = await page
.locator('[data-testid="handle-chatinput-shownode-message-right"]')
.all();
await page
.getByTestId("modelsOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
let visibleElementHandle;
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
for (const element of elementsChatInput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
}
// Click and hold on the first element
await page.getByTestId("zoom_in").click();
await page.getByTestId("zoom_in").click();
await page.locator(".react-flow__pane").click();
await visibleElementHandle.hover();
await page.mouse.down();
const elementsOpenAiInput = await page
.locator('[data-testid="handle-openaimodel-shownode-input-left"]')
.all();
for (const element of elementsOpenAiInput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
}
await visibleElementHandle.hover();
await page.mouse.up();
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
const elementsOpenAiOutput = await page
.locator('[data-testid="handle-openaimodel-shownode-text-right"]')
.all();
for (const element of elementsOpenAiOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
}
// Click and hold on the first element
await visibleElementHandle.hover();
await page.mouse.down();
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
// Move to the second element
const elementsChatOutput = await page
.getByTestId("handle-chatoutput-shownode-text-left")
.all();
const elementsChatInput = await page
.locator('[data-testid="handle-chatinput-shownode-message-right"]')
.all();
for (const element of elementsChatOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
let visibleElementHandle;
for (const element of elementsChatInput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
}
await visibleElementHandle.hover();
await page.mouse.up();
// Click and hold on the first element
await page.getByTestId("zoom_in").click();
await page.getByTestId("zoom_in").click();
await page.getByTestId("fit_view").click();
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByTestId("input-chat-playground").click();
await page
.getByTestId("input-chat-playground")
.fill("Could you provide a Python example for a 'Hello, World!' program?");
await page.locator(".react-flow__pane").click();
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
await visibleElementHandle.hover();
await page.mouse.down();
await page.getByTestId("button-send").click();
const elementsOpenAiInput = await page
.locator('[data-testid="handle-openaimodel-shownode-input-left"]')
.all();
await page.getByRole("tab", { name: "python" }).isVisible({
timeout: 100000,
});
await page.waitForSelector('[data-testid="copy-code-button"]', {
state: "visible",
timeout: 30000,
});
await page.waitForTimeout(1000);
await page.getByTestId("copy-code-button").last().click();
const handle = await page.evaluateHandle(() =>
navigator.clipboard.readText(),
);
const clipboardContent = await handle.jsonValue();
expect(clipboardContent.length).toBeGreaterThan(0);
expect(clipboardContent).toContain("Hello");
});
test("playground button should be enabled or disabled", async ({ page }) => {
await page.goto("/");
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
for (const element of elementsOpenAiInput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
} 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 visibleElementHandle.hover();
await page.mouse.up();
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
const elementsOpenAiOutput = await page
.locator('[data-testid="handle-openaimodel-shownode-text-right"]')
.all();
await page.getByTestId("blank-flow").click();
for (const element of elementsOpenAiOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
expect(await page.getByTestId("playground-btn-flow").isDisabled());
// Click and hold on the first element
await visibleElementHandle.hover();
await page.mouse.down();
expect(await page.getByText("Langflow Chat").isHidden());
// Move to the second element
const elementsChatOutput = await page
.getByTestId("handle-chatoutput-shownode-text-left")
.all();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
for (const element of elementsChatOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await page.waitForTimeout(1000);
await visibleElementHandle.hover();
await page.mouse.up();
await page
.locator('//*[@id="outputsChat Output"]')
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByText("Playground", { exact: true }).last().click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {
timeout: 100000,
});
await page.getByTestId("input-chat-playground").click();
await page
.getByTestId("input-chat-playground")
.fill(
"Could you provide a Python example for a 'Hello, World!' program?",
);
await page.waitForTimeout(1000);
await page.waitForSelector('[data-testid="button-send"]', {
timeout: 100000,
});
await page.getByTestId("playground-btn-flow-io").click({ force: true });
await page.getByTestId("button-send").click();
expect(await page.getByText("Langflow Chat").isVisible());
});
await page.getByRole("tab", { name: "python" }).isVisible({
timeout: 100000,
});
await page.waitForSelector('[data-testid="copy-code-button"]', {
state: "visible",
timeout: 30000,
});
await page.waitForTimeout(1000);
await page.getByTestId("copy-code-button").last().click();
const handle = await page.evaluateHandle(() =>
navigator.clipboard.readText(),
);
const clipboardContent = await handle.jsonValue();
expect(clipboardContent.length).toBeGreaterThan(0);
expect(clipboardContent).toContain("Hello");
},
);
test(
"playground button should be enabled or disabled",
{ tag: ["@release", "@api", "@workspace"] },
async ({ page }) => {
await page.goto("/");
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} 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();
expect(await page.getByTestId("playground-btn-flow").isDisabled());
expect(await page.getByText("Langflow Chat").isHidden());
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
await page.waitForTimeout(1000);
await page
.locator('//*[@id="outputsChat Output"]')
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.waitForTimeout(1000);
await page.getByTestId("playground-btn-flow-io").click({ force: true });
expect(await page.getByText("Langflow Chat").isVisible());
},
);

View file

@ -1,44 +1,45 @@
import { expect, test } from "@playwright/test";
test("should be able to see error when something goes wrong on Code Modal", async ({
page,
}) => {
await page.goto("/");
test(
"should be able to see error when something goes wrong on Code Modal",
{ tag: ["@release"] },
async ({ page }) => {
await page.goto("/");
let modalCount = 0;
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
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 MessageTextInput, Output
@ -66,14 +67,17 @@ class CustomComponent(Component):
return data
`;
await page.locator("textarea").press("Control+a");
await page.locator("textarea").fill(customCodeWithError);
await page.locator("textarea").press("Control+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);
const error = await page.getByTestId("title_error_code_modal").textContent();
const error = await page
.getByTestId("title_error_code_modal")
.textContent();
expect(error!.length).toBeGreaterThan(20);
});
expect(error!.length).toBeGreaterThan(20);
},
);

View file

@ -2,96 +2,101 @@ import { expect, test } from "@playwright/test";
import uaParser from "ua-parser-js";
// TODO: This test might not be needed anymore
test("should be able to select all with ctrl + A on advanced modal", async ({
page,
}) => {
await page.goto("/");
test(
"should be able to select all with ctrl + A on advanced modal",
{ tag: ["@release"] },
async ({ page }) => {
await page.goto("/");
let modalCount = 0;
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.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("ollama");
await page.waitForTimeout(1000);
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("ollama");
await page.waitForTimeout(1000);
await page
.getByTestId("embeddingsOllama Embeddings")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page
.getByTestId("embeddingsOllama Embeddings")
.dragTo(page.locator('//*[@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("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.getByTestId("div-generic-node").click();
await page.getByTestId("div-generic-node").click();
await page.keyboard.press(`ControlOrMeta+Shift+A`);
await page.keyboard.press(`ControlOrMeta+Shift+A`);
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page
.getByPlaceholder("Type something...")
.nth(2)
.fill("ollama_test_ctrl_a_first_input");
let value = await page
.getByPlaceholder("Type something...")
.nth(2)
.inputValue();
expect(value).toBe("ollama_test_ctrl_a_first_input");
await page
.getByPlaceholder("Type something...")
.nth(2)
.fill("ollama_test_ctrl_a_first_input");
let value = await page
.getByPlaceholder("Type something...")
.nth(2)
.inputValue();
expect(value).toBe("ollama_test_ctrl_a_first_input");
await page
.getByPlaceholder("Type something...")
.last()
.fill("ollama_test_ctrl_a_second_input");
let secondValue = await page
.getByPlaceholder("Type something...")
.last()
.inputValue();
expect(secondValue).toBe("ollama_test_ctrl_a_second_input");
await page
.getByPlaceholder("Type something...")
.last()
.fill("ollama_test_ctrl_a_second_input");
let secondValue = await page
.getByPlaceholder("Type something...")
.last()
.inputValue();
expect(secondValue).toBe("ollama_test_ctrl_a_second_input");
await page.getByPlaceholder("Type something...").last().click();
await page.waitForTimeout(1000);
await page.getByPlaceholder("Type something...").last().click();
await page.waitForTimeout(1000);
await page.keyboard.press("ControlOrMeta+a");
await page.keyboard.press("ControlOrMeta+a");
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page.keyboard.press("ControlOrMeta+c");
await page.keyboard.press("ControlOrMeta+c");
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page.getByPlaceholder("Type something...").nth(2).click();
await page.getByPlaceholder("Type something...").nth(2).click();
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page.keyboard.press("ControlOrMeta+a");
await page.keyboard.press("ControlOrMeta+a");
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page.keyboard.press("ControlOrMeta+v");
await page.keyboard.press("ControlOrMeta+v");
value = await page.getByPlaceholder("Type something...").nth(2).inputValue();
expect(value).toBe("ollama_test_ctrl_a_second_input");
});
value = await page
.getByPlaceholder("Type something...")
.nth(2)
.inputValue();
expect(value).toBe("ollama_test_ctrl_a_second_input");
},
);

View file

@ -1,43 +1,47 @@
import { test } from "@playwright/test";
test("should interact with api request", async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
test(
"should interact with api request",
{ tag: ["@release"] },
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.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("api request");
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("api request");
await page.waitForTimeout(1000);
await page.waitForTimeout(1000);
await page
.getByTestId("dataAPI Request")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
});
await page
.getByTestId("dataAPI Request")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
},
);