* refactor(components): Rename Parse Data component to Data to Message * Refactor: enhance Data to Message description * Refactor: enhance Data to Message description * feat: add required to template and data inputs * [autofix.ci] apply automated fixes * fix: Update element selectors in freeze.spec.ts * [autofix.ci] apply automated fixes * refactor: rename test IDs for processing data in frontend tests Updated test IDs from "processingParse Data" to "processingData to Message" across multiple test files to improve clarity and consistency in the test suite. This change enhances the readability of the tests related to data processing components. * refactor: update ParseDataComponent to improve clarity and consistency - Renamed the display name and description of the ParseDataComponent from "Data to Message" to "Parse Data" to better reflect its functionality. - Changed the icon from "message-square" to "braces" for a more appropriate visual representation. - Updated input fields to make 'required' status consistent across multiple starter projects, changing 'required' from true to false for 'data' and 'template' inputs. - Enhanced code readability by modifying the structure and comments within the component's implementation across various JSON files. * refactor: update ParseDataComponent across multiple starter projects - Changed the display name and description of the ParseDataComponent from "Parse Data" to "Data to Message" for better clarity. - Updated the icon from "braces" to "message-square" to better represent the component's functionality. - Made input fields 'data' and 'template' required across all affected JSON files to ensure proper data handling. - Enhanced code readability and consistency in the implementation of the ParseDataComponent across various starter projects. * ✨ (freeze.spec.ts): Update test descriptions and selectors to match changes in the application functionality related to data processing and messaging ✨ (stop-building.spec.ts): Update test description and selector to match changes in the application functionality related to data processing and messaging ✨ (fileUploadComponent.spec.ts): Update test description and selector to match changes in the application functionality related to data processing and messaging ✨ (loop-component.spec.ts): Update test description and selector to match changes in the application functionality related to data processing and messaging * fix broken tests --------- Co-authored-by: Eric Hare <ericrhare@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Edwin Jose <edwin.jose@datastax.com> Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org> Co-authored-by: anovazzi1 <otavio2204@gmail.com> Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
369 lines
12 KiB
TypeScript
369 lines
12 KiB
TypeScript
import { test } from "@playwright/test";
|
|
import * as dotenv from "dotenv";
|
|
import path from "path";
|
|
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
|
import { zoomOut } from "../../utils/zoom-out";
|
|
|
|
test(
|
|
"should create a flow with decision",
|
|
{ tag: ["@release", "@components", "@workflow"] },
|
|
|
|
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 awaitBootstrapTest(page);
|
|
|
|
await page.waitForSelector('[data-testid="blank-flow"]', {
|
|
timeout: 30000,
|
|
});
|
|
await page.getByTestId("blank-flow").click();
|
|
|
|
await page.getByTestId("sidebar-options-trigger").click();
|
|
await page
|
|
.getByTestId("sidebar-legacy-switch")
|
|
.isVisible({ timeout: 5000 });
|
|
await page.getByTestId("sidebar-legacy-switch").click();
|
|
|
|
//---------------------------------- CHAT INPUT
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("chat input");
|
|
await page.waitForSelector('[data-testid="inputsChat Input"]', {
|
|
timeout: 500,
|
|
});
|
|
await page
|
|
.getByTestId("inputsChat Input")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
|
await zoomOut(page);
|
|
|
|
//---------------------------------- CREATE LIST
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("list");
|
|
await page.waitForSelector('[data-testid="helpersCreate List"]', {
|
|
timeout: 500,
|
|
});
|
|
await page
|
|
.getByTestId("helpersCreate List")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
|
targetPosition: { x: 100, y: 100 },
|
|
});
|
|
|
|
await page.waitForSelector('[data-testid="input-list-plus-btn_texts-0"]', {
|
|
timeout: 3000,
|
|
state: "attached",
|
|
});
|
|
|
|
await page.getByTestId("input-list-plus-btn_texts-0").first().click();
|
|
await page.getByTestId("input-list-plus-btn_texts-0").first().click();
|
|
await page.getByTestId("input-list-plus-btn_texts-0").first().click();
|
|
await page
|
|
.getByTestId("inputlist_str_texts_0")
|
|
.first()
|
|
.fill("big news! langflow 1.0 is out");
|
|
await page
|
|
.getByTestId("inputlist_str_texts_1")
|
|
.first()
|
|
.fill("uhul that movie was awesome");
|
|
await page
|
|
.getByTestId("inputlist_str_texts_2")
|
|
.first()
|
|
.fill("love you babe");
|
|
await page
|
|
.getByTestId("helpersCreate List")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
|
targetPosition: { x: 300, y: 300 },
|
|
});
|
|
await page.getByTestId("input-list-plus-btn_texts-0").last().click();
|
|
await page.getByTestId("input-list-plus-btn_texts-0").last().click();
|
|
await page.getByTestId("input-list-plus-btn_texts-0").last().click();
|
|
await page
|
|
.getByTestId("inputlist_str_texts_0")
|
|
.last()
|
|
.fill("oh my cat died");
|
|
await page
|
|
.getByTestId("inputlist_str_texts_1")
|
|
.last()
|
|
.fill("No one loves me");
|
|
await page.getByTestId("inputlist_str_texts_2").last().fill("not cool..");
|
|
//---------------------------------- PARSE DATA
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("data to message");
|
|
await page.waitForSelector('[data-testid="processingData to Message"]', {
|
|
timeout: 500,
|
|
});
|
|
await page
|
|
.getByTestId("processingData to Message")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
|
targetPosition: { x: 350, y: 100 },
|
|
});
|
|
await zoomOut(page, 1);
|
|
await page
|
|
.getByTestId("processingData to Message")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
|
targetPosition: { x: 50, y: 300 },
|
|
});
|
|
await zoomOut(page, 2);
|
|
|
|
//---------------------------------- PASS
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("pass");
|
|
await page.waitForSelector('[data-testid="logicPass"]', {
|
|
timeout: 500,
|
|
});
|
|
await page
|
|
.getByTestId("logicPass")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
|
targetPosition: { x: 400, y: 100 },
|
|
});
|
|
await page.waitForSelector('[data-testid="logicPass"]', {
|
|
timeout: 500,
|
|
});
|
|
//---------------------------------- PASS
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("pass");
|
|
await page.waitForSelector('[data-testid="logicPass"]', {
|
|
timeout: 500,
|
|
});
|
|
await page
|
|
.getByTestId("logicPass")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
|
targetPosition: { x: 600, y: 200 },
|
|
});
|
|
await page.waitForSelector('[data-testid="logicPass"]', {
|
|
timeout: 500,
|
|
});
|
|
//---------------------------------- PASS
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("pass");
|
|
await page.waitForSelector('[data-testid="logicPass"]', {
|
|
timeout: 500,
|
|
});
|
|
await page
|
|
.getByTestId("logicPass")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
|
targetPosition: { x: 650, y: 350 },
|
|
});
|
|
await page.waitForSelector('[data-testid="logicPass"]', {
|
|
timeout: 500,
|
|
});
|
|
zoomOut(page, 2);
|
|
//---------------------------------- PROMPT
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("prompt");
|
|
await page.waitForSelector('[data-testid="promptsPrompt"]', {
|
|
timeout: 500,
|
|
});
|
|
await page
|
|
.getByTestId("promptsPrompt")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
|
targetPosition: { x: 50, y: 150 },
|
|
});
|
|
|
|
//---------------------------------- OPENAI
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("openai");
|
|
await page.waitForSelector('[data-testid="modelsOpenAI"]', {
|
|
timeout: 500,
|
|
});
|
|
await page
|
|
.getByTestId("modelsOpenAI")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
|
targetPosition: { x: 50, y: 300 },
|
|
});
|
|
|
|
//---------------------------------- CONDITIONAL ROUTER
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("if else");
|
|
await page.waitForSelector('[data-testid="logicIf-Else"]', {
|
|
timeout: 500,
|
|
});
|
|
await page
|
|
.getByTestId("logicIf-Else")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
|
targetPosition: { x: 750, y: 150 },
|
|
});
|
|
//---------------------------------- CHAT OUTPUT
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("chat output");
|
|
await page.waitForSelector('[data-testid="outputsChat Output"]', {
|
|
timeout: 500,
|
|
});
|
|
await page
|
|
.getByTestId("outputsChat Output")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
|
targetPosition: { x: 100, y: 75 },
|
|
});
|
|
await page.waitForSelector('[data-testid="outputsChat Output"]', {
|
|
timeout: 500,
|
|
});
|
|
//---------------------------------- CHAT OUTPUT
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("chat output");
|
|
await page.waitForSelector('[data-testid="outputsChat Output"]', {
|
|
timeout: 500,
|
|
});
|
|
await page
|
|
.getByTestId("outputsChat Output")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
|
targetPosition: { x: 250, y: 75 },
|
|
});
|
|
await page.waitForSelector('[data-testid="outputsChat Output"]', {
|
|
timeout: 500,
|
|
});
|
|
//----------------------------------
|
|
await page.getByTestId("fit_view").click();
|
|
//---------------------------------- EDIT PROMPT
|
|
await page.getByTestId("promptarea_prompt_template").first().click();
|
|
await page.getByTestId("modal-promptarea_prompt_template").first().fill(`
|
|
{Condition}
|
|
Answer with either TRUE or FALSE (and nothing else).
|
|
TRUE Examples:
|
|
{true_examples}
|
|
FALSE Examples:
|
|
{false_examples}
|
|
User: {user_message}
|
|
AI:
|
|
`);
|
|
await page.getByText("Check & Save").last().click();
|
|
//---------------------------------- MAKE CONNECTIONS
|
|
await page
|
|
.getByTestId("handle-createlist-shownode-data list-right")
|
|
.nth(0)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-parsedata-shownode-data-left")
|
|
.nth(0)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-createlist-shownode-data list-right")
|
|
.nth(2)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-parsedata-shownode-data-left")
|
|
.nth(1)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-chatinput-noshownode-message-source")
|
|
.nth(0)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-pass-shownode-input message-left")
|
|
.nth(2)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-parsedata-shownode-message-right")
|
|
.nth(0)
|
|
.click();
|
|
//quebrando aqui
|
|
await page
|
|
.getByTestId("handle-prompt-shownode-true_examples-left")
|
|
.nth(0)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-parsedata-shownode-message-right")
|
|
.nth(2)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-prompt-shownode-false_examples-left")
|
|
.nth(0)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-pass-shownode-output message-right")
|
|
.nth(4)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-prompt-shownode-user_message-left")
|
|
.nth(0)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-prompt-shownode-prompt message-right")
|
|
.first()
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-openaimodel-shownode-input-left")
|
|
.nth(0)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-openaimodel-shownode-message-right")
|
|
.nth(0)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-conditionalrouter-shownode-text input-left")
|
|
.nth(0)
|
|
.click();
|
|
await page.getByTestId("popover-anchor-input-match_text").fill("TRUE");
|
|
await page.getByTestId("title-Pass").nth(1).click();
|
|
await page.getByTestId("edit-button-modal").click();
|
|
await page
|
|
.getByTestId("popover-anchor-input-input_message-edit")
|
|
.nth(0)
|
|
.fill("You're Happy! 🤪");
|
|
await page.getByTestId("showignored_message").last().click();
|
|
await page.getByText("Close").last().click();
|
|
await page.getByTestId("title-Pass").nth(0).click();
|
|
await page.getByTestId("edit-button-modal").click();
|
|
await page
|
|
.getByTestId("popover-anchor-input-input_message-edit")
|
|
.nth(0)
|
|
.fill("You're Sad! 🥲");
|
|
await page.getByTestId("showignored_message").last().click();
|
|
await page.getByText("Close").last().click();
|
|
await page
|
|
.getByTestId("handle-conditionalrouter-shownode-true-right")
|
|
.nth(0)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-pass-shownode-ignored message-left")
|
|
.nth(1)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-conditionalrouter-shownode-false-right")
|
|
.nth(0)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-pass-shownode-ignored message-left")
|
|
.nth(0)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-pass-shownode-output message-right")
|
|
.nth(2)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-chatoutput-noshownode-text-target")
|
|
.nth(0)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-pass-shownode-output message-right")
|
|
.nth(0)
|
|
.click();
|
|
await page
|
|
.getByTestId("handle-chatoutput-noshownode-text-target")
|
|
.nth(1)
|
|
.click();
|
|
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
|
|
const isApiKeyInputVisible = await apiKeyInput.isVisible();
|
|
if (isApiKeyInputVisible) {
|
|
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
|
|
}
|
|
await page.getByTestId("dropdown_str_model_name").click();
|
|
await page.getByTestId("gpt-4o-1-option").click();
|
|
await page.getByTestId("fit_view").click();
|
|
await page.getByText("Playground", { exact: true }).last().click();
|
|
await page.waitForSelector('[data-testid="input-chat-playground"]', {
|
|
timeout: 100000,
|
|
});
|
|
await page.getByTestId("input-chat-playground").click();
|
|
await page
|
|
.getByTestId("input-chat-playground")
|
|
.fill("my dog is alive and happy!");
|
|
await page.waitForSelector('[data-testid="button-send"]', {
|
|
timeout: 100000,
|
|
});
|
|
|
|
await page.getByTestId("button-send").last().click();
|
|
},
|
|
);
|