Merge remote-tracking branch 'origin/dev' into fix_chat

This commit is contained in:
ogabrielluiz 2024-06-11 15:51:18 -03:00
commit 4e6abc732b
12 changed files with 87 additions and 91 deletions

View file

@ -138,7 +138,7 @@ export default function CodeTabsComponent({
<Label <Label
className={cn( className={cn(
"relative right-1 top-[4px] text-xs font-medium text-muted-foreground", "relative right-1 top-[4px] text-xs font-medium text-muted-foreground",
activeTweaks ? "text-primary" : "", activeTweaks ? "text-primary" : ""
)} )}
htmlFor="tweaks-switch" htmlFor="tweaks-switch"
> >
@ -193,7 +193,7 @@ export default function CodeTabsComponent({
<div className="api-modal-according-display"> <div className="api-modal-according-display">
<div <div
className={classNames( className={classNames(
"h-[70vh] w-full overflow-y-auto overflow-x-hidden rounded-lg bg-muted custom-scroll", "h-[70vh] w-full overflow-y-auto overflow-x-hidden rounded-lg bg-muted custom-scroll"
)} )}
> >
{data?.map((node: any, i) => ( {data?.map((node: any, i) => (
@ -232,8 +232,8 @@ export default function CodeTabsComponent({
.show && .show &&
LANGFLOW_SUPPORTED_TYPES.has( LANGFLOW_SUPPORTED_TYPES.has(
node.data.node.template[templateField] node.data.node.template[templateField]
.type, .type
), )
) )
.map((templateField, indx) => { .map((templateField, indx) => {
return ( return (
@ -291,7 +291,7 @@ export default function CodeTabsComponent({
target, target,
node.data.node.template[ node.data.node.template[
templateField templateField
], ]
); );
}} }}
/> />
@ -337,7 +337,7 @@ export default function CodeTabsComponent({
target, target,
node.data.node.template[ node.data.node.template[
templateField templateField
], ]
); );
}} }}
/> />
@ -390,7 +390,7 @@ export default function CodeTabsComponent({
target, target,
node.data.node.template[ node.data.node.template[
templateField templateField
], ]
); );
}} }}
/> />
@ -427,7 +427,7 @@ export default function CodeTabsComponent({
e, e,
node.data.node.template[ node.data.node.template[
templateField templateField
], ]
); );
}} }}
size="small" size="small"
@ -458,7 +458,7 @@ export default function CodeTabsComponent({
].fileTypes ].fileTypes
} }
onFileChange={( onFileChange={(
value: any, value: any
) => { ) => {
node.data.node.template[ node.data.node.template[
templateField templateField
@ -511,7 +511,7 @@ export default function CodeTabsComponent({
target, target,
node.data.node.template[ node.data.node.template[
templateField templateField
], ]
); );
}} }}
/> />
@ -551,7 +551,7 @@ export default function CodeTabsComponent({
target, target,
node.data.node.template[ node.data.node.template[
templateField templateField
], ]
); );
}} }}
value={ value={
@ -613,7 +613,7 @@ export default function CodeTabsComponent({
target, target,
node.data.node.template[ node.data.node.template[
templateField templateField
], ]
); );
}} }}
/> />
@ -659,7 +659,7 @@ export default function CodeTabsComponent({
target, target,
node.data.node.template[ node.data.node.template[
templateField templateField
], ]
); );
}} }}
/> />
@ -705,7 +705,7 @@ export default function CodeTabsComponent({
target, target,
node.data.node.template[ node.data.node.template[
templateField templateField
], ]
); );
}} }}
/> />
@ -737,8 +737,8 @@ export default function CodeTabsComponent({
].value, ].value,
type( type(
node, node,
templateField, templateField
), )
) )
} }
duplicateKey={ duplicateKey={
@ -747,15 +747,15 @@ export default function CodeTabsComponent({
onChange={(target) => { onChange={(target) => {
const valueToNumbers = const valueToNumbers =
convertValuesToNumbers( convertValuesToNumbers(
target, target
); );
node.data.node!.template[ node.data.node!.template[
templateField templateField
].value = valueToNumbers; ].value = valueToNumbers;
setErrorDuplicateKey( setErrorDuplicateKey(
hasDuplicateKeys( hasDuplicateKeys(
valueToNumbers, valueToNumbers
), )
); );
setData((old) => { setData((old) => {
let newInputList = let newInputList =
@ -772,7 +772,7 @@ export default function CodeTabsComponent({
target, target,
node.data.node.template[ node.data.node.template[
templateField templateField
], ]
); );
}} }}
isList={ isList={
@ -820,7 +820,7 @@ export default function CodeTabsComponent({
target, target,
node.data.node.template[ node.data.node.template[
templateField templateField
], ]
); );
}} }}
/> />

View file

@ -50,7 +50,7 @@ export default function NodeToolbarComponent({
const [showconfirmShare, setShowconfirmShare] = useState(false); const [showconfirmShare, setShowconfirmShare] = useState(false);
const [showOverrideModal, setShowOverrideModal] = useState(false); const [showOverrideModal, setShowOverrideModal] = useState(false);
const [flowComponent, setFlowComponent] = useState<FlowType>( const [flowComponent, setFlowComponent] = useState<FlowType>(
createFlowComponent(cloneDeep(data), version), createFlowComponent(cloneDeep(data), version)
); );
const preventDefault = true; const preventDefault = true;
const isMac = navigator.platform.toUpperCase().includes("MAC"); const isMac = navigator.platform.toUpperCase().includes("MAC");
@ -67,7 +67,7 @@ export default function NodeToolbarComponent({
data.node.template[templateField].type === "Any" || data.node.template[templateField].type === "Any" ||
data.node.template[templateField].type === "int" || data.node.template[templateField].type === "int" ||
data.node.template[templateField].type === "dict" || data.node.template[templateField].type === "dict" ||
data.node.template[templateField].type === "NestedDict"), data.node.template[templateField].type === "NestedDict")
).length; ).length;
const hasStore = useStoreStore((state) => state.hasStore); const hasStore = useStoreStore((state) => state.hasStore);
@ -220,7 +220,7 @@ export default function NodeToolbarComponent({
const updateNodeInternals = useUpdateNodeInternals(); const updateNodeInternals = useUpdateNodeInternals();
const setLastCopiedSelection = useFlowStore( const setLastCopiedSelection = useFlowStore(
(state) => state.setLastCopiedSelection, (state) => state.setLastCopiedSelection
); );
const setSuccessData = useAlertStore((state) => state.setSuccessData); const setSuccessData = useAlertStore((state) => state.setSuccessData);
@ -294,7 +294,7 @@ export default function NodeToolbarComponent({
nodes, nodes,
edges, edges,
setNodes, setNodes,
setEdges, setEdges
); );
break; break;
case "override": case "override":
@ -321,14 +321,14 @@ export default function NodeToolbarComponent({
y: 10, y: 10,
paneX: nodes.find((node) => node.id === data.id)?.position.x, paneX: nodes.find((node) => node.id === data.id)?.position.x,
paneY: nodes.find((node) => node.id === data.id)?.position.y, paneY: nodes.find((node) => node.id === data.id)?.position.y,
}, }
); );
break; break;
} }
}; };
const isSaved = flows.some((flow) => const isSaved = flows.some((flow) =>
Object.values(flow).includes(data.node?.display_name!), Object.values(flow).includes(data.node?.display_name!)
); );
function displayShortcut({ function displayShortcut({
@ -346,7 +346,7 @@ export default function NodeToolbarComponent({
} }
}); });
const filteredShortcut = fixedShortcut.filter( const filteredShortcut = fixedShortcut.filter(
(key) => !key.toLowerCase().includes("shift"), (key) => !key.toLowerCase().includes("shift")
); );
let shortcutWPlus: string[] = []; let shortcutWPlus: string[] = [];
if (!hasShift) shortcutWPlus = filteredShortcut.join("+").split(" "); if (!hasShift) shortcutWPlus = filteredShortcut.join("+").split(" ");
@ -370,7 +370,7 @@ export default function NodeToolbarComponent({
const setNode = useFlowStore((state) => state.setNode); const setNode = useFlowStore((state) => state.setNode);
const handleOnNewValue = ( const handleOnNewValue = (
newValue: string | string[] | boolean | Object[], newValue: string | string[] | boolean | Object[]
): void => { ): void => {
if (data.node!.template[name].value !== newValue) { if (data.node!.template[name].value !== newValue) {
takeSnapshot(); takeSnapshot();
@ -426,8 +426,8 @@ export default function NodeToolbarComponent({
<ShadTooltip <ShadTooltip
content={displayShortcut( content={displayShortcut(
shortcuts.find( shortcuts.find(
({ name }) => name.split(" ")[0].toLowerCase() === "code", ({ name }) => name.split(" ")[0].toLowerCase() === "code"
)!, )!
)} )}
side="top" side="top"
> >
@ -446,8 +446,8 @@ export default function NodeToolbarComponent({
<ShadTooltip <ShadTooltip
content={displayShortcut( content={displayShortcut(
shortcuts.find( shortcuts.find(
({ name }) => name.split(" ")[0].toLowerCase() === "advanced", ({ name }) => name.split(" ")[0].toLowerCase() === "advanced"
)!, )!
)} )}
side="top" side="top"
> >
@ -458,7 +458,7 @@ export default function NodeToolbarComponent({
onClick={() => { onClick={() => {
setShowModalAdvanced(true); setShowModalAdvanced(true);
}} }}
data-testid="code-button-modal" data-testid="advanced-button-modal"
> >
<IconComponent name="Settings2" className="h-4 w-4" /> <IconComponent name="Settings2" className="h-4 w-4" />
</button> </button>
@ -486,14 +486,14 @@ export default function NodeToolbarComponent({
<ShadTooltip <ShadTooltip
content={displayShortcut( content={displayShortcut(
shortcuts.find( shortcuts.find(
({ name }) => name.split(" ")[0].toLowerCase() === "freeze", ({ name }) => name.split(" ")[0].toLowerCase() === "freeze"
)!, )!
)} )}
side="top" side="top"
> >
<button <button
className={classNames( className={classNames(
"relative -ml-px inline-flex items-center bg-background px-2 py-2 text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10", "relative -ml-px inline-flex items-center bg-background px-2 py-2 text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10"
)} )}
onClick={(event) => { onClick={(event) => {
event.preventDefault(); event.preventDefault();
@ -514,7 +514,7 @@ export default function NodeToolbarComponent({
className={cn( className={cn(
"h-4 w-4 transition-all", "h-4 w-4 transition-all",
// TODO UPDATE THIS COLOR TO BE A VARIABLE // TODO UPDATE THIS COLOR TO BE A VARIABLE
frozen ? "animate-wiggle text-ice" : "", frozen ? "animate-wiggle text-ice" : ""
)} )}
/> />
</button> </button>
@ -542,7 +542,7 @@ export default function NodeToolbarComponent({
<div <div
data-testid="more-options-modal" data-testid="more-options-modal"
className={classNames( className={classNames(
"relative -ml-px inline-flex h-8 w-[31px] items-center rounded-r-md bg-background text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10", "relative -ml-px inline-flex h-8 w-[31px] items-center rounded-r-md bg-background text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10"
)} )}
> >
<IconComponent <IconComponent
@ -710,7 +710,9 @@ export default function NodeToolbarComponent({
/>{" "} />{" "}
<span className="">Delete</span>{" "} <span className="">Delete</span>{" "}
<span <span
className={` absolute right-2 top-2 flex items-center justify-center rounded-sm px-1 py-[0.2] ${deleteIsFocus ? " " : "bg-muted"}`} className={` absolute right-2 top-2 flex items-center justify-center rounded-sm px-1 py-[0.2] ${
deleteIsFocus ? " " : "bg-muted"
}`}
> >
<IconComponent <IconComponent
name="Delete" name="Delete"

View file

@ -52,13 +52,11 @@ test("user must interact with chat with Input/Output", async ({ page }) => {
expect(valueUser).toBe("User"); expect(valueUser).toBe("User");
expect(valueAI).toBe("AI"); expect(valueAI).toBe("AI");
await page.keyboard.press("Escape");
await page await page
.getByTestId("textarea-input_value") .getByTestId("textarea-input_value")
.nth(1) .nth(1)
.fill( .fill(
"testtesttesttesttesttestte;.;.,;,.;,.;.,;,..,;;;;;;;;;;;;;;;;;;;;;,;.;,.;,.,;.,;.;.,~~çççççççççççççççççççççççççççççççççççççççisdajfdasiopjfaodisjhvoicxjiovjcxizopjviopasjioasfhjaiohf23432432432423423sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestççççççççççççççççççççççççççççççççç,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,!", "testtesttesttesttesttestte;.;.,;,.;,.;.,;,..,;;;;;;;;;;;;;;;;;;;;;,;.;,.;,.,;.,;.;.,~~çççççççççççççççççççççççççççççççççççççççisdajfdasiopjfaodisjhvoicxjiovjcxizopjviopasjioasfhjaiohf23432432432423423sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestççççççççççççççççççççççççççççççççç,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,!"
); );
await page.getByTestId("icon-LucideSend").click(); await page.getByTestId("icon-LucideSend").click();
await page.getByText("Close", { exact: true }).click(); await page.getByText("Close", { exact: true }).click();
@ -89,9 +87,9 @@ test("user must interact with chat with Input/Output", async ({ page }) => {
await page await page
.getByText( .getByText(
"testtesttesttesttesttestte;.;.,;,.;,.;.,;,..,;;;;;;;;;;;;;;;;;;;;;,;.;,.;,.,;.,;.;.,~~çççççççççççççççççççççççççççççççççççççççisdajfdasiopjfaodisjhvoicxjiovjcxizopjviopasjioasfhjaiohf23432432432423423sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestççççççççççççççççççççççççççççççççç,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,!", "testtesttesttesttesttestte;.;.,;,.;,.;.,;,..,;;;;;;;;;;;;;;;;;;;;;,;.;,.;,.,;.,;.;.,~~çççççççççççççççççççççççççççççççççççççççisdajfdasiopjfaodisjhvoicxjiovjcxizopjviopasjioasfhjaiohf23432432432423423sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestççççççççççççççççççççççççççççççççç,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,!",
{ exact: true }, { exact: true }
) )
.isVisible(), .isVisible()
); );
}); });
@ -195,17 +193,13 @@ test("user must be able to send an image on chat", async ({ page }) => {
await page.getByText("Chat Input", { exact: true }).click(); await page.getByText("Chat Input", { exact: true }).click();
await page.getByTestId("more-options-modal").click(); await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click(); await page.getByTestId("edit-button-modal").click();
await page.getByTestId("toggle-edit-return_record").click();
expect(
await page.getByTestId("toggle-edit-return_record").isChecked(),
).toBeTruthy();
await page.getByText("Save Changes").click(); await page.getByText("Save Changes").click();
await page.getByText("Playground", { exact: true }).click(); await page.getByText("Playground", { exact: true }).click();
const jsonContent = readFileSync( const jsonContent = readFileSync(
"src/frontend/tests/end-to-end/assets/chain.png", "src/frontend/tests/end-to-end/assets/chain.png",
"utf-8", "utf-8"
); );
// Create the DataTransfer and File // Create the DataTransfer and File

View file

@ -21,9 +21,9 @@ test("curl_api_generation", async ({ page, context }) => {
await page.waitForTimeout(2000); await page.waitForTimeout(2000);
await page.getByText("API", { exact: true }).click(); await page.getByText("API", { exact: true }).click();
await page.getByRole("tab", { name: "cURL" }).click(); await page.getByRole("tab", { name: "cURL" }).click();
await page.getByRole("button", { name: "Copy Code" }).click(); await page.getByTestId("icon-Copy").last().click();
const handle = await page.evaluateHandle(() => const handle = await page.evaluateHandle(() =>
navigator.clipboard.readText(), navigator.clipboard.readText()
); );
const clipboardContent = await handle.jsonValue(); const clipboardContent = await handle.jsonValue();
expect(clipboardContent.length).toBeGreaterThan(0); expect(clipboardContent.length).toBeGreaterThan(0);

View file

@ -87,77 +87,77 @@ test("IntComponent", async ({ page }) => {
await page.locator('//*[@id="showmodel_kwargs"]').click(); await page.locator('//*[@id="showmodel_kwargs"]').click();
expect( expect(
await page.locator('//*[@id="showmodel_kwargs"]').isChecked(), await page.locator('//*[@id="showmodel_kwargs"]').isChecked()
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="showmodel_name"]').click(); await page.locator('//*[@id="showmodel_name"]').click();
expect( expect(
await page.locator('//*[@id="showmodel_name"]').isChecked(), await page.locator('//*[@id="showmodel_name"]').isChecked()
).toBeFalsy(); ).toBeFalsy();
await page.locator('//*[@id="showopenai_api_base"]').click(); await page.locator('//*[@id="showopenai_api_base"]').click();
expect( expect(
await page.locator('//*[@id="showopenai_api_base"]').isChecked(), await page.locator('//*[@id="showopenai_api_base"]').isChecked()
).toBeFalsy(); ).toBeTruthy();
await page.locator('//*[@id="showopenai_api_key"]').click(); await page.locator('//*[@id="showopenai_api_key"]').click();
expect( expect(
await page.locator('//*[@id="showopenai_api_key"]').isChecked(), await page.locator('//*[@id="showopenai_api_key"]').isChecked()
).toBeFalsy(); ).toBeFalsy();
await page.locator('//*[@id="showtemperature"]').click(); await page.locator('//*[@id="showtemperature"]').click();
expect( expect(
await page.locator('//*[@id="showtemperature"]').isChecked(), await page.locator('//*[@id="showtemperature"]').isChecked()
).toBeFalsy(); ).toBeFalsy();
await page.locator('//*[@id="showmodel_kwargs"]').click(); await page.locator('//*[@id="showmodel_kwargs"]').click();
expect( expect(
await page.locator('//*[@id="showmodel_kwargs"]').isChecked(), await page.locator('//*[@id="showmodel_kwargs"]').isChecked()
).toBeFalsy(); ).toBeFalsy();
await page.locator('//*[@id="showmodel_name"]').click(); await page.locator('//*[@id="showmodel_name"]').click();
expect( expect(
await page.locator('//*[@id="showmodel_name"]').isChecked(), await page.locator('//*[@id="showmodel_name"]').isChecked()
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="showopenai_api_base"]').click(); await page.locator('//*[@id="showopenai_api_base"]').click();
expect( expect(
await page.locator('//*[@id="showopenai_api_base"]').isChecked(), await page.locator('//*[@id="showopenai_api_base"]').isChecked()
).toBeTruthy(); ).toBeFalsy();
await page.locator('//*[@id="showopenai_api_key"]').click(); await page.locator('//*[@id="showopenai_api_key"]').click();
expect( expect(
await page.locator('//*[@id="showopenai_api_key"]').isChecked(), await page.locator('//*[@id="showopenai_api_key"]').isChecked()
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="showtemperature"]').click(); await page.locator('//*[@id="showtemperature"]').click();
expect( expect(
await page.locator('//*[@id="showtemperature"]').isChecked(), await page.locator('//*[@id="showtemperature"]').isChecked()
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="showmodel_kwargs"]').click(); await page.locator('//*[@id="showmodel_kwargs"]').click();
expect( expect(
await page.locator('//*[@id="showmodel_kwargs"]').isChecked(), await page.locator('//*[@id="showmodel_kwargs"]').isChecked()
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="showmodel_name"]').click(); await page.locator('//*[@id="showmodel_name"]').click();
expect( expect(
await page.locator('//*[@id="showmodel_name"]').isChecked(), await page.locator('//*[@id="showmodel_name"]').isChecked()
).toBeFalsy(); ).toBeFalsy();
await page.locator('//*[@id="showopenai_api_base"]').click(); await page.locator('//*[@id="showopenai_api_base"]').click();
expect( expect(
await page.locator('//*[@id="showopenai_api_base"]').isChecked(), await page.locator('//*[@id="showopenai_api_base"]').isChecked()
).toBeFalsy(); ).toBeTruthy();
await page.locator('//*[@id="showopenai_api_key"]').click(); await page.locator('//*[@id="showopenai_api_key"]').click();
expect( expect(
await page.locator('//*[@id="showopenai_api_key"]').isChecked(), await page.locator('//*[@id="showopenai_api_key"]').isChecked()
).toBeFalsy(); ).toBeFalsy();
await page.locator('//*[@id="showtemperature"]').click(); await page.locator('//*[@id="showtemperature"]').click();
expect( expect(
await page.locator('//*[@id="showtemperature"]').isChecked(), await page.locator('//*[@id="showtemperature"]').isChecked()
).toBeFalsy(); ).toBeFalsy();
await page.getByText("Save Changes", { exact: true }).click(); await page.getByText("Save Changes", { exact: true }).click();
@ -172,7 +172,7 @@ test("IntComponent", async ({ page }) => {
await page.locator('//*[@id="showtimeout"]').click(); await page.locator('//*[@id="showtimeout"]').click();
expect( expect(
await page.locator('//*[@id="showtimeout"]').isChecked(), await page.locator('//*[@id="showtimeout"]').isChecked()
).toBeTruthy(); ).toBeTruthy();
const valueEditNode = await page const valueEditNode = await page

View file

@ -30,8 +30,6 @@ test("should able to see and interact with logs", async ({ page }) => {
await page.getByText("No Data Available", { exact: true }).isVisible(); await page.getByText("No Data Available", { exact: true }).isVisible();
await page.keyboard.press("Escape"); await page.keyboard.press("Escape");
await page.getByText("Close").last().click();
await page await page
.getByTestId("popover-anchor-input-openai_api_key") .getByTestId("popover-anchor-input-openai_api_key")
.fill(process.env.OPENAI_API_KEY ?? ""); .fill(process.env.OPENAI_API_KEY ?? "");

View file

@ -72,6 +72,8 @@ test("PromptTemplateComponent", async ({ page }) => {
expect(false).toBeTruthy(); expect(false).toBeTruthy();
} }
await page.getByTestId("more-options-modal").click();
await page.getByTestId("save-button-modal").click(); await page.getByTestId("save-button-modal").click();
const replace = await page.getByTestId("replace-button").isVisible(); const replace = await page.getByTestId("replace-button").isVisible();
@ -138,7 +140,7 @@ test("PromptTemplateComponent", async ({ page }) => {
await page.locator('//*[@id="showtemplate"]').click(); await page.locator('//*[@id="showtemplate"]').click();
expect( expect(
await page.locator('//*[@id="showtemplate"]').isChecked(), await page.locator('//*[@id="showtemplate"]').isChecked()
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="showprompt"]').click(); await page.locator('//*[@id="showprompt"]').click();
@ -158,7 +160,7 @@ test("PromptTemplateComponent", async ({ page }) => {
await page.locator('//*[@id="showtemplate"]').click(); await page.locator('//*[@id="showtemplate"]').click();
expect( expect(
await page.locator('//*[@id="showtemplate"]').isChecked(), await page.locator('//*[@id="showtemplate"]').isChecked()
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="showprompt"]').click(); await page.locator('//*[@id="showprompt"]').click();

View file

@ -21,9 +21,9 @@ test("python_api_generation", async ({ page, context }) => {
await page.waitForTimeout(2000); await page.waitForTimeout(2000);
await page.getByText("API", { exact: true }).click(); await page.getByText("API", { exact: true }).click();
await page.getByRole("tab", { name: "Python API" }).click(); await page.getByRole("tab", { name: "Python API" }).click();
await page.getByRole("button", { name: "Copy Code" }).click(); await page.getByTestId("icon-Copy").click();
const handle = await page.evaluateHandle(() => const handle = await page.evaluateHandle(() =>
navigator.clipboard.readText(), navigator.clipboard.readText()
); );
const clipboardContent = await handle.jsonValue(); const clipboardContent = await handle.jsonValue();
expect(clipboardContent.length).toBeGreaterThan(0); expect(clipboardContent.length).toBeGreaterThan(0);

View file

@ -27,7 +27,7 @@ test.describe("save component tests", () => {
// Read your file into a buffer. // Read your file into a buffer.
const jsonContent = readFileSync( const jsonContent = readFileSync(
"src/frontend/tests/end-to-end/assets/flow_group_test.json", "src/frontend/tests/end-to-end/assets/flow_group_test.json",
"utf-8", "utf-8"
); );
// Create the DataTransfer and File // Create the DataTransfer and File
@ -49,7 +49,7 @@ test.describe("save component tests", () => {
"drop", "drop",
{ {
dataTransfer, dataTransfer,
}, }
); );
const genericNoda = page.getByTestId("div-generic-node"); const genericNoda = page.getByTestId("div-generic-node");
@ -84,6 +84,8 @@ test.describe("save component tests", () => {
} }
await page.getByTestId("title-Group").click(); await page.getByTestId("title-Group").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("icon-SaveAll").click(); await page.getByTestId("icon-SaveAll").click();
const replaceButton = await page.getByTestId("replace-button").isVisible(); const replaceButton = await page.getByTestId("replace-button").isVisible();

View file

@ -60,7 +60,7 @@ test("TextInputOutputComponent", async ({ page }) => {
// Click and hold on the first element // Click and hold on the first element
await page await page
.locator( .locator(
'//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[1]/div/div[2]/div[6]/button/div/div', '//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[1]/div/div[2]/div[6]/button/div/div'
) )
.hover(); .hover();
await page.mouse.down(); await page.mouse.down();
@ -68,7 +68,7 @@ test("TextInputOutputComponent", async ({ page }) => {
// Move to the second element // Move to the second element
await page await page
.locator( .locator(
'//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/div[9]/div/button/div/div', '//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/div[9]/div/button/div/div'
) )
.hover(); .hover();
@ -92,7 +92,7 @@ test("TextInputOutputComponent", async ({ page }) => {
// Click and hold on the first element // Click and hold on the first element
await page await page
.locator( .locator(
'//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/div[13]/button/div/div', '//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/div[13]/button/div/div'
) )
.hover(); .hover();
await page.mouse.down(); await page.mouse.down();
@ -100,7 +100,7 @@ test("TextInputOutputComponent", async ({ page }) => {
// Move to the second element // Move to the second element
await page await page
.locator( .locator(
'//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[3]/div/div[2]/div[3]/div/button/div/div', '//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[3]/div/div[2]/div[3]/div/button/div/div'
) )
.hover(); .hover();
@ -137,8 +137,6 @@ test("TextInputOutputComponent", async ({ page }) => {
await page.keyboard.press("Escape"); await page.keyboard.press("Escape");
await page.getByText("Close", { exact: true }).last().click();
await page await page
.getByTestId("popover-anchor-input-input_value") .getByTestId("popover-anchor-input-input_value")
.nth(0) .nth(0)

View file

@ -22,9 +22,9 @@ test("curl_api_generation", async ({ page, context }) => {
await page.waitForTimeout(2000); await page.waitForTimeout(2000);
await page.getByText("API", { exact: true }).click(); await page.getByText("API", { exact: true }).click();
await page.getByRole("tab", { name: "cURL" }).click(); await page.getByRole("tab", { name: "cURL" }).click();
await page.getByRole("button", { name: "Copy Code" }).click(); await page.getByTestId("icon-Copy").click();
const handle = await page.evaluateHandle(() => const handle = await page.evaluateHandle(() =>
navigator.clipboard.readText(), navigator.clipboard.readText()
); );
const clipboardContent = await handle.jsonValue(); const clipboardContent = await handle.jsonValue();
const oldValue = clipboardContent; const oldValue = clipboardContent;
@ -48,9 +48,9 @@ test("curl_api_generation", async ({ page, context }) => {
.first() .first()
.fill("teste"); .fill("teste");
await page.getByRole("tab", { name: "cURL" }).click(); await page.getByRole("tab", { name: "cURL" }).click();
await page.getByRole("button", { name: "Copy Code" }).click(); await page.getByTestId("icon-Copy").click();
const handle2 = await page.evaluateHandle(() => const handle2 = await page.evaluateHandle(() =>
navigator.clipboard.readText(), navigator.clipboard.readText()
); );
const clipboardContent2 = await handle2.jsonValue(); const clipboardContent2 = await handle2.jsonValue();
const newValue = clipboardContent2; const newValue = clipboardContent2;

View file

@ -108,8 +108,8 @@ test("should interact with API Keys", async ({ page }) => {
await page.waitForTimeout(2000); await page.waitForTimeout(2000);
await page.getByTestId("user-profile-settings").click(); await page.getByTestId("user-profile-settings").click();
await page.getByText("Settings").click(); await page.getByText("Settings").click();
await page.getByText("API Keys").click(); await page.getByText("Langflow API").click();
await page.getByText("API Keys", { exact: true }).nth(1).isVisible(); await page.getByText("Langflow API", { exact: true }).nth(1).isVisible();
await page.getByText("Add New").click(); await page.getByText("Add New").click();
await page.getByPlaceholder("Insert a name for your API Key").isVisible(); await page.getByPlaceholder("Insert a name for your API Key").isVisible();