langflow/src/frontend/tests/extended/features/edit-tools.spec.ts
Lucas Oliveira 75deddd102
fix: re-add name and description editing on tool mode except for Composio, fix MCP server code (#7901)
* Changed backend to contain readonly props for tools

* Show name editing for not readonly tools

* Fixed edit-tools test

* Updated command to use "uvx" instead of "npx" for stability

* Fixed mcp code for authentication on auto_login=false

* removed args from component desc

* [autofix.ci] apply automated fixes

* making tool mode inputs the priority.

* fix: Clean up comments and whitespace in component_tool.py

* Fix column name

* update the dispaly name in composio

* fix format

*  (get-started-progress.tsx): add data-testid attribute to improve testability and accessibility
🔧 (user-progress-track.spec.ts): update test assertions to use the new data-testid attribute for get started progress title

---------

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: cristhianzl <cristhian.lousa@gmail.com>
2025-05-05 21:20:19 +00:00

206 lines
5.2 KiB
TypeScript

import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test(
"user should be able to edit tools",
{ tag: ["@release", "@components"] },
async ({ page }) => {
await awaitBootstrapTest(page);
await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("api request");
await page.waitForSelector('[data-testid="dataAPI Request"]', {
timeout: 3000,
});
await page
.getByTestId("dataAPI Request")
.hover()
.then(async () => {
await page.getByTestId("add-component-button-api-request").click();
});
await page.waitForSelector(
'[data-testid="generic-node-title-arrangement"]',
{
timeout: 3000,
},
);
await page.getByTestId("generic-node-title-arrangement").click();
await page.waitForTimeout(500);
await page.getByTestId("tool-mode-button").click();
await page.locator('[data-testid="icon-Hammer"]').nth(0).waitFor({
timeout: 3000,
state: "visible",
});
await page.waitForSelector("text=actions", { timeout: 30000 });
await page.getByTestId("button_open_actions").click();
await page.waitForSelector("text=API Request", { timeout: 30000 });
const rowsCount = await page.getByRole("gridcell").count();
expect(rowsCount).toBeGreaterThan(3);
expect(
await page.locator('input[data-ref="eInput"]').nth(0).isChecked(),
).toBe(true);
expect(
await page.locator('input[data-ref="eInput"]').nth(3).isChecked(),
).toBe(true);
expect(
await page.locator('input[data-ref="eInput"]').nth(4).isChecked(),
).toBe(true);
await page.locator('input[data-ref="eInput"]').nth(0).click();
await page.waitForTimeout(500);
expect(
await page.locator('input[data-ref="eInput"]').nth(3).isChecked(),
).toBe(false);
expect(
await page.locator('input[data-ref="eInput"]').nth(4).isChecked(),
).toBe(false);
await page.locator('input[data-ref="eInput"]').nth(0).click();
await page.waitForTimeout(500);
await page.getByRole("gridcell").nth(0).click();
await page.waitForTimeout(500);
expect(
await page.locator('[data-testid="sidebar_header_name"]').isHidden(),
).toBe(true);
expect(
await page
.locator('[data-testid="sidebar_header_description"]')
.isHidden(),
).toBe(true);
expect(
await page.locator('[data-testid="input_update_name"]').isVisible(),
).toBe(true);
expect(
await page
.locator('[data-testid="input_update_description"]')
.isVisible(),
).toBe(true);
await page.locator('[data-testid="input_update_name"]').fill("test name");
await page.waitForTimeout(500);
await page
.locator('[data-testid="input_update_description"]')
.fill("test description");
await page.waitForTimeout(500);
await page.getByText("Close").last().click();
await page.waitForTimeout(500);
expect(await page.getByTestId("tool_test_name").isVisible()).toBe(true);
await page.waitForSelector(
'[data-testid="generic-node-title-arrangement"]',
{
timeout: 3000,
},
);
await page.waitForSelector('[data-testid="div-tools_tools_metadata"]', {
timeout: 3000,
});
expect(
await page
.locator('[data-testid="div-tools_tools_metadata"]')
.isVisible(),
).toBe(true);
await page.getByTestId("button_open_actions").click();
await page.waitForTimeout(500);
expect(
await page.locator('input[data-ref="eInput"]').nth(3).isChecked(),
).toBe(true);
expect(
await page.locator('input[data-ref="eInput"]').nth(4).isChecked(),
).toBe(true);
await page.locator('input[data-ref="eInput"]').nth(4).click();
await page.waitForTimeout(500);
expect(
await page.locator('input[data-ref="eInput"]').nth(4).isChecked(),
).toBe(false);
await page.getByRole("gridcell").nth(0).click();
await page.waitForTimeout(500);
expect(
await page.locator('[data-testid="sidebar_header_name"]').isHidden(),
).toBe(true);
expect(
await page
.locator('[data-testid="sidebar_header_description"]')
.isHidden(),
).toBe(true);
expect(
await page.locator('[data-testid="input_update_name"]').isVisible(),
).toBe(true);
expect(
await page
.locator('[data-testid="input_update_description"]')
.isVisible(),
).toBe(true);
expect(
await page.locator('[data-testid="input_update_name"]').inputValue(),
).toBe("test_name");
expect(
await page
.locator('[data-testid="input_update_description"]')
.inputValue(),
).toBe("test description");
await page.locator('[data-testid="input_update_name"]').fill("");
await page.waitForTimeout(500);
await page.locator('[data-testid="input_update_description"]').fill("");
await page.waitForTimeout(500);
await page.getByText("Close").last().click();
expect(
await page.locator('[data-testid="tool_make_requests"]').isVisible(),
).toBe(true);
},
);