langflow/src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts
cristhianzl 1b7d80a373 🐛 fix(parameterComponent): fix key prop in map function to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in InputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in ToggleShadComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in Dropdown component to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in CodeInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in IntComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in CodeInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in IntComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in CodeInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in IntComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in CodeInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in IntComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in CodeInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in IntComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in CodeInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in IntComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in CodeInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in IntComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in CodeInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in IntComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in CodeInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in IntComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in PromptInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in CodeInputComponent to use name instead of index for better uniqueness
🐛 fix(parameterComponent): fix id prop in IntComponent to use name instead of index for better uniqueness
🐛 fix

🔧 chore(dropdownComponent.spec.ts): comment out unused code to improve code readability and maintainability
🔧 chore(floatComponent.spec.ts): comment out unused code to improve code readability and maintainability
🔧 chore(flowPage.spec.ts): comment out unused code to improve code readability and maintainability
🔧 chore(group.spec.ts): comment out unused code to improve code readability and maintainability

🔧 chore(tests): comment out unused code in inputComponent.spec.ts, intComponent.spec.ts, keyPairListComponent.spec.ts, nestedComponent.spec.ts, saveComponents.spec.ts, and toggleComponent.spec.ts to improve code readability and reduce noise
2024-02-23 18:05:39 -03:00

138 lines
4.6 KiB
TypeScript

import { expect, test } from "@playwright/test";
test("CodeAreaModalComponent", async ({ page }) => {
await page.goto("http://localhost:3000/");
await page.waitForTimeout(2000);
await page.locator('//*[@id="new-project-btn"]').click();
await page.waitForTimeout(2000);
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("pythonfunctiontool");
await page.waitForTimeout(2000);
await page
.getByTestId("toolsPythonFunctionTool")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("code-button-modal").click();
let value = await page.locator('//*[@id="codeValue"]').inputValue();
if (
value !=
'def python_function(text: str) -> str: """This is a default python function that returns the input text""" return text'
) {
expect(false).toBeTruthy();
}
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click();
await page.locator('//*[@id="showcode"]').click();
expect(await page.locator('//*[@id="showcode"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showdescription"]').click();
expect(
await page.locator('//*[@id="showdescription"]').isChecked()
).toBeFalsy();
await page.locator('//*[@id="showname"]').click();
expect(await page.locator('//*[@id="showname"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showreturn_direct"]').click();
expect(
await page.locator('//*[@id="showreturn_direct"]').isChecked()
).toBeFalsy();
await page.locator('//*[@id="showcode"]').click();
expect(await page.locator('//*[@id="showcode"]').isChecked()).toBeTruthy();
await page.locator('//*[@id="showdescription"]').click();
expect(
await page.locator('//*[@id="showdescription"]').isChecked()
).toBeTruthy();
await page.locator('//*[@id="showname"]').click();
expect(await page.locator('//*[@id="showname"]').isChecked()).toBeTruthy();
await page.locator('//*[@id="showreturn_direct"]').click();
expect(
await page.locator('//*[@id="showreturn_direct"]').isChecked()
).toBeTruthy();
await page.locator('//*[@id="showcode"]').click();
expect(await page.locator('//*[@id="showcode"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showdescription"]').click();
expect(
await page.locator('//*[@id="showdescription"]').isChecked()
).toBeFalsy();
await page.locator('//*[@id="showname"]').click();
expect(await page.locator('//*[@id="showname"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="showreturn_direct"]').click();
expect(
await page.locator('//*[@id="showreturn_direct"]').isChecked()
).toBeFalsy();
await page.locator('//*[@id="showcode"]').click();
expect(await page.locator('//*[@id="showcode"]').isChecked()).toBeTruthy();
await page.locator('//*[@id="showdescription"]').click();
expect(
await page.locator('//*[@id="showdescription"]').isChecked()
).toBeTruthy();
await page.locator('//*[@id="showname"]').click();
expect(await page.locator('//*[@id="showname"]').isChecked()).toBeTruthy();
await page.locator('//*[@id="showreturn_direct"]').click();
expect(
await page.locator('//*[@id="showreturn_direct"]').isChecked()
).toBeTruthy();
await page.locator('//*[@id="showcode"]').click();
expect(await page.locator('//*[@id="showcode"]').isChecked()).toBeFalsy();
await page.locator('//*[@id="saveChangesBtn"]').click();
const plusButtonLocator = page.locator('//*[@id="code-input-0"]');
const elementCount = await plusButtonLocator.count();
if (elementCount === 0) {
expect(true).toBeTruthy();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click();
await page.locator('//*[@id="showcode"]').click();
expect(await page.locator('//*[@id="showcode"]').isChecked()).toBeTruthy();
await page.locator('//*[@id="code-area-editcode"]').click();
let value = await page.locator('//*[@id="codeValue"]').inputValue();
if (
value !=
'def python_function(text: str) -> str: """This is a default python function that returns the input text""" return text'
) {
expect(false).toBeTruthy();
}
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await page.locator('//*[@id="saveChangesBtn"]').click();
await page.getByTestId("div-generic-node").click();
await page.getByTestId("code-button-modal").click();
}
});