From 5e2a75458928b8eeaf6a00ca9bb1dbb31ba0f935 Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Fri, 7 Jun 2024 10:38:44 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20(actionsMainPage.spec.ts):=20add=20?= =?UTF-8?q?end-to-end=20tests=20for=20downloading,=20uploading,=20and=20du?= =?UTF-8?q?plicating=20flows=20and=20components?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/end-to-end/actionsMainPage.spec.ts | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/src/frontend/tests/end-to-end/actionsMainPage.spec.ts b/src/frontend/tests/end-to-end/actionsMainPage.spec.ts index 0b3021d4f..916d09718 100644 --- a/src/frontend/tests/end-to-end/actionsMainPage.spec.ts +++ b/src/frontend/tests/end-to-end/actionsMainPage.spec.ts @@ -122,3 +122,113 @@ test("search components", async ({ page }) => { await page.getByText("Prompt", { exact: true }).isHidden(); await page.getByText("OpenAI", { exact: true }).isHidden(); }); + +test("user should be able to download a flow or a component", async ({ + page, +}) => { + await page.goto("/"); + await page.waitForTimeout(2000); + + let modalCount = 0; + try { + const modalTitleElement = await page?.getByTestId("modal-title"); + if (modalTitleElement) { + modalCount = await modalTitleElement.count(); + } + } catch (error) { + modalCount = 0; + } + + while (modalCount === 0) { + await page.getByText("New Project", { exact: true }).click(); + await page.waitForTimeout(5000); + modalCount = await page.getByTestId("modal-title")?.count(); + } + + await page.getByRole("heading", { name: "Basic Prompting" }).click(); + await page.getByText("Chat Input", { exact: true }).click(); + await page.getByTestId("icon-SaveAll").first().click(); + await page.waitForTimeout(3000); + + if (await page.getByTestId("replace-button").isVisible()) { + await page.getByTestId("replace-button").click(); + } + await page.waitForTimeout(3000); + + await page.getByTestId("icon-ChevronLeft").last().click(); + await page.getByRole("checkbox").nth(1).click(); + await page.getByTestId("icon-FileDown").last().click(); + await page.waitForTimeout(1000); + await page.getByText("Items exported successfully").isVisible(); + + await page.getByText("Flows", { exact: true }).click(); + await page.getByRole("checkbox").nth(1).click(); + await page.getByTestId("icon-FileDown").last().click(); + await page.waitForTimeout(1000); + await page.getByText("Items exported successfully").isVisible(); + + await page.getByText("Components", { exact: true }).click(); + await page.getByRole("checkbox").nth(1).click(); + await page.getByTestId("icon-FileDown").last().click(); + await page.waitForTimeout(1000); + await page.getByText("Components exported successfully").isVisible(); +}); + +test("user should be able to upload a flow or a component", async ({ + page, +}) => { + await page.goto("/"); + await page.waitForTimeout(2000); + + let modalCount = 0; + try { + const modalTitleElement = await page?.getByTestId("modal-title"); + if (modalTitleElement) { + modalCount = await modalTitleElement.count(); + } + } catch (error) { + modalCount = 0; + } + + await page.getByTestId("upload-folder-button").last().click(); +}); + +test("user should be able to duplicate a flow or a component", async ({ + page, +}) => { + await page.goto("/"); + await page.waitForTimeout(2000); + + let modalCount = 0; + try { + const modalTitleElement = await page?.getByTestId("modal-title"); + if (modalTitleElement) { + modalCount = await modalTitleElement.count(); + } + } catch (error) { + modalCount = 0; + } + + while (modalCount === 0) { + await page.getByText("New Project", { exact: true }).click(); + await page.waitForTimeout(5000); + modalCount = await page.getByTestId("modal-title")?.count(); + } + + await page.getByRole("heading", { name: "Basic Prompting" }).click(); + await page.getByText("Chat Input", { exact: true }).click(); + await page.getByTestId("icon-SaveAll").first().click(); + await page.waitForTimeout(3000); + + if (await page.getByTestId("replace-button").isVisible()) { + await page.getByTestId("replace-button").click(); + } + await page.waitForTimeout(3000); + + await page.getByTestId("icon-ChevronLeft").last().click(); + await page.getByRole("checkbox").nth(1).click(); + + await page.getByTestId("icon-Copy").last().click(); + await page.waitForTimeout(1000); + await page.getByText("Items duplicated successfully").isVisible(); +});