From 37af16115440e1d4ebdb2cfc2445f962bddd745e Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Wed, 26 Jun 2024 22:22:51 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20(typescript=5Ftest.yml):=20update?= =?UTF-8?q?=20shard=20configuration=20to=20include=206=20shards=20?= =?UTF-8?q?=E2=9C=85=20(index.tsx):=20add=20data-testid=20attribute=20to?= =?UTF-8?q?=20checkbox=20component=20=E2=9C=85=20(basicExamples.spec.ts):?= =?UTF-8?q?=20add=20waitForSelector=20for=20send=20icon=20to=20improve=20t?= =?UTF-8?q?est=20stability=20=E2=9C=85=20(chatInputOutputUser.spec.ts):=20?= =?UTF-8?q?add=20waitForSelector=20for=20send=20icon=20to=20improve=20test?= =?UTF-8?q?=20stability=20=E2=9C=85=20(deleteComponentFlows.spec.ts):=20ad?= =?UTF-8?q?d=20waitForSelector=20for=20various=20elements=20to=20improve?= =?UTF-8?q?=20test=20stability=20=E2=9C=85=20(generalBugs.spec.ts):=20add?= =?UTF-8?q?=20waitForSelector=20for=20send=20icon=20to=20improve=20test=20?= =?UTF-8?q?stability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/typescript_test.yml | 4 +-- .../src/components/cardComponent/index.tsx | 1 + .../tests/end-to-end/basicExamples.spec.ts | 5 ++++ .../end-to-end/chatInputOutputUser.spec.ts | 30 +++++++++++++++---- .../end-to-end/deleteComponentFlows.spec.ts | 24 +++++++++++++-- .../tests/end-to-end/generalBugs.spec.ts | 5 ++++ 6 files changed, 59 insertions(+), 10 deletions(-) diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 5b060f5e7..50ffb9d44 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -23,8 +23,8 @@ jobs: strategy: fail-fast: false matrix: - shardIndex: [1, 2, 3, 4, 5] - shardTotal: [5] + shardIndex: [1, 2, 3, 4, 5, 6] + shardTotal: [6] env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} steps: diff --git a/src/frontend/src/components/cardComponent/index.tsx b/src/frontend/src/components/cardComponent/index.tsx index 9e5825155..a77877a2f 100644 --- a/src/frontend/src/components/cardComponent/index.tsx +++ b/src/frontend/src/components/cardComponent/index.tsx @@ -229,6 +229,7 @@ export default function CollectionCardComponent({ render={({ field }) => ( { .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 }); diff --git a/src/frontend/tests/end-to-end/chatInputOutputUser.spec.ts b/src/frontend/tests/end-to-end/chatInputOutputUser.spec.ts index 5446881c3..185f00be8 100644 --- a/src/frontend/tests/end-to-end/chatInputOutputUser.spec.ts +++ b/src/frontend/tests/end-to-end/chatInputOutputUser.spec.ts @@ -58,6 +58,11 @@ test("user must interact with chat with Input/Output", async ({ page }) => { }); await page.getByTestId("input-chat-playground").fill("Hello, how are you?"); + + await page.waitForSelector('[data-testid="icon-LucideSend"]', { + timeout: 100000, + }); + await page.getByTestId("icon-LucideSend").click(); let valueUser = await page.getByTestId("sender_name_user").textContent(); @@ -79,6 +84,11 @@ test("user must interact with chat with Input/Output", async ({ page }) => { "testtesttesttesttesttestte;.;.,;,.;,.;.,;,..,;;;;;;;;;;;;;;;;;;;;;,;.;,.;,.,;.,;.;.,~~çççççççççççççççççççççççççççççççççççççççisdajfdasiopjfaodisjhvoicxjiovjcxizopjviopasjioasfhjaiohf23432432432423423sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestççççççççççççççççççççççççççççççççç,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,!", ); await page.getByText("Playground", { exact: true }).last().click(); + + await page.waitForSelector('[data-testid="icon-LucideSend"]', { + timeout: 100000, + }); + await page.getByTestId("icon-LucideSend").click(); await page.getByText("Close", { exact: true }).click(); await page.getByText("Chat Input", { exact: true }).click(); @@ -101,6 +111,11 @@ test("user must interact with chat with Input/Output", async ({ page }) => { .fill("TestSenderNameAI"); await page.getByText("Playground", { exact: true }).last().click(); + + await page.waitForSelector('[data-testid="icon-LucideSend"]', { + timeout: 100000, + }); + await page.getByTestId("icon-LucideSend").click(); valueUser = await page @@ -233,7 +248,8 @@ test("user must be able to send an image on chat", async ({ page }) => { await page.getByTestId("dropdown-model_name").click(); await page.getByTestId("gpt-4o-0-option").click(); - await page.waitForTimeout(2000); + 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(); @@ -242,7 +258,7 @@ test("user must be able to send an image on chat", async ({ page }) => { 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 filePath = "src/frontend/tests/end-to-end/assets/chain.png"; const fileContent = readFileSync(filePath, "base64"); // Create the DataTransfer and File objects within the browser context @@ -268,11 +284,14 @@ test("user must be able to send an image on chat", async ({ page }) => { // Dispatch the drop event on the target element await element.dispatchEvent("drop", { dataTransfer }); - await page.waitForTimeout(4000); + await page.waitForSelector('[data-testid="icon-LucideSend"]', { + timeout: 100000, + }); - await page.getByText("chain.png").isVisible(); await page.getByTestId("icon-LucideSend").click(); - await page.waitForTimeout(2000); + + await page.waitForSelector("text=chain.png", { timeout: 30000 }); + await page.getByText("chain.png").isVisible(); await page.getByText("Close", { exact: true }).click(); @@ -282,5 +301,6 @@ test("user must be able to send an image on chat", async ({ page }) => { }); await page.getByTestId("icon-ScanEye").nth(4).click(); + await page.getByText("Restart").isHidden(); }); diff --git a/src/frontend/tests/end-to-end/deleteComponentFlows.spec.ts b/src/frontend/tests/end-to-end/deleteComponentFlows.spec.ts index 9099727b6..c89d479ae 100644 --- a/src/frontend/tests/end-to-end/deleteComponentFlows.spec.ts +++ b/src/frontend/tests/end-to-end/deleteComponentFlows.spec.ts @@ -9,13 +9,27 @@ test("should delete a flow", async ({ page }) => { await page .getByPlaceholder("Insert your API Key", { exact: true }) .fill(process.env.STORE_API_KEY ?? ""); + + await page.waitForSelector("text=Save", { timeout: 30000 }); + await page.getByText("Save").last().click(); - await page.waitForTimeout(8000); + + await page.waitForSelector("text=Store", { timeout: 30000 }); + await page.getByText("Store").nth(0).click(); + await page.waitForSelector('[data-testid="install-Website Content QA"]', { + timeout: 100000, + }); + await page.getByTestId("install-Website Content QA").click(); - await page.waitForTimeout(5000); + + await page.waitForSelector("text=My Collection", { timeout: 30000 }); + await page.getByText("My Collection").nth(0).click(); + + await page.waitForSelector("text=Website Content QA", { timeout: 30000 }); + await page.getByText("Website Content QA").first().isVisible(); await page.getByLabel("checkbox-component").last().waitFor({ @@ -23,7 +37,11 @@ test("should delete a flow", async ({ page }) => { timeout: 30000, // Timeout of 30 seconds }); - await page.getByLabel("checkbox-component").first().click(); + await page.waitForSelector('[data-testid="checkbox-component"]', { + timeout: 100000, + }); + + await page.getByTestId("checkbox-component").first().click(); await page.getByTestId("icon-Trash2").click(); await page diff --git a/src/frontend/tests/end-to-end/generalBugs.spec.ts b/src/frontend/tests/end-to-end/generalBugs.spec.ts index 082f09ef8..15825f8a1 100644 --- a/src/frontend/tests/end-to-end/generalBugs.spec.ts +++ b/src/frontend/tests/end-to-end/generalBugs.spec.ts @@ -95,6 +95,11 @@ test("erase button should clear the chat messages", async ({ page }) => { }); await page.getByTestId("input-chat-playground").fill("Hello, how are you?"); + + await page.waitForSelector('[data-testid="icon-LucideSend"]', { + timeout: 100000, + }); + await page.getByTestId("icon-LucideSend").click(); let valueUser = await page.getByTestId("sender_name_user").textContent();