From 128a0e9332611ac1ed0cc5fc35ff8b71969e30bc Mon Sep 17 00:00:00 2001 From: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com> Date: Thu, 12 Sep 2024 16:47:21 -0300 Subject: [PATCH] fix: update flow name validation and label (#3785) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Changed text warning name invalid * Change invalidNameList to include components * 📝 (generalBugs-shard-13.spec.ts): add missing comments to clarify the purpose of the code block and improve code readability --------- Co-authored-by: cristhianzl --- .../editFlowSettingsComponent/index.tsx | 4 ++- .../src/modals/flowSettingsModal/index.tsx | 3 +- .../regression/generalBugs-shard-13.spec.ts | 36 +++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/components/editFlowSettingsComponent/index.tsx b/src/frontend/src/components/editFlowSettingsComponent/index.tsx index d1fcc7100..c3016ed3e 100644 --- a/src/frontend/src/components/editFlowSettingsComponent/index.tsx +++ b/src/frontend/src/components/editFlowSettingsComponent/index.tsx @@ -62,7 +62,9 @@ export const EditFlowSettings: React.FC = ({ Character limit reached )} {isInvalidName && ( - Invalid name + + Name invalid or already exists + )} {setName ? ( diff --git a/src/frontend/src/modals/flowSettingsModal/index.tsx b/src/frontend/src/modals/flowSettingsModal/index.tsx index fb0435fc0..15e2672d2 100644 --- a/src/frontend/src/modals/flowSettingsModal/index.tsx +++ b/src/frontend/src/modals/flowSettingsModal/index.tsx @@ -65,8 +65,7 @@ export default function FlowSettingsModal({ if (flows) { const tempNameList: string[] = []; flows.forEach((flow: FlowType) => { - if ((flow.is_component ?? false) === false) - tempNameList.push(flow.name); + tempNameList.push(flow.name); }); setNameList(tempNameList.filter((name) => name !== currentFlow!.name)); } diff --git a/src/frontend/tests/extended/regression/generalBugs-shard-13.spec.ts b/src/frontend/tests/extended/regression/generalBugs-shard-13.spec.ts index c26b5851a..a2396b011 100644 --- a/src/frontend/tests/extended/regression/generalBugs-shard-13.spec.ts +++ b/src/frontend/tests/extended/regression/generalBugs-shard-13.spec.ts @@ -82,6 +82,42 @@ test("should be able to share a component on the store by clicking on the share await page.getByTestId("share-modal-button-flow").click(); + let replace = await page.getByTestId("replace-button").isVisible(); + + if (replace) { + await page.getByTestId("replace-button").click(); + } + + await page.waitForSelector("text=flow shared successfully ", { + timeout: 10000, + }); + + await page.waitForTimeout(500); + + await page.waitForSelector("text=share", { timeout: 10000 }); + await page.waitForSelector("text=playground", { timeout: 10000 }); + await page.waitForSelector("text=api", { timeout: 10000 }); + + await page.getByTestId("shared-button-flow").click(); + + await page.waitForTimeout(500); + + await page.waitForSelector("text=Publish workflow to the Langflow Store.", { + timeout: 10000, + }); + await page.waitForSelector('[data-testid="share-modal-button-flow"]', { + timeout: 10000, + }); + await page.waitForSelector("text=Share Flow", { timeout: 10000 }); + + await page.getByTestId("share-modal-button-flow").click(); + + replace = await page.getByTestId("replace-button").isVisible(); + + if (replace) { + await page.getByTestId("replace-button").click(); + } + await page.waitForSelector("text=flow shared successfully ", { timeout: 10000, });