diff --git a/src/frontend/tests/end-to-end/chat_io.spec.ts b/src/frontend/tests/end-to-end/chat_io.spec.ts index 58a7901e3..b37ebfede 100644 --- a/src/frontend/tests/end-to-end/chat_io.spec.ts +++ b/src/frontend/tests/end-to-end/chat_io.spec.ts @@ -5,42 +5,42 @@ test.beforeEach(async ({ page }) => { // test.setTimeout(120000); }); test("chat_io_teste", async ({ page }) => { - await page.goto("/"); - await page.locator("span").filter({ hasText: "My Collection" }).isVisible(); - // Read your file into a buffer. - const jsonContent = readFileSync( - "tests/end-to-end/assets/ChatTest.json", - "utf-8" - ); + await page.goto("/"); + await page.locator("span").filter({ hasText: "My Collection" }).isVisible(); + // Read your file into a buffer. + const jsonContent = readFileSync( + "tests/end-to-end/assets/ChatTest.json", + "utf-8" + ); - // Create the DataTransfer and File - const dataTransfer = await page.evaluateHandle((data) => { - const dt = new DataTransfer(); - // Convert the buffer to a hex array - const file = new File([data], "ChatTest.json", { - type: "application/json", - }); - dt.items.add(file); - return dt; - }, jsonContent); + // Create the DataTransfer and File + const dataTransfer = await page.evaluateHandle((data) => { + const dt = new DataTransfer(); + // Convert the buffer to a hex array + const file = new File([data], "ChatTest.json", { + type: "application/json", + }); + dt.items.add(file); + return dt; + }, jsonContent); - await page.locator('//*[@id="new-project-btn"]').click(); - await page.waitForTimeout(2000); - - await page.getByTestId("blank-flow").click(); - await page.waitForTimeout(2000); + await page.locator('//*[@id="new-project-btn"]').click(); + await page.waitForTimeout(2000); - // Now dispatch - await page.dispatchEvent( - '//*[@id="react-flow-id"]/div[1]/div[1]/div', - "drop", - { - dataTransfer, - } - ); - await page.getByLabel('fit view').click(); - await page.getByText('Run', { exact: true }).click(); - await page.getByPlaceholder('Send a message...').click(); - await page.getByPlaceholder('Send a message...').fill('teste'); - await page.getByRole('button').nth(1).click(); + await page.getByTestId("blank-flow").click(); + await page.waitForTimeout(2000); + + // Now dispatch + await page.dispatchEvent( + '//*[@id="react-flow-id"]/div[1]/div[1]/div', + "drop", + { + dataTransfer, + } + ); + await page.getByLabel("fit view").click(); + await page.getByText("Run", { exact: true }).click(); + await page.getByPlaceholder("Send a message...").click(); + await page.getByPlaceholder("Send a message...").fill("teste"); + await page.getByRole("button").nth(1).click(); }); diff --git a/src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts b/src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts index 5101a6be2..322070faa 100644 --- a/src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts +++ b/src/frontend/tests/end-to-end/codeAreaModalComponent.spec.ts @@ -28,21 +28,31 @@ test("CodeAreaModalComponent", async ({ page }) => { await page.getByTestId("code-button-modal").click(); let value = await page.locator('//*[@id="codeValue"]').inputValue(); - const code = 'def python_function(text: str) -> str:\n """This is a default python function that returns the input text"""\n return text' - const wCode = 'def python_function(text: str) -> st: """This is a default python function that returns the input text""" return text' - const assertCode ='def python_function(text: str) -> str: """This is a default python function that returns the input text""" return text' - await page.locator('#CodeEditor div').filter({ hasText: 'def python_function(text: str' }).nth(1).click(); - await page.locator('textarea').press('Control+a'); - await page.locator('textarea').fill(wCode); + const code = + 'def python_function(text: str) -> str:\n """This is a default python function that returns the input text"""\n return text'; + const wCode = + 'def python_function(text: str) -> st: """This is a default python function that returns the input text""" return text'; + const assertCode = + 'def python_function(text: str) -> str: """This is a default python function that returns the input text""" return text'; + await page + .locator("#CodeEditor div") + .filter({ hasText: "def python_function(text: str" }) + .nth(1) + .click(); + await page.locator("textarea").press("Control+a"); + await page.locator("textarea").fill(wCode); await page.locator('//*[@id="checkAndSaveBtn"]').click(); await page.waitForTimeout(1000); - expect(await page.getByText("invalid syntax (, line 1)").isVisible()).toBeTruthy(); - await page.locator('textarea').press('Control+a'); - await page.locator('textarea').fill(wCode); - await page.locator('textarea').fill(code); + expect( + await page.getByText("invalid syntax (, line 1)").isVisible() + ).toBeTruthy(); + await page.locator("textarea").press("Control+a"); + await page.locator("textarea").fill(wCode); + await page.locator("textarea").fill(code); await page.locator('//*[@id="checkAndSaveBtn"]').click(); expect(await page.getByText("Code is ready to run").isVisible()).toBeTruthy(); await page.getByTestId("code-button-modal").click(); - expect(await page.locator('//*[@id="codeValue"]').inputValue()).toBe(assertCode); - -}); \ No newline at end of file + expect(await page.locator('//*[@id="codeValue"]').inputValue()).toBe( + assertCode + ); +}); diff --git a/src/frontend/tests/end-to-end/curl_api_generation.spec.ts b/src/frontend/tests/end-to-end/curl_api_generation.spec.ts index 1cbb18cd4..b725badb1 100644 --- a/src/frontend/tests/end-to-end/curl_api_generation.spec.ts +++ b/src/frontend/tests/end-to-end/curl_api_generation.spec.ts @@ -1,17 +1,17 @@ -import { test, expect } from '@playwright/test'; +import { expect, test } from "@playwright/test"; - -test('curl_api_generation', async ({ page,context }) => { +test("curl_api_generation", async ({ page, context }) => { await page.goto("/"); await page.locator('//*[@id="new-project-btn"]').click(); await context.grantPermissions(["clipboard-read", "clipboard-write"]); - await page.getByRole('heading', { name: 'Data Ingestion' }).click(); + await page.getByRole("heading", { name: "Data Ingestion" }).click(); await page.waitForTimeout(2000); - await page.getByText('API', { exact: true }).click(); - await page.getByRole('tab', { name: 'cURL' }).click(); - await page.getByRole('button', { name: 'Copy Code' }).click(); - const handle = await page.evaluateHandle(() => navigator.clipboard.readText()); + await page.getByText("API", { exact: true }).click(); + await page.getByRole("tab", { name: "cURL" }).click(); + await page.getByRole("button", { name: "Copy Code" }).click(); + const handle = await page.evaluateHandle(() => + navigator.clipboard.readText() + ); const clipboardContent = await handle.jsonValue(); expect(clipboardContent.length).toBeGreaterThan(0); - -}); \ No newline at end of file +}); diff --git a/src/frontend/tests/end-to-end/python_api_generation.spec.ts b/src/frontend/tests/end-to-end/python_api_generation.spec.ts index 50992cf1f..2d7a6af0d 100644 --- a/src/frontend/tests/end-to-end/python_api_generation.spec.ts +++ b/src/frontend/tests/end-to-end/python_api_generation.spec.ts @@ -1,17 +1,17 @@ -import { test, expect } from '@playwright/test'; +import { expect, test } from "@playwright/test"; - -test('python_api_generation', async ({ page,context }) => { +test("python_api_generation", async ({ page, context }) => { await page.goto("/"); await page.locator('//*[@id="new-project-btn"]').click(); await context.grantPermissions(["clipboard-read", "clipboard-write"]); - await page.getByRole('heading', { name: 'Data Ingestion' }).click(); + await page.getByRole("heading", { name: "Data Ingestion" }).click(); await page.waitForTimeout(2000); - await page.getByText('API', { exact: true }).click(); - await page.getByRole('tab', { name: 'Python API' }).click(); - await page.getByRole('button', { name: 'Copy Code' }).click(); - const handle = await page.evaluateHandle(() => navigator.clipboard.readText()); + await page.getByText("API", { exact: true }).click(); + await page.getByRole("tab", { name: "Python API" }).click(); + await page.getByRole("button", { name: "Copy Code" }).click(); + const handle = await page.evaluateHandle(() => + navigator.clipboard.readText() + ); const clipboardContent = await handle.jsonValue(); expect(clipboardContent.length).toBeGreaterThan(0); - -}); \ No newline at end of file +}); diff --git a/src/frontend/tests/end-to-end/tweaks_test.spec.ts b/src/frontend/tests/end-to-end/tweaks_test.spec.ts index 63dbebcab..acfe6f1cb 100644 --- a/src/frontend/tests/end-to-end/tweaks_test.spec.ts +++ b/src/frontend/tests/end-to-end/tweaks_test.spec.ts @@ -1,28 +1,38 @@ -import { test, expect } from '@playwright/test'; +import { expect, test } from "@playwright/test"; -test('curl_api_generation', async ({ page,context }) => { +test("curl_api_generation", async ({ page, context }) => { await page.goto("/"); await page.locator('//*[@id="new-project-btn"]').click(); await context.grantPermissions(["clipboard-read", "clipboard-write"]); - await page.getByRole('heading', { name: 'Data Ingestion' }).click(); + await page.getByRole("heading", { name: "Data Ingestion" }).click(); await page.waitForTimeout(2000); - await page.getByText('API', { exact: true }).click(); - await page.getByRole('tab', { name: 'cURL' }).click(); - await page.getByRole('button', { name: 'Copy Code' }).click(); - const handle = await page.evaluateHandle(() => navigator.clipboard.readText()); + await page.getByText("API", { exact: true }).click(); + await page.getByRole("tab", { name: "cURL" }).click(); + await page.getByRole("button", { name: "Copy Code" }).click(); + const handle = await page.evaluateHandle(() => + navigator.clipboard.readText() + ); const clipboardContent = await handle.jsonValue(); const oldValue = clipboardContent; expect(clipboardContent.length).toBeGreaterThan(0); - await page.getByRole('tab', { name: 'Tweaks' }).click(); - await page.getByRole('heading', { name: 'URL' }).locator('div').first().click(); - await page.getByRole('textbox', { name: 'Type something...' }).click(); - await page.getByRole('textbox', { name: 'Type something...' }).press('Control+a'); - await page.getByRole('textbox', { name: 'Type something...' }).fill('teste'); - await page.getByRole('tab', { name: 'cURL' }).click(); - await page.getByRole('button', { name: 'Copy Code' }).click(); - const handle2 = await page.evaluateHandle(() => navigator.clipboard.readText()); + await page.getByRole("tab", { name: "Tweaks" }).click(); + await page + .getByRole("heading", { name: "URL" }) + .locator("div") + .first() + .click(); + await page.getByRole("textbox", { name: "Type something..." }).click(); + await page + .getByRole("textbox", { name: "Type something..." }) + .press("Control+a"); + await page.getByRole("textbox", { name: "Type something..." }).fill("teste"); + await page.getByRole("tab", { name: "cURL" }).click(); + await page.getByRole("button", { name: "Copy Code" }).click(); + const handle2 = await page.evaluateHandle(() => + navigator.clipboard.readText() + ); const clipboardContent2 = await handle2.jsonValue(); const newValue = clipboardContent2; expect(oldValue).not.toBe(newValue); expect(clipboardContent2.length).toBeGreaterThan(clipboardContent.length); -}); \ No newline at end of file +});