Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ export default function Dropdown({
{options?.length > 0 && renderSearchInput()}
{renderOptionsList()}
{!sourceOptions?.fields && hasRefreshButton && (
<div className="sticky bottom-0 border-t bg-background">
<div className="border-t bg-background">
<CommandItem className="flex cursor-pointer items-center justify-start gap-2 truncate rounded-b-md py-3 text-xs font-semibold text-muted-foreground">
<Button
className="w-full"
Expand Down
86 changes: 43 additions & 43 deletions src/frontend/tests/core/unit/codeAreaModalComponent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,33 @@ import { test } from "../../fixtures";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";

test(
"CodeAreaModalComponent",
{ tag: ["@release", "@workspace"] },
async ({ page }) => {
await awaitBootstrapTest(page);
"CodeAreaModalComponent",
{ tag: ["@release", "@workspace"] },
async ({ page }) => {
await awaitBootstrapTest(page);

await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 3000,
});
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 3000,
});

await page.getByTestId("blank-flow").click();
await page.getByTestId("blank-flow").click();

await page.getByTestId("canvas_controls_dropdown").click();
await page.getByTestId("canvas_controls_dropdown").click();

await page.waitForSelector('[data-testid="zoom_out"]', {
timeout: 3000,
});
await page.getByTestId("canvas_controls_dropdown").click({ force: true });
await page.waitForSelector('[data-testid="zoom_out"]', {
timeout: 3000,
});
await page.getByTestId("canvas_controls_dropdown").click({ force: true });

await page.getByTestId("sidebar-custom-component-button").click();
await page.getByTestId("sidebar-custom-component-button").click();

await expect(page.getByTestId("code-button-modal")).toBeVisible({
timeout: 3000,
});
await expect(page.getByTestId("code-button-modal")).toBeVisible({
timeout: 3000,
});

await page.getByTestId("code-button-modal").last().click();
await page.getByTestId("code-button-modal").last().click();

const codeInputCode = `
const codeInputCode = `
# from langflow.field_typing import Data
from langflow.custom import Component
from langflow.io import CodeInput, Output
Expand Down Expand Up @@ -62,20 +62,20 @@ class CustomComponent(Component):
sleep(60)
return data`;

await page.locator(".ace_content").click();
await page.keyboard.press(`ControlOrMeta+A`);
await page.locator("textarea").fill(codeInputCode);
await page.locator(".ace_content").click();
await page.keyboard.press(`ControlOrMeta+A`);
await page.locator("textarea").fill(codeInputCode);

await page.getByText("Check & Save").last().click();
await page.getByText("Check & Save").last().click();

await page.getByTestId("div-generic-node").click();
await page.getByTestId("div-generic-node").click();

await page.getByTestId("codearea_code_function_code").click();
await page.getByTestId("codearea_code_function_code").click();

const wCode =
'def python_function(text: str) -> st: """This is a default python function that returns the input text""" return text';
const wCode =
'def python_function(text: str) -> st: """This is a default python function that returns the input text""" return text';

const customComponentCode = `from typing import Callable
const customComponentCode = `from typing import Callable
from langflow.field_typing import Code
from langflow.interface.custom.custom_component import CustomComponent
from langflow.interface.custom.utils import get_function
Expand All @@ -85,19 +85,19 @@ class PythonFunctionComponent(CustomComponent):
"""This is a default python function that returns the input text"""
return text`;

await page.locator(".ace_content").click();
await page.locator("textarea").press("ControlOrMeta+a");
await page.locator("textarea").fill(wCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await expect(
page.getByText("invalid syntax (<unknown>, line 1)"),
).toBeVisible({ timeout: 3000 });
await page.locator("textarea").press("ControlOrMeta+a");
await page.locator("textarea").fill(customComponentCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await expect(page.getByTestId("codearea_code_function_code")).toHaveText(
customComponentCode,
{ timeout: 3000 },
);
},
await page.locator(".ace_content").click();
await page.locator("textarea").press("ControlOrMeta+a");
await page.locator("textarea").fill(wCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await expect(
page.getByText("invalid syntax (<unknown>, line 1)"),
).toBeVisible({ timeout: 3000 });
await page.locator("textarea").press("ControlOrMeta+a");
await page.locator("textarea").fill(customComponentCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
await expect(page.getByTestId("codearea_code_function_code")).toHaveText(
customComponentCode,
{ timeout: 3000 },
);
},
);
Loading