From e5735fd0f4e33806c4b37f2e7544a070584db3ba Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Wed, 26 Jun 2024 16:23:27 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20(tests):=20update=20test=20selector?= =?UTF-8?q?s=20to=20use=20test=20IDs=20for=20model=20selection=20=E2=9C=85?= =?UTF-8?q?=20(tests):=20add=20waitForTimeout=20to=20ensure=20stability=20?= =?UTF-8?q?in=20end-to-end=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/end-to-end/basicExamples.spec.ts | 14 ++++++++++---- .../tests/end-to-end/chatInputOutputUser.spec.ts | 9 ++++++--- src/frontend/tests/end-to-end/generalBugs.spec.ts | 3 ++- src/frontend/tests/end-to-end/logs.spec.ts | 3 ++- .../tests/end-to-end/textInputOutput.spec.ts | 3 ++- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/frontend/tests/end-to-end/basicExamples.spec.ts b/src/frontend/tests/end-to-end/basicExamples.spec.ts index 84c98634e..30f97a559 100644 --- a/src/frontend/tests/end-to-end/basicExamples.spec.ts +++ b/src/frontend/tests/end-to-end/basicExamples.spec.ts @@ -42,7 +42,9 @@ test("Basic Prompting (Hello, World)", async ({ page }) => { .fill(process.env.OPENAI_API_KEY ?? ""); await page.getByTestId("dropdown-model_name").click(); - await page.getByText("gpt-4o", { exact: true }).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 }); @@ -125,7 +127,9 @@ test("Memory Chatbot", async ({ page }) => { .fill(process.env.OPENAI_API_KEY ?? ""); await page.getByTestId("dropdown-model_name").click(); - await page.getByText("gpt-4o", { exact: true }).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 }); @@ -218,8 +222,9 @@ test("Document QA", async ({ page }) => { .fill(process.env.OPENAI_API_KEY ?? ""); await page.getByTestId("dropdown-model_name").click(); - await page.getByText("gpt-4o", { exact: true }).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; @@ -311,8 +316,9 @@ test("Blog Writer", async ({ page }) => { .fill(process.env.OPENAI_API_KEY ?? ""); await page.getByTestId("dropdown-model_name").click(); - await page.getByText("gpt-4o", { exact: true }).click(); + await page.getByTestId("gpt-4o-0-option").click(); + await page.waitForTimeout(2000); await page .getByTestId("input-list-input_urls-0") .nth(0) diff --git a/src/frontend/tests/end-to-end/chatInputOutputUser.spec.ts b/src/frontend/tests/end-to-end/chatInputOutputUser.spec.ts index f90166f8c..5446881c3 100644 --- a/src/frontend/tests/end-to-end/chatInputOutputUser.spec.ts +++ b/src/frontend/tests/end-to-end/chatInputOutputUser.spec.ts @@ -48,8 +48,9 @@ test("user must interact with chat with Input/Output", async ({ page }) => { .fill(process.env.OPENAI_API_KEY ?? ""); await page.getByTestId("dropdown-model_name").click(); - await page.getByText("gpt-4o", { exact: true }).click(); + await page.getByTestId("gpt-4o-0-option").click(); + await page.waitForTimeout(2000); await page.getByText("Playground", { exact: true }).click(); await page.waitForSelector('[data-testid="input-chat-playground"]', { @@ -167,8 +168,9 @@ test("user must be able to see output inspection", async ({ page }) => { .fill(process.env.OPENAI_API_KEY ?? ""); await page.getByTestId("dropdown-model_name").click(); - await page.getByText("gpt-4o", { exact: true }).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); @@ -229,8 +231,9 @@ test("user must be able to send an image on chat", async ({ page }) => { .fill(process.env.OPENAI_API_KEY ?? ""); await page.getByTestId("dropdown-model_name").click(); - await page.getByText("gpt-4o", { exact: true }).click(); + await page.getByTestId("gpt-4o-0-option").click(); + await page.waitForTimeout(2000); await page.getByText("Chat Input", { exact: true }).click(); await page.getByTestId("more-options-modal").click(); await page.getByTestId("edit-button-modal").click(); diff --git a/src/frontend/tests/end-to-end/generalBugs.spec.ts b/src/frontend/tests/end-to-end/generalBugs.spec.ts index b9b8bd9b0..082f09ef8 100644 --- a/src/frontend/tests/end-to-end/generalBugs.spec.ts +++ b/src/frontend/tests/end-to-end/generalBugs.spec.ts @@ -85,8 +85,9 @@ test("erase button should clear the chat messages", async ({ page }) => { .fill(process.env.OPENAI_API_KEY ?? ""); await page.getByTestId("dropdown-model_name").click(); - await page.getByText("gpt-4o", { exact: true }).click(); + await page.getByTestId("gpt-4o-0-option").click(); + await page.waitForTimeout(2000); await page.getByText("Playground", { exact: true }).click(); await page.waitForSelector('[data-testid="input-chat-playground"]', { diff --git a/src/frontend/tests/end-to-end/logs.spec.ts b/src/frontend/tests/end-to-end/logs.spec.ts index dc9e3aa62..f3f0a7c95 100644 --- a/src/frontend/tests/end-to-end/logs.spec.ts +++ b/src/frontend/tests/end-to-end/logs.spec.ts @@ -35,8 +35,9 @@ test("should able to see and interact with logs", async ({ page }) => { .fill(process.env.OPENAI_API_KEY ?? ""); await page.getByTestId("dropdown-model_name").click(); - await page.getByText("gpt-4o", { exact: true }).click(); + await page.getByTestId("gpt-4o-0-option").click(); + await page.waitForTimeout(2000); await page.getByTestId("button_run_chat output").first().click(); await page.waitForTimeout(2000); diff --git a/src/frontend/tests/end-to-end/textInputOutput.spec.ts b/src/frontend/tests/end-to-end/textInputOutput.spec.ts index 403799e80..199941164 100644 --- a/src/frontend/tests/end-to-end/textInputOutput.spec.ts +++ b/src/frontend/tests/end-to-end/textInputOutput.spec.ts @@ -166,8 +166,9 @@ test("TextInputOutputComponent", async ({ page }) => { .fill(process.env.OPENAI_API_KEY ?? ""); await page.getByTestId("dropdown-model_name").click(); - await page.getByText("gpt-4o", { exact: true }).click(); + await page.getByTestId("gpt-4o-0-option").click(); + await page.waitForTimeout(2000); await page.getByText("Playground", { exact: true }).click(); await page.getByText("Run Flow", { exact: true }).click();