🔧 fix(nodeToolbarComponent): add missing data-testid attribute to the save button to improve testability 🔧 fix(nodeToolbarComponent): add missing data-testid attribute to the edit button to improve testability 🔧 fix(nodeToolbarComponent): add missing data-testid attribute to the duplicate button to improve testability 🔧 fix(codeAreaModalComponent.spec): add click on the blank-flow element before performing other actions to ensure proper test setup 🔧 fix(dropdownComponent.spec): add click on the blank-flow element before performing other actions to ensure proper test setup 🔧 fix(floatComponent.spec): add click on the blank-flow element before performing other actions to ensure proper test setup 🔧 fix(flowPage.spec): add click on the blank-flow element before performing other actions to ensure proper test setup 🔧 fix(group.spec): add click on the blank-flow element before performing other actions to ensure proper test setup 🔧 fix(inputComponent.spec): add click on the blank-flow element before performing other actions to ensure proper test setup 🔧 fix(intComponent.spec): add click on the blank-flow element before performing other actions to ensure proper test setup 🐛 fix(keyPairListComponent.spec.ts): update key pair IDs and values to match test expectations ✨ feat(keyPairListComponent.spec.ts): add support for dynamic key pair creation and deletion 🔀 merge(langflowShortcuts.spec.ts): add end-to-end tests for langflow shortcuts 🔀 merge(nestedComponent.spec.ts): add end-to-end tests for nested components 🔀 merge(promptModalComponent.spec.ts): add end-to-end tests for prompt modal component 🔀 merge(saveComponents.spec.ts): add end-to-end tests for save components ✅ test(toggleComponent.spec.ts): add test case to simulate clicking on "blank-flow" element and waiting for 2 seconds 🐛 fix(toggleComponent.spec.ts): fix typo in test case, change "locator" to "waitForSelector" for better readability
110 lines
3.5 KiB
TypeScript
110 lines
3.5 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.getByTestId("blank-flow").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="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="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="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="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="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="saveChangesBtn"]').click();
|
|
|
|
await page.getByTestId("div-generic-node").click();
|
|
await page.getByTestId("code-button-modal").click();
|
|
}
|
|
});
|