diff --git a/src/frontend/src/CustomNodes/GenericNode/components/handleRenderComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/handleRenderComponent/index.tsx index 4e53881d4..e415eb0c7 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/handleRenderComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/handleRenderComponent/index.tsx @@ -52,7 +52,7 @@ export default function HandleRenderComponent({ side={left ? "left" : "right"} > { + if (!process?.env?.OPENAI_API_KEY) { + //You must set the OPENAI_API_KEY on .env file to run this test + expect(false).toBe(true); + } + + 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.waitForSelector('[title="fit view"]', { + timeout: 100000, + }); + + await page.getByTitle("fit view").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + + await page + .getByTestId("popover-anchor-input-openai_api_key") + .fill(process.env.OPENAI_API_KEY ?? ""); + + await page.getByTestId("dropdown-model_name").click(); + await page.getByTestId("gpt-4o-0-option").click(); + + await page.waitForTimeout(2000); + + await page.getByTestId("button_run_chat output").click(); + await page.waitForSelector("text=built successfully", { timeout: 30000 }); + + await page.getByText("built successfully").last().click({ + timeout: 15000, + }); + + await page.getByText("Playground", { exact: true }).click(); + await page + .getByText("No input message provided.", { exact: true }) + .last() + .isVisible(); + + await page.waitForSelector('[data-testid="input-chat-playground"]', { + timeout: 100000, + }); + + await page + .getByTestId("input-chat-playground") + .last() + .fill("Say hello as a pirate"); + await page.getByTestId("icon-LucideSend").last().click(); + await page.waitForTimeout(3000); + + await page.getByText("Ahoy").last().isVisible(); + await page.getByText("Default Session").last().click(); + + await page.getByText("timestamp", { exact: true }).last().isVisible(); + await page.getByText("text", { exact: true }).last().isVisible(); + await page.getByText("sender", { exact: true }).last().isVisible(); + await page.getByText("sender_name", { exact: true }).last().isVisible(); + await page.getByText("session_id", { exact: true }).last().isVisible(); + await page.getByText("files", { exact: true }).last().isVisible(); + + await page.getByRole("gridcell").last().isVisible(); + await page.getByTestId("icon-Trash2").first().click(); + await page.waitForSelector('[data-testid="input-chat-playground"]', { + timeout: 100000, + }); + + await page.getByTestId("input-chat-playground").last().isVisible(); +}); diff --git a/src/frontend/tests/end-to-end/Blog Writer.spec.ts b/src/frontend/tests/end-to-end/Blog Writer.spec.ts new file mode 100644 index 000000000..68c6c0bf3 --- /dev/null +++ b/src/frontend/tests/end-to-end/Blog Writer.spec.ts @@ -0,0 +1,109 @@ +import { expect, test } from "@playwright/test"; +import path from "path"; + +test("Blog Writer", async ({ page }) => { + if (!process?.env?.OPENAI_API_KEY) { + //You must set the OPENAI_API_KEY on .env file to run this test + expect(false).toBe(true); + } + + 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: "Blog Writer" }).click(); + await page.waitForTimeout(1000); + + await page.getByTitle("fit view").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + + await page + .getByTestId("popover-anchor-input-openai_api_key") + .fill(process.env.OPENAI_API_KEY ?? ""); + + await page.getByTestId("dropdown-model_name").click(); + await page.getByTestId("gpt-4o-0-option").click(); + + await page.waitForTimeout(2000); + await page + .getByTestId("input-list-input_urls-0") + .nth(0) + .fill( + "https://www.natgeokids.com/uk/discover/animals/sea-life/turtle-facts/", + ); + await page + .getByTestId("input-list-input_urls-1") + .nth(0) + .fill("https://www.originaldiving.com/blog/top-ten-turtle-facts"); + + await page + .getByTestId("popover-anchor-input-input_value") + .nth(0) + .fill( + "Use the references above for style to write a new blog/tutorial about turtles. Suggest non-covered topics.", + ); + + await page.getByTestId("button_run_chat output").click(); + await page.waitForTimeout(5000); + + await page.waitForSelector("text=built successfully", { timeout: 30000 }); + + await page.getByText("built successfully").last().click({ + timeout: 30000, + }); + + await page.getByText("Playground", { exact: true }).click(); + await page + .getByPlaceholder( + "No chat input variables found. Click to run your flow.", + { exact: true }, + ) + .last() + .isVisible(); + + await page.waitForTimeout(3000); + + await page.getByText("turtles").last().isVisible(); + await page.getByText("sea").last().isVisible(); + await page.getByText("survival").last().isVisible(); + + await page.getByText("Instructions").last().click(); + + const value = await page + .getByPlaceholder("Enter text...") + .last() + .inputValue(); + + expect(value).toBe( + "Use the references above for style to write a new blog/tutorial about turtles. Suggest non-covered topics.", + ); + + await page.getByTestId("icon-ExternalLink").last().click(); + + const count = await page + .getByText( + "Use the references above for style to write a new blog/tutorial about turtles. Suggest non-covered topics.", + ) + .count(); + + if (count <= 1) { + expect(false).toBe(true); + } +}); diff --git a/src/frontend/tests/end-to-end/Document QA.spec.ts b/src/frontend/tests/end-to-end/Document QA.spec.ts new file mode 100644 index 000000000..03ff442df --- /dev/null +++ b/src/frontend/tests/end-to-end/Document QA.spec.ts @@ -0,0 +1,96 @@ +import { expect, test } from "@playwright/test"; +import path from "path"; + +test("Document QA", async ({ page }) => { + if (!process?.env?.OPENAI_API_KEY) { + //You must set the OPENAI_API_KEY on .env file to run this test + expect(false).toBe(true); + } + + 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: "Document QA" }).click(); + await page.waitForTimeout(1000); + + await page.getByTitle("fit view").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + + await page + .getByTestId("popover-anchor-input-openai_api_key") + .fill(process.env.OPENAI_API_KEY ?? ""); + + await page.getByTestId("dropdown-model_name").click(); + await page.getByTestId("gpt-4o-0-option").click(); + + await page.waitForTimeout(2000); + const fileChooserPromise = page.waitForEvent("filechooser"); + await page.getByTestId("icon-FileSearch2").click(); + const fileChooser = await fileChooserPromise; + await fileChooser.setFiles(path.join(__dirname, "/assets/test_file.txt")); + await page.getByText("test_file.txt").isVisible(); + + await page.waitForTimeout(2000); + + await page.getByTestId("button_run_chat output").click(); + await page.waitForSelector("text=built successfully", { timeout: 30000 }); + + await page.getByText("built successfully").last().click({ + timeout: 15000, + }); + + await page.getByText("Playground", { exact: true }).click(); + await page + .getByText("No input message provided.", { exact: true }) + .last() + .isVisible(); + + await page.waitForSelector('[data-testid="input-chat-playground"]', { + timeout: 100000, + }); + await page + .getByTestId("input-chat-playground") + .last() + .fill("whats the text in the file?"); + await page.getByTestId("icon-LucideSend").last().click(); + + await page.waitForTimeout(3000); + + await page.getByText("this is a test file").last().isVisible(); + + await page.getByText("Default Session").last().click(); + + await page.getByText("timestamp", { exact: true }).last().isVisible(); + await page.getByText("text", { exact: true }).last().isVisible(); + await page.getByText("sender", { exact: true }).last().isVisible(); + await page.getByText("sender_name", { exact: true }).last().isVisible(); + await page.getByText("session_id", { exact: true }).last().isVisible(); + await page.getByText("files", { exact: true }).last().isVisible(); + + await page.getByRole("gridcell").last().isVisible(); + await page.getByTestId("icon-Trash2").first().click(); + + await page.waitForSelector('[data-testid="input-chat-playground"]', { + timeout: 100000, + }); + + await page.getByTestId("input-chat-playground").last().isVisible(); +}); diff --git a/src/frontend/tests/end-to-end/Memory Chatbot.spec.ts b/src/frontend/tests/end-to-end/Memory Chatbot.spec.ts new file mode 100644 index 000000000..861cc6d0f --- /dev/null +++ b/src/frontend/tests/end-to-end/Memory Chatbot.spec.ts @@ -0,0 +1,102 @@ +import { expect, test } from "@playwright/test"; +import path from "path"; + +test("Memory Chatbot", async ({ page }) => { + if (!process?.env?.OPENAI_API_KEY) { + //You must set the OPENAI_API_KEY on .env file to run this test + expect(false).toBe(true); + } + + 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: "Memory Chatbot" }).click(); + await page.waitForTimeout(1000); + + await page.getByTitle("fit view").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + + await page + .getByTestId("popover-anchor-input-openai_api_key") + .fill(process.env.OPENAI_API_KEY ?? ""); + + await page.getByTestId("dropdown-model_name").click(); + await page.getByTestId("gpt-4o-0-option").click(); + + await page.waitForTimeout(2000); + + await page.getByTestId("button_run_chat output").click(); + await page.waitForSelector("text=built successfully", { timeout: 30000 }); + + await page.getByText("built successfully").last().click({ + timeout: 15000, + }); + + await page.getByText("Playground", { exact: true }).click(); + + await page + .getByText("No input message provided.", { exact: true }) + .last() + .isVisible(); + + await page.waitForSelector('[data-testid="input-chat-playground"]', { + timeout: 100000, + }); + + await page + .getByTestId("input-chat-playground") + .last() + .fill("Remember that I'm a lion"); + await page.getByTestId("icon-LucideSend").last().click(); + + await page.waitForSelector('[data-testid="input-chat-playground"]', { + timeout: 100000, + }); + + await page + .getByTestId("input-chat-playground") + .last() + .fill("try reproduce the sound I made in words"); + + await page.waitForSelector('[data-testid="icon-LucideSend"]', { + timeout: 100000, + }); + + await page.getByTestId("icon-LucideSend").last().click(); + + await page.waitForSelector("text=roar", { timeout: 30000 }); + await page.getByText("roar").last().isVisible(); + await page.getByText("Default Session").last().click(); + + await page.getByText("timestamp", { exact: true }).last().isVisible(); + await page.getByText("text", { exact: true }).last().isVisible(); + await page.getByText("sender", { exact: true }).last().isVisible(); + await page.getByText("sender_name", { exact: true }).last().isVisible(); + await page.getByText("session_id", { exact: true }).last().isVisible(); + await page.getByText("files", { exact: true }).last().isVisible(); + + await page.getByRole("gridcell").last().isVisible(); + await page.getByTestId("icon-Trash2").first().click(); + await page.waitForSelector('[data-testid="input-chat-playground"]', { + timeout: 100000, + }); + await page.getByTestId("input-chat-playground").last().isVisible(); +}); diff --git a/src/frontend/tests/end-to-end/Vector Store.spec.ts b/src/frontend/tests/end-to-end/Vector Store.spec.ts new file mode 100644 index 000000000..3f825128a --- /dev/null +++ b/src/frontend/tests/end-to-end/Vector Store.spec.ts @@ -0,0 +1,129 @@ +import { expect, test } from "@playwright/test"; +import path from "path"; + +test("Vector Store RAG", 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: "Vector Store RAG" }).click(); + await page.waitForSelector('[title="fit view"]', { + timeout: 100000, + }); + + await page.getByTitle("fit view").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + + // if ( + // !process.env.OPENAI_API_KEY || + // !process.env.ASTRA_DB_API_ENDPOINT || + // !process.env.ASTRA_DB_APPLICATION_TOKEN + // ) { + // //You must set the OPENAI_API_KEY, ASTRA_DB_API_ENDPOINT and ASTRA_DB_APPLICATION_TOKEN on .env file to run this test + // expect(false).toBe(true); + // } + + // await page + // .getByTestId("popover-anchor-input-openai_api_key") + // .nth(0) + // .fill(process.env.OPENAI_API_KEY ?? ""); + + // await page + // .getByTestId("popover-anchor-input-openai_api_key") + // .nth(1) + // .fill(process.env.OPENAI_API_KEY ?? ""); + + // await page + // .getByTestId("popover-anchor-input-openai_api_key") + // .nth(2) + // .fill(process.env.OPENAI_API_KEY ?? ""); + + // await page + // .getByTestId("popover-anchor-input-token") + // .nth(0) + // .fill(process.env.ASTRA_DB_APPLICATION_TOKEN ?? ""); + // await page + // .getByTestId("popover-anchor-input-token") + // .nth(1) + // .fill(process.env.ASTRA_DB_APPLICATION_TOKEN ?? ""); + + // await page + // .getByTestId("popover-anchor-input-api_endpoint") + // .nth(0) + // .fill(process.env.ASTRA_DB_API_ENDPOINT ?? ""); + // await page + // .getByTestId("popover-anchor-input-api_endpoint") + // .nth(1) + // .fill(process.env.ASTRA_DB_API_ENDPOINT ?? ""); + + const fileChooserPromise = page.waitForEvent("filechooser"); + await page.getByTestId("icon-FileSearch2").last().click(); + const fileChooser = await fileChooserPromise; + await fileChooser.setFiles(path.join(__dirname, "/assets/test_file.txt")); + await page.getByText("test_file.txt").isVisible(); + + // await page.getByTestId("button_run_astra db").first().click(); + // await page.waitForSelector("text=built successfully", { timeout: 30000 }); + + // await page.getByText("built successfully").last().click({ + // timeout: 30000, + // }); + + // await page.getByTestId("button_run_chat output").click(); + // await page.waitForSelector("text=built successfully", { timeout: 30000 }); + + // await page.getByText("built successfully").last().click({ + // timeout: 30000, + // }); + + // await page.getByText("Playground", { exact: true }).click(); + + // await page.waitForSelector('[data-testid="input-chat-playground"]', { + // timeout: 100000, + // }); + + // await page.getByTestId("input-chat-playground").last().fill("hello"); + + // await page.getByTestId("icon-LucideSend").last().click(); + + // await page + // .getByText("This is a test file.", { exact: true }) + // .last() + // .isVisible(); + + // await page.getByText("Memories", { exact: true }).last().click(); + // await page.getByText("Default Session").last().click(); + + // await page.getByText("timestamp", { exact: true }).last().isVisible(); + // await page.getByText("text", { exact: true }).last().isVisible(); + // await page.getByText("sender", { exact: true }).last().isVisible(); + // await page.getByText("sender_name", { exact: true }).last().isVisible(); + // await page.getByText("session_id", { exact: true }).last().isVisible(); + // await page.getByText("files", { exact: true }).last().isVisible(); + + // await page.getByRole("gridcell").last().isVisible(); + // await page.getByTestId("icon-Trash2").first().click(); + + // await page.waitForSelector('[data-testid="input-chat-playground"]', { + // timeout: 100000, + // }); + + // await page.getByTestId("input-chat-playground").last().isVisible(); +}); diff --git a/src/frontend/tests/end-to-end/basicExamples.spec.ts b/src/frontend/tests/end-to-end/basicExamples.spec.ts deleted file mode 100644 index bfdc8c197..000000000 --- a/src/frontend/tests/end-to-end/basicExamples.spec.ts +++ /dev/null @@ -1,518 +0,0 @@ -import { expect, test } from "@playwright/test"; -import path from "path"; - -test("Basic Prompting (Hello, World)", async ({ page }) => { - if (!process?.env?.OPENAI_API_KEY) { - //You must set the OPENAI_API_KEY on .env file to run this test - expect(false).toBe(true); - } - - 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.waitForSelector('[title="fit view"]', { - timeout: 100000, - }); - - await page.getByTitle("fit view").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - - await page - .getByTestId("popover-anchor-input-openai_api_key") - .fill(process.env.OPENAI_API_KEY ?? ""); - - await page.getByTestId("dropdown-model_name").click(); - await page.getByTestId("gpt-4o-0-option").click(); - - await page.waitForTimeout(2000); - - await page.getByTestId("button_run_chat output").click(); - await page.waitForSelector("text=built successfully", { timeout: 30000 }); - - await page.getByText("built successfully").last().click({ - timeout: 15000, - }); - - await page.getByText("Playground", { exact: true }).click(); - await page - .getByText("No input message provided.", { exact: true }) - .last() - .isVisible(); - - await page.waitForSelector('[data-testid="input-chat-playground"]', { - timeout: 100000, - }); - - await page - .getByTestId("input-chat-playground") - .last() - .fill("Say hello as a pirate"); - await page.getByTestId("icon-LucideSend").last().click(); - await page.waitForTimeout(3000); - - await page.getByText("Ahoy").last().isVisible(); - await page.getByText("Default Session").last().click(); - - await page.getByText("timestamp", { exact: true }).last().isVisible(); - await page.getByText("text", { exact: true }).last().isVisible(); - await page.getByText("sender", { exact: true }).last().isVisible(); - await page.getByText("sender_name", { exact: true }).last().isVisible(); - await page.getByText("session_id", { exact: true }).last().isVisible(); - await page.getByText("files", { exact: true }).last().isVisible(); - - await page.getByRole("gridcell").last().isVisible(); - await page.getByTestId("icon-Trash2").first().click(); - await page.waitForSelector('[data-testid="input-chat-playground"]', { - timeout: 100000, - }); - - await page.getByTestId("input-chat-playground").last().isVisible(); -}); - -test("Memory Chatbot", async ({ page }) => { - if (!process?.env?.OPENAI_API_KEY) { - //You must set the OPENAI_API_KEY on .env file to run this test - expect(false).toBe(true); - } - - 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: "Memory Chatbot" }).click(); - await page.waitForTimeout(1000); - - await page.getByTitle("fit view").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - - await page - .getByTestId("popover-anchor-input-openai_api_key") - .fill(process.env.OPENAI_API_KEY ?? ""); - - await page.getByTestId("dropdown-model_name").click(); - await page.getByTestId("gpt-4o-0-option").click(); - - await page.waitForTimeout(2000); - - await page.getByTestId("button_run_chat output").click(); - await page.waitForSelector("text=built successfully", { timeout: 30000 }); - - await page.getByText("built successfully").last().click({ - timeout: 15000, - }); - - await page.getByText("Playground", { exact: true }).click(); - - await page - .getByText("No input message provided.", { exact: true }) - .last() - .isVisible(); - - await page.waitForSelector('[data-testid="input-chat-playground"]', { - timeout: 100000, - }); - - await page - .getByTestId("input-chat-playground") - .last() - .fill("Remember that I'm a lion"); - await page.getByTestId("icon-LucideSend").last().click(); - - await page.waitForSelector('[data-testid="input-chat-playground"]', { - timeout: 100000, - }); - - await page - .getByTestId("input-chat-playground") - .last() - .fill("try reproduce the sound I made in words"); - - await page.waitForSelector('[data-testid="icon-LucideSend"]', { - timeout: 100000, - }); - - await page.getByTestId("icon-LucideSend").last().click(); - - await page.waitForSelector("text=roar", { timeout: 30000 }); - await page.getByText("roar").last().isVisible(); - await page.getByText("Default Session").last().click(); - - await page.getByText("timestamp", { exact: true }).last().isVisible(); - await page.getByText("text", { exact: true }).last().isVisible(); - await page.getByText("sender", { exact: true }).last().isVisible(); - await page.getByText("sender_name", { exact: true }).last().isVisible(); - await page.getByText("session_id", { exact: true }).last().isVisible(); - await page.getByText("files", { exact: true }).last().isVisible(); - - await page.getByRole("gridcell").last().isVisible(); - await page.getByTestId("icon-Trash2").first().click(); - await page.waitForSelector('[data-testid="input-chat-playground"]', { - timeout: 100000, - }); - await page.getByTestId("input-chat-playground").last().isVisible(); -}); - -test("Document QA", async ({ page }) => { - if (!process?.env?.OPENAI_API_KEY) { - //You must set the OPENAI_API_KEY on .env file to run this test - expect(false).toBe(true); - } - - 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: "Document QA" }).click(); - await page.waitForTimeout(1000); - - await page.getByTitle("fit view").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - - await page - .getByTestId("popover-anchor-input-openai_api_key") - .fill(process.env.OPENAI_API_KEY ?? ""); - - await page.getByTestId("dropdown-model_name").click(); - await page.getByTestId("gpt-4o-0-option").click(); - - await page.waitForTimeout(2000); - const fileChooserPromise = page.waitForEvent("filechooser"); - await page.getByTestId("icon-FileSearch2").click(); - const fileChooser = await fileChooserPromise; - await fileChooser.setFiles(path.join(__dirname, "/assets/test_file.txt")); - await page.getByText("test_file.txt").isVisible(); - - await page.waitForTimeout(2000); - - await page.getByTestId("button_run_chat output").click(); - await page.waitForSelector("text=built successfully", { timeout: 30000 }); - - await page.getByText("built successfully").last().click({ - timeout: 15000, - }); - - await page.getByText("Playground", { exact: true }).click(); - await page - .getByText("No input message provided.", { exact: true }) - .last() - .isVisible(); - - await page.waitForSelector('[data-testid="input-chat-playground"]', { - timeout: 100000, - }); - await page - .getByTestId("input-chat-playground") - .last() - .fill("whats the text in the file?"); - await page.getByTestId("icon-LucideSend").last().click(); - - await page.waitForTimeout(3000); - - await page.getByText("this is a test file").last().isVisible(); - - await page.getByText("Default Session").last().click(); - - await page.getByText("timestamp", { exact: true }).last().isVisible(); - await page.getByText("text", { exact: true }).last().isVisible(); - await page.getByText("sender", { exact: true }).last().isVisible(); - await page.getByText("sender_name", { exact: true }).last().isVisible(); - await page.getByText("session_id", { exact: true }).last().isVisible(); - await page.getByText("files", { exact: true }).last().isVisible(); - - await page.getByRole("gridcell").last().isVisible(); - await page.getByTestId("icon-Trash2").first().click(); - - await page.waitForSelector('[data-testid="input-chat-playground"]', { - timeout: 100000, - }); - - await page.getByTestId("input-chat-playground").last().isVisible(); -}); - -test("Blog Writer", async ({ page }) => { - if (!process?.env?.OPENAI_API_KEY) { - //You must set the OPENAI_API_KEY on .env file to run this test - expect(false).toBe(true); - } - - 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: "Blog Writer" }).click(); - await page.waitForTimeout(1000); - - await page.getByTitle("fit view").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - - await page - .getByTestId("popover-anchor-input-openai_api_key") - .fill(process.env.OPENAI_API_KEY ?? ""); - - await page.getByTestId("dropdown-model_name").click(); - await page.getByTestId("gpt-4o-0-option").click(); - - await page.waitForTimeout(2000); - await page - .getByTestId("input-list-input_urls-0") - .nth(0) - .fill( - "https://www.natgeokids.com/uk/discover/animals/sea-life/turtle-facts/", - ); - await page - .getByTestId("input-list-input_urls-1") - .nth(0) - .fill("https://www.originaldiving.com/blog/top-ten-turtle-facts"); - - await page - .getByTestId("popover-anchor-input-input_value") - .nth(0) - .fill( - "Use the references above for style to write a new blog/tutorial about turtles. Suggest non-covered topics.", - ); - - await page.getByTestId("button_run_chat output").click(); - await page.waitForTimeout(5000); - - await page.waitForSelector("text=built successfully", { timeout: 30000 }); - - await page.getByText("built successfully").last().click({ - timeout: 30000, - }); - - await page.getByText("Playground", { exact: true }).click(); - await page - .getByPlaceholder( - "No chat input variables found. Click to run your flow.", - { exact: true }, - ) - .last() - .isVisible(); - - await page.waitForTimeout(3000); - - await page.getByText("turtles").last().isVisible(); - await page.getByText("sea").last().isVisible(); - await page.getByText("survival").last().isVisible(); - - await page.getByText("Instructions").last().click(); - - const value = await page - .getByPlaceholder("Enter text...") - .last() - .inputValue(); - - expect(value).toBe( - "Use the references above for style to write a new blog/tutorial about turtles. Suggest non-covered topics.", - ); - - await page.getByTestId("icon-ExternalLink").last().click(); - - const count = await page - .getByText( - "Use the references above for style to write a new blog/tutorial about turtles. Suggest non-covered topics.", - ) - .count(); - - if (count <= 1) { - expect(false).toBe(true); - } -}); - -test("Vector Store RAG", 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: "Vector Store RAG" }).click(); - await page.waitForSelector('[title="fit view"]', { - timeout: 100000, - }); - - await page.getByTitle("fit view").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - - // if ( - // !process.env.OPENAI_API_KEY || - // !process.env.ASTRA_DB_API_ENDPOINT || - // !process.env.ASTRA_DB_APPLICATION_TOKEN - // ) { - // //You must set the OPENAI_API_KEY, ASTRA_DB_API_ENDPOINT and ASTRA_DB_APPLICATION_TOKEN on .env file to run this test - // expect(false).toBe(true); - // } - - // await page - // .getByTestId("popover-anchor-input-openai_api_key") - // .nth(0) - // .fill(process.env.OPENAI_API_KEY ?? ""); - - // await page - // .getByTestId("popover-anchor-input-openai_api_key") - // .nth(1) - // .fill(process.env.OPENAI_API_KEY ?? ""); - - // await page - // .getByTestId("popover-anchor-input-openai_api_key") - // .nth(2) - // .fill(process.env.OPENAI_API_KEY ?? ""); - - // await page - // .getByTestId("popover-anchor-input-token") - // .nth(0) - // .fill(process.env.ASTRA_DB_APPLICATION_TOKEN ?? ""); - // await page - // .getByTestId("popover-anchor-input-token") - // .nth(1) - // .fill(process.env.ASTRA_DB_APPLICATION_TOKEN ?? ""); - - // await page - // .getByTestId("popover-anchor-input-api_endpoint") - // .nth(0) - // .fill(process.env.ASTRA_DB_API_ENDPOINT ?? ""); - // await page - // .getByTestId("popover-anchor-input-api_endpoint") - // .nth(1) - // .fill(process.env.ASTRA_DB_API_ENDPOINT ?? ""); - - const fileChooserPromise = page.waitForEvent("filechooser"); - await page.getByTestId("icon-FileSearch2").last().click(); - const fileChooser = await fileChooserPromise; - await fileChooser.setFiles(path.join(__dirname, "/assets/test_file.txt")); - await page.getByText("test_file.txt").isVisible(); - - // await page.getByTestId("button_run_astra db").first().click(); - // await page.waitForSelector("text=built successfully", { timeout: 30000 }); - - // await page.getByText("built successfully").last().click({ - // timeout: 30000, - // }); - - // await page.getByTestId("button_run_chat output").click(); - // await page.waitForSelector("text=built successfully", { timeout: 30000 }); - - // await page.getByText("built successfully").last().click({ - // timeout: 30000, - // }); - - // await page.getByText("Playground", { exact: true }).click(); - - // await page.waitForSelector('[data-testid="input-chat-playground"]', { - // timeout: 100000, - // }); - - // await page.getByTestId("input-chat-playground").last().fill("hello"); - - // await page.getByTestId("icon-LucideSend").last().click(); - - // await page - // .getByText("This is a test file.", { exact: true }) - // .last() - // .isVisible(); - - // await page.getByText("Memories", { exact: true }).last().click(); - // await page.getByText("Default Session").last().click(); - - // await page.getByText("timestamp", { exact: true }).last().isVisible(); - // await page.getByText("text", { exact: true }).last().isVisible(); - // await page.getByText("sender", { exact: true }).last().isVisible(); - // await page.getByText("sender_name", { exact: true }).last().isVisible(); - // await page.getByText("session_id", { exact: true }).last().isVisible(); - // await page.getByText("files", { exact: true }).last().isVisible(); - - // await page.getByRole("gridcell").last().isVisible(); - // await page.getByTestId("icon-Trash2").first().click(); - - // await page.waitForSelector('[data-testid="input-chat-playground"]', { - // timeout: 100000, - // }); - - // await page.getByTestId("input-chat-playground").last().isVisible(); -}); diff --git a/src/frontend/tests/end-to-end/chatInputOutputUser - Images.spec.ts b/src/frontend/tests/end-to-end/chatInputOutputUser - Images.spec.ts new file mode 100644 index 000000000..690a3b805 --- /dev/null +++ b/src/frontend/tests/end-to-end/chatInputOutputUser - Images.spec.ts @@ -0,0 +1,108 @@ +import { expect, test } from "@playwright/test"; +import * as dotenv from "dotenv"; +import { readFileSync } from "fs"; +import path from "path"; + +test("user must be able to send an image on chat", async ({ page }) => { + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + + await page.goto("/"); + + await page.waitForTimeout(1000); + + 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.waitForSelector('[title="fit view"]', { + timeout: 100000, + }); + + await page.getByTitle("fit view").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + + if (!process.env.OPENAI_API_KEY) { + //You must set the OPENAI_API_KEY on .env file to run this test + expect(false).toBe(true); + } + + await page + .getByTestId("popover-anchor-input-openai_api_key") + .fill(process.env.OPENAI_API_KEY ?? ""); + + await page.getByTestId("dropdown-model_name").click(); + await page.getByTestId("gpt-4o-0-option").click(); + + await page.waitForSelector("text=Chat Input", { timeout: 30000 }); + + await page.getByText("Chat Input", { exact: true }).click(); + await page.getByTestId("more-options-modal").click(); + await page.getByTestId("edit-button-modal").click(); + await page.getByText("Save Changes").click(); + + await page.getByText("Playground", { exact: true }).click(); + + // Read the image file as a binary string + const filePath = "tests/end-to-end/assets/chain.png"; + const fileContent = readFileSync(filePath, "base64"); + + // Create the DataTransfer and File objects within the browser context + const dataTransfer = await page.evaluateHandle( + ({ fileContent }) => { + const dt = new DataTransfer(); + const byteCharacters = atob(fileContent); + const byteNumbers = new Array(byteCharacters.length); + for (let i = 0; i < byteCharacters.length; i++) { + byteNumbers[i] = byteCharacters.charCodeAt(i); + } + const byteArray = new Uint8Array(byteNumbers); + const file = new File([byteArray], "chain.png", { type: "image/png" }); + dt.items.add(file); + return dt; + }, + { fileContent }, + ); + + // Locate the target element + const element = await page.getByTestId("input-chat-playground"); + + // Dispatch the drop event on the target element + await element.dispatchEvent("drop", { dataTransfer }); + + await page.waitForSelector('[data-testid="icon-LucideSend"]', { + timeout: 100000, + }); + + await page.getByTestId("icon-LucideSend").click(); + + await page.waitForSelector("text=chain.png", { timeout: 30000 }); + + await page.getByText("chain.png").isVisible(); + + await page.getByText("Close", { exact: true }).click(); + + await page.waitForSelector('[data-testid="icon-ScanEye"]', { + timeout: 30000, + }); + + await page.getByTestId("icon-ScanEye").nth(4).click(); + + await page.getByText("Restart").isHidden(); +}); diff --git a/src/frontend/tests/end-to-end/chatInputOutputUser - Inspection.spec.ts b/src/frontend/tests/end-to-end/chatInputOutputUser - Inspection.spec.ts new file mode 100644 index 000000000..50fbdba0a --- /dev/null +++ b/src/frontend/tests/end-to-end/chatInputOutputUser - Inspection.spec.ts @@ -0,0 +1,67 @@ +import { expect, test } from "@playwright/test"; +import * as dotenv from "dotenv"; +import { readFileSync } from "fs"; +import path from "path"; + +test("user must be able to see output inspection", async ({ page }) => { + if (!process.env.CI) { + dotenv.config({ path: path.resolve(__dirname, "../../.env") }); + } + + await page.goto("/"); + + await page.waitForTimeout(1000); + + 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.waitForSelector('[title="fit view"]', { + timeout: 100000, + }); + + await page.getByTitle("fit view").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + + if (!process.env.OPENAI_API_KEY) { + //You must set the OPENAI_API_KEY on .env file to run this test + expect(false).toBe(true); + } + + await page + .getByTestId("popover-anchor-input-openai_api_key") + .fill(process.env.OPENAI_API_KEY ?? ""); + + await page.getByTestId("dropdown-model_name").click(); + await page.getByTestId("gpt-4o-0-option").click(); + + await page.waitForTimeout(2000); + await page.getByTestId("button_run_chat output").last().click(); + + await page.waitForTimeout(5000); + + await page.waitForSelector('[data-testid="icon-ScanEye"]', { + timeout: 30000, + }); + + await page.getByTestId("icon-ScanEye").nth(4).click(); + + await page.getByText("Sender", { exact: true }).isVisible(); + await page.getByText("Type", { exact: true }).isVisible(); + await page.getByText("User", { exact: true }).last().isVisible(); +}); diff --git a/src/frontend/tests/end-to-end/chatInputOutputUser.spec.ts b/src/frontend/tests/end-to-end/chatInputOutputUser - Interact.spec.ts similarity index 51% rename from src/frontend/tests/end-to-end/chatInputOutputUser.spec.ts rename to src/frontend/tests/end-to-end/chatInputOutputUser - Interact.spec.ts index 6ea9ab7c2..8f77262ba 100644 --- a/src/frontend/tests/end-to-end/chatInputOutputUser.spec.ts +++ b/src/frontend/tests/end-to-end/chatInputOutputUser - Interact.spec.ts @@ -137,170 +137,3 @@ test("user must interact with chat with Input/Output", async ({ page }) => { .isVisible(), ); }); - -test("user must be able to see output inspection", async ({ page }) => { - if (!process.env.CI) { - dotenv.config({ path: path.resolve(__dirname, "../../.env") }); - } - - await page.goto("/"); - - await page.waitForTimeout(1000); - - 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.waitForSelector('[title="fit view"]', { - timeout: 100000, - }); - - await page.getByTitle("fit view").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - - if (!process.env.OPENAI_API_KEY) { - //You must set the OPENAI_API_KEY on .env file to run this test - expect(false).toBe(true); - } - - await page - .getByTestId("popover-anchor-input-openai_api_key") - .fill(process.env.OPENAI_API_KEY ?? ""); - - await page.getByTestId("dropdown-model_name").click(); - await page.getByTestId("gpt-4o-0-option").click(); - - await page.waitForTimeout(2000); - await page.getByTestId("button_run_chat output").last().click(); - - await page.waitForTimeout(5000); - - await page.waitForSelector('[data-testid="icon-ScanEye"]', { - timeout: 30000, - }); - - await page.getByTestId("icon-ScanEye").nth(4).click(); - - await page.getByText("Sender", { exact: true }).isVisible(); - await page.getByText("Type", { exact: true }).isVisible(); - await page.getByText("User", { exact: true }).last().isVisible(); -}); - -test("user must be able to send an image on chat", async ({ page }) => { - if (!process.env.CI) { - dotenv.config({ path: path.resolve(__dirname, "../../.env") }); - } - - await page.goto("/"); - - await page.waitForTimeout(1000); - - 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.waitForSelector('[title="fit view"]', { - timeout: 100000, - }); - - await page.getByTitle("fit view").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - - if (!process.env.OPENAI_API_KEY) { - //You must set the OPENAI_API_KEY on .env file to run this test - expect(false).toBe(true); - } - - await page - .getByTestId("popover-anchor-input-openai_api_key") - .fill(process.env.OPENAI_API_KEY ?? ""); - - await page.getByTestId("dropdown-model_name").click(); - await page.getByTestId("gpt-4o-0-option").click(); - - await page.waitForSelector("text=Chat Input", { timeout: 30000 }); - - await page.getByText("Chat Input", { exact: true }).click(); - await page.getByTestId("more-options-modal").click(); - await page.getByTestId("edit-button-modal").click(); - await page.getByText("Save Changes").click(); - - await page.getByText("Playground", { exact: true }).click(); - - // Read the image file as a binary string - const filePath = "tests/end-to-end/assets/chain.png"; - const fileContent = readFileSync(filePath, "base64"); - - // Create the DataTransfer and File objects within the browser context - const dataTransfer = await page.evaluateHandle( - ({ fileContent }) => { - const dt = new DataTransfer(); - const byteCharacters = atob(fileContent); - const byteNumbers = new Array(byteCharacters.length); - for (let i = 0; i < byteCharacters.length; i++) { - byteNumbers[i] = byteCharacters.charCodeAt(i); - } - const byteArray = new Uint8Array(byteNumbers); - const file = new File([byteArray], "chain.png", { type: "image/png" }); - dt.items.add(file); - return dt; - }, - { fileContent }, - ); - - // Locate the target element - const element = await page.getByTestId("input-chat-playground"); - - // Dispatch the drop event on the target element - await element.dispatchEvent("drop", { dataTransfer }); - - await page.waitForSelector('[data-testid="icon-LucideSend"]', { - timeout: 100000, - }); - - await page.getByTestId("icon-LucideSend").click(); - - await page.waitForSelector("text=chain.png", { timeout: 30000 }); - - await page.getByText("chain.png").isVisible(); - - await page.getByText("Close", { exact: true }).click(); - - await page.waitForSelector('[data-testid="icon-ScanEye"]', { - timeout: 30000, - }); - - await page.getByTestId("icon-ScanEye").nth(4).click(); - - await page.getByText("Restart").isHidden(); -}); diff --git a/src/frontend/tests/end-to-end/filterSidebar.spec.ts b/src/frontend/tests/end-to-end/filterSidebar.spec.ts new file mode 100644 index 000000000..b8190db86 --- /dev/null +++ b/src/frontend/tests/end-to-end/filterSidebar.spec.ts @@ -0,0 +1,109 @@ +import { expect, test } from "@playwright/test"; + +test("LLMChain - Filter", 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.waitForTimeout(1000); + + await page.getByTestId("blank-flow").click(); + await page.waitForTimeout(3000); + + await page.waitForSelector('[data-testid="extended-disclosure"]', { + timeout: 100000, + }); + + await page.getByTestId("extended-disclosure").click(); + await page.getByPlaceholder("Search").click(); + await page.getByPlaceholder("Search").fill("llmchain"); + + await page.waitForTimeout(1000); + await page + .getByTestId("chainsLLMChain") + .dragTo(page.locator('//*[@id="react-flow-id"]')); + await page.mouse.up(); + await page.mouse.down(); + await page.getByTitle("fit view").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + await page.waitForTimeout(500); + + await page + .locator( + '//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div/div/div[2]/div[7]/button/div[1]', + ) + .click(); + + await expect(page.getByTestId("disclosure-agents")).toBeVisible(); + + await expect(page.getByTestId("chainsLLMChain").first()).toBeVisible(); + await expect( + page.getByTestId("langchain_utilitiesSearchApi").first(), + ).toBeVisible(); + await expect( + page.getByTestId("memoriesAstra DB Message Reader").first(), + ).toBeVisible(); + await expect( + page.getByTestId("prototypesFlow as Tool").first(), + ).toBeVisible(); + await expect( + page.getByTestId("retrieversAmazon Kendra Retriever").first(), + ).toBeVisible(); + await expect( + page.getByTestId("textsplittersCharacterTextSplitter").first(), + ).toBeVisible(); + await expect( + page.getByTestId("toolkitsVectorStoreInfo").first(), + ).toBeVisible(); + await expect(page.getByTestId("toolsSearchApi").first()).toBeVisible(); + + await page.getByPlaceholder("Search").click(); + + await expect(page.getByTestId("model_specsVertexAI")).not.toBeVisible(); + await expect(page.getByTestId("model_specsCTransformers")).not.toBeVisible(); + await expect(page.getByTestId("model_specsAmazon Bedrock")).not.toBeVisible(); + await expect(page.getByTestId("modelsAzure OpenAI")).not.toBeVisible(); + await expect( + page.getByTestId("model_specsAzureChatOpenAI"), + ).not.toBeVisible(); + await expect(page.getByTestId("model_specsChatAnthropic")).not.toBeVisible(); + await expect(page.getByTestId("model_specsChatLiteLLM")).not.toBeVisible(); + await expect(page.getByTestId("model_specsChatOllama")).not.toBeVisible(); + await expect(page.getByTestId("model_specsChatOpenAI")).not.toBeVisible(); + await expect(page.getByTestId("model_specsChatVertexAI")).not.toBeVisible(); + + await page + .locator( + '//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div/div/div[2]/div[4]/div/button/div[1]', + ) + .click(); + + await expect(page.getByTestId("disclosure-models")).toBeVisible(); + + await page + .locator( + '//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div/div/div[2]/div[3]/div/button/div[1]', + ) + .click(); + + await expect(page.getByTestId("disclosure-helpers")).toBeVisible(); + await expect(page.getByTestId("disclosure-agents")).toBeVisible(); + await expect(page.getByTestId("disclosure-chains")).toBeVisible(); + await expect(page.getByTestId("disclosure-prototypes")).toBeVisible(); +}); diff --git a/src/frontend/tests/end-to-end/filterEdge.spec.ts b/src/frontend/tests/end-to-end/handleTooltipSuggestions.spec.ts similarity index 55% rename from src/frontend/tests/end-to-end/filterEdge.spec.ts rename to src/frontend/tests/end-to-end/handleTooltipSuggestions.spec.ts index cac665c11..cdf80370a 100644 --- a/src/frontend/tests/end-to-end/filterEdge.spec.ts +++ b/src/frontend/tests/end-to-end/handleTooltipSuggestions.spec.ts @@ -157,111 +157,3 @@ test("LLMChain - Tooltip", async ({ page }) => { ).toBeVisible(); }); }); - -test("LLMChain - Filter", 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.waitForTimeout(1000); - - await page.getByTestId("blank-flow").click(); - await page.waitForTimeout(3000); - - await page.waitForSelector('[data-testid="extended-disclosure"]', { - timeout: 100000, - }); - - await page.getByTestId("extended-disclosure").click(); - await page.getByPlaceholder("Search").click(); - await page.getByPlaceholder("Search").fill("llmchain"); - - await page.waitForTimeout(1000); - await page - .getByTestId("chainsLLMChain") - .dragTo(page.locator('//*[@id="react-flow-id"]')); - await page.mouse.up(); - await page.mouse.down(); - await page.getByTitle("fit view").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - await page.getByTitle("zoom out").click(); - await page.waitForTimeout(500); - - await page - .locator( - '//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div/div/div[2]/div[7]/button/div[1]', - ) - .click(); - - await expect(page.getByTestId("disclosure-agents")).toBeVisible(); - - await expect(page.getByTestId("chainsLLMChain").first()).toBeVisible(); - await expect( - page.getByTestId("langchain_utilitiesSearchApi").first(), - ).toBeVisible(); - await expect( - page.getByTestId("memoriesAstra DB Message Reader").first(), - ).toBeVisible(); - await expect( - page.getByTestId("prototypesFlow as Tool").first(), - ).toBeVisible(); - await expect( - page.getByTestId("retrieversAmazon Kendra Retriever").first(), - ).toBeVisible(); - await expect( - page.getByTestId("textsplittersCharacterTextSplitter").first(), - ).toBeVisible(); - await expect( - page.getByTestId("toolkitsVectorStoreInfo").first(), - ).toBeVisible(); - await expect(page.getByTestId("toolsSearchApi").first()).toBeVisible(); - - await page.getByPlaceholder("Search").click(); - - await expect(page.getByTestId("model_specsVertexAI")).not.toBeVisible(); - await expect(page.getByTestId("model_specsCTransformers")).not.toBeVisible(); - await expect(page.getByTestId("model_specsAmazon Bedrock")).not.toBeVisible(); - await expect(page.getByTestId("modelsAzure OpenAI")).not.toBeVisible(); - await expect( - page.getByTestId("model_specsAzureChatOpenAI"), - ).not.toBeVisible(); - await expect(page.getByTestId("model_specsChatAnthropic")).not.toBeVisible(); - await expect(page.getByTestId("model_specsChatLiteLLM")).not.toBeVisible(); - await expect(page.getByTestId("model_specsChatOllama")).not.toBeVisible(); - await expect(page.getByTestId("model_specsChatOpenAI")).not.toBeVisible(); - await expect(page.getByTestId("model_specsChatVertexAI")).not.toBeVisible(); - - await page - .locator( - '//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div/div/div[2]/div[4]/div/button/div[1]', - ) - .click(); - - await expect(page.getByTestId("disclosure-models")).toBeVisible(); - - await page - .locator( - '//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div/div/div[2]/div[3]/div/button/div[1]', - ) - .click(); - - await expect(page.getByTestId("disclosure-helpers")).toBeVisible(); - await expect(page.getByTestId("disclosure-agents")).toBeVisible(); - await expect(page.getByTestId("disclosure-chains")).toBeVisible(); - await expect(page.getByTestId("disclosure-prototypes")).toBeVisible(); -}); diff --git a/src/frontend/tests/end-to-end/store-2.spec.ts b/src/frontend/tests/end-to-end/store-2.spec.ts index 35ba80341..ba1a61746 100644 --- a/src/frontend/tests/end-to-end/store-2.spec.ts +++ b/src/frontend/tests/end-to-end/store-2.spec.ts @@ -1,13 +1,5 @@ import { expect, test } from "@playwright/test"; -test("should exists Store", async ({ page }) => { - await page.goto("/"); - await page.waitForTimeout(1000); - - await page.getByTestId("button-store").isVisible(); - await page.getByTestId("button-store").isEnabled(); -}); - test("should not have an API key", async ({ page }) => { await page.goto("/"); await page.waitForTimeout(1000); @@ -64,61 +56,3 @@ test("should filter by tag", async ({ page }) => { await page.getByText("Basic RAG").isVisible(); }); - -test("should order the visualization", async ({ page }) => { - await page.goto("/"); - await page.waitForTimeout(1000); - - await page.getByTestId("button-store").click(); - await page.waitForTimeout(1000); - - await page.getByText("Basic RAG").isVisible(); - - await page.getByTestId("select-order-store").click(); - await page.waitForTimeout(2000); - await page.getByText("Alphabetical").click(); - - await page.getByText("Album Cover Builder").isVisible(); - - await page.getByTestId("select-order-store").click(); - await page.getByText("Popular").click(); - - await page.getByText("Basic RAG").isVisible(); -}); - -test("should filter by type", async ({ page }) => { - await page.goto("/"); - await page.waitForTimeout(1000); - - await page.getByTestId("button-store").click(); - await page.waitForTimeout(1000); - - await page.getByText("Website Content QA").isVisible(); - - await page.getByTestId("flows-button-store").click(); - await page.waitForTimeout(8000); - - let iconGroup = await page.getByTestId("icon-Group")?.count(); - expect(iconGroup).not.toBe(0); - - await page.getByText("icon-ToyBrick").last().isHidden(); - - await page.getByTestId("components-button-store").click(); - await page.waitForTimeout(8000); - - await page.getByTestId("icon-Group").last().isHidden(); - let toyBrick = await page.getByTestId("icon-ToyBrick")?.count(); - expect(toyBrick).not.toBe(0); - - await page.getByTestId("all-button-store").click(); - await page.waitForTimeout(8000); - - let iconGroupAllCount = await page.getByTestId("icon-Group")?.count(); - await page.waitForTimeout(2000); - let toyBrickAllCount = await page.getByTestId("icon-ToyBrick")?.count(); - await page.waitForTimeout(2000); - - if (iconGroupAllCount === 0 || toyBrickAllCount === 0) { - expect(false).toBe(true); - } -}); diff --git a/src/frontend/tests/end-to-end/store-3.spec.ts b/src/frontend/tests/end-to-end/store-3.spec.ts new file mode 100644 index 000000000..8d911f7a6 --- /dev/null +++ b/src/frontend/tests/end-to-end/store-3.spec.ts @@ -0,0 +1,124 @@ +import { expect, test } from "@playwright/test"; + +test("should share component with share button", 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.waitForTimeout(1000); + + const randomName = Math.random().toString(36).substring(2); + + await page.getByRole("heading", { name: "Basic Prompting" }).click(); + await page.waitForTimeout(1000); + const flowName = await page.getByTestId("flow_name").innerText(); + await page.getByTestId("flow_name").click(); + await page.getByText("Settings").click(); + const flowDescription = await page + .getByPlaceholder("Flow description") + .inputValue(); + await page.getByPlaceholder("Flow name").fill(randomName); + await page.getByText("Save").last().click(); + await page.getByText("Close").last().click(); + + await page.waitForSelector('[data-testid="shared-button-flow"]', { + timeout: 100000, + }); + + await page.getByTestId("shared-button-flow").first().click(); + await page.getByText("Name:").isVisible(); + await page.getByText("Description:").isVisible(); + await page.getByText("Set workflow status to public").isVisible(); + await page + .getByText( + "Attention: API keys in specified fields are automatically removed upon sharing.", + ) + .isVisible(); + await page.getByText("Export").first().isVisible(); + await page.getByText("Share Flow").first().isVisible(); + + await page.waitForTimeout(5000); + + await page.getByText("Agent").first().isVisible(); + await page.getByText("Memory").first().isVisible(); + await page.getByText("Chain").first().isVisible(); + await page.getByText("Vector Store").first().isVisible(); + await page.getByText("Prompt").last().isVisible(); + await page.getByTestId("public-checkbox").isChecked(); + await page.getByText(flowName).last().isVisible(); + await page.getByText(flowDescription).last().isVisible(); + await page.waitForTimeout(1000); + await page.getByText("Flow shared successfully").last().isVisible(); +}); + +test("should order the visualization", async ({ page }) => { + await page.goto("/"); + await page.waitForTimeout(1000); + + await page.getByTestId("button-store").click(); + await page.waitForTimeout(1000); + + await page.getByText("Basic RAG").isVisible(); + + await page.getByTestId("select-order-store").click(); + await page.waitForTimeout(2000); + await page.getByText("Alphabetical").click(); + + await page.getByText("Album Cover Builder").isVisible(); + + await page.getByTestId("select-order-store").click(); + await page.getByText("Popular").click(); + + await page.getByText("Basic RAG").isVisible(); +}); + +test("should filter by type", async ({ page }) => { + await page.goto("/"); + await page.waitForTimeout(1000); + + await page.getByTestId("button-store").click(); + await page.waitForTimeout(1000); + + await page.getByText("Website Content QA").isVisible(); + + await page.getByTestId("flows-button-store").click(); + await page.waitForTimeout(8000); + + let iconGroup = await page.getByTestId("icon-Group")?.count(); + expect(iconGroup).not.toBe(0); + + await page.getByText("icon-ToyBrick").last().isHidden(); + + await page.getByTestId("components-button-store").click(); + await page.waitForTimeout(8000); + + await page.getByTestId("icon-Group").last().isHidden(); + let toyBrick = await page.getByTestId("icon-ToyBrick")?.count(); + expect(toyBrick).not.toBe(0); + + await page.getByTestId("all-button-store").click(); + await page.waitForTimeout(8000); + + let iconGroupAllCount = await page.getByTestId("icon-Group")?.count(); + await page.waitForTimeout(2000); + let toyBrickAllCount = await page.getByTestId("icon-ToyBrick")?.count(); + await page.waitForTimeout(2000); + + if (iconGroupAllCount === 0 || toyBrickAllCount === 0) { + expect(false).toBe(true); + } +}); diff --git a/src/frontend/tests/end-to-end/store.spec.ts b/src/frontend/tests/end-to-end/store.spec.ts index 61e01adb0..2b2f81127 100644 --- a/src/frontend/tests/end-to-end/store.spec.ts +++ b/src/frontend/tests/end-to-end/store.spec.ts @@ -1,5 +1,13 @@ import { expect, test } from "@playwright/test"; +test("should exists Store", async ({ page }) => { + await page.goto("/"); + await page.waitForTimeout(1000); + + await page.getByTestId("button-store").isVisible(); + await page.getByTestId("button-store").isEnabled(); +}); + test("should add API-KEY", async ({ page }) => { await page.goto("/"); await page.waitForTimeout(1000); @@ -100,68 +108,3 @@ test("should like and add components and flows", async ({ page }) => { await page.getByText("Components").first().click(); await page.getByText("Basic RAG").first().isVisible(); }); - -test("should share component with share button", 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.waitForTimeout(1000); - - const randomName = Math.random().toString(36).substring(2); - - await page.getByRole("heading", { name: "Basic Prompting" }).click(); - await page.waitForTimeout(1000); - const flowName = await page.getByTestId("flow_name").innerText(); - await page.getByTestId("flow_name").click(); - await page.getByText("Settings").click(); - const flowDescription = await page - .getByPlaceholder("Flow description") - .inputValue(); - await page.getByPlaceholder("Flow name").fill(randomName); - await page.getByText("Save").last().click(); - await page.getByText("Close").last().click(); - - await page.waitForSelector('[data-testid="shared-button-flow"]', { - timeout: 100000, - }); - - await page.getByTestId("shared-button-flow").first().click(); - await page.getByText("Name:").isVisible(); - await page.getByText("Description:").isVisible(); - await page.getByText("Set workflow status to public").isVisible(); - await page - .getByText( - "Attention: API keys in specified fields are automatically removed upon sharing.", - ) - .isVisible(); - await page.getByText("Export").first().isVisible(); - await page.getByText("Share Flow").first().isVisible(); - - await page.waitForTimeout(5000); - - await page.getByText("Agent").first().isVisible(); - await page.getByText("Memory").first().isVisible(); - await page.getByText("Chain").first().isVisible(); - await page.getByText("Vector Store").first().isVisible(); - await page.getByText("Prompt").last().isVisible(); - await page.getByTestId("public-checkbox").isChecked(); - await page.getByText(flowName).last().isVisible(); - await page.getByText(flowDescription).last().isVisible(); - await page.waitForTimeout(1000); - await page.getByText("Flow shared successfully").last().isVisible(); -}); diff --git a/src/frontend/tests/end-to-end/textInputOutput.spec.ts b/src/frontend/tests/end-to-end/textInputOutput.spec.ts index 47335c30c..475269bb5 100644 --- a/src/frontend/tests/end-to-end/textInputOutput.spec.ts +++ b/src/frontend/tests/end-to-end/textInputOutput.spec.ts @@ -113,7 +113,9 @@ test("TextInputOutputComponent", async ({ page }) => { timeout: 100000, }); - await page.getByTitle("fit view").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); + await page.getByTitle("zoom out").click(); await page.getByTitle("zoom out").click(); await page.getByTitle("zoom out").click(); await page.getByTitle("zoom out").click(); @@ -127,7 +129,7 @@ test("TextInputOutputComponent", async ({ page }) => { ); const element4 = await page.locator( - '//*[@id="react-flow-id"]/div/div[1]/div/div/div[2]/div[2]/div/div[2]/div[15]/button/div[1]', + '//*[@id="react-flow-id"]/div/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/div[16]/button/div[1]', ); // ensure elements popups are not blocking diff --git a/src/frontend/tsconfig.json b/src/frontend/tsconfig.json index b1e7a3fd8..e0783a71a 100644 --- a/src/frontend/tsconfig.json +++ b/src/frontend/tsconfig.json @@ -23,7 +23,7 @@ "tests/end-to-end/actionsMainPage.spec.ts", "tests/end-to-end/auto_login.spec.ts", "tests/end-to-end/chatInputOutput.spec.ts", - "tests/end-to-end/chatInputOutputUser.spec.ts", + "tests/end-to-end/chatInputOutputUser - Interact.spec.ts", "tests/end-to-end/codeAreaModalComponent.spec.ts", "tests/end-to-end/curl_api_generation.spec.ts", "tests/end-to-end/deleteComponentFlows.spec.ts", @@ -51,6 +51,7 @@ "tests/end-to-end/toggleComponent.spec.ts", "tests/end-to-end/tweaks_test.spec.ts", "tests/end-to-end/twoEdges.spec.ts", - "tests/end-to-end/userSettings.spec.ts" -, "tests/end-to-end/store.spec.ts" ] + "tests/end-to-end/userSettings.spec.ts", + "tests/end-to-end/store.spec.ts" + ] }