From 3fb2bfefec2bf6e180c6a2b31b955198c0663c82 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Mon, 2 Dec 2024 15:08:54 -0800 Subject: [PATCH] Update Chromatic Tests (#3300) * remove / update search tests * minor update --- web/tests/e2e/admin_auth.setup.ts | 6 +++--- web/tests/e2e/chat.spec.ts | 22 +++++++++++++++------- web/tests/e2e/home.spec.ts | 6 +++--- web/tests/e2e/search.spec.ts | 19 ------------------- 4 files changed, 21 insertions(+), 32 deletions(-) delete mode 100644 web/tests/e2e/search.spec.ts diff --git a/web/tests/e2e/admin_auth.setup.ts b/web/tests/e2e/admin_auth.setup.ts index 6eb891eba92..c4dcf8eedfd 100644 --- a/web/tests/e2e/admin_auth.setup.ts +++ b/web/tests/e2e/admin_auth.setup.ts @@ -6,9 +6,9 @@ import { TEST_CREDENTIALS } from "./constants"; setup("authenticate", async ({ page }) => { const { email, password } = TEST_CREDENTIALS; - await page.goto("http://localhost:3000/search"); + await page.goto("http://localhost:3000/chat"); - await page.waitForURL("http://localhost:3000/auth/login?next=%2Fsearch"); + await page.waitForURL("http://localhost:3000/auth/login?next=%2Fchat"); await expect(page).toHaveTitle("Danswer"); @@ -18,7 +18,7 @@ setup("authenticate", async ({ page }) => { // Click the login button await page.click('button[type="submit"]'); - await page.waitForURL("http://localhost:3000/search"); + await page.waitForURL("http://localhost:3000/chat"); await page.context().storageState({ path: "admin_auth.json" }); }); diff --git a/web/tests/e2e/chat.spec.ts b/web/tests/e2e/chat.spec.ts index e1e720f3dfd..e5d096ab0f6 100644 --- a/web/tests/e2e/chat.spec.ts +++ b/web/tests/e2e/chat.spec.ts @@ -8,12 +8,20 @@ test( async ({ page }, testInfo) => { // Test simple loading await page.goto("http://localhost:3000/chat"); - await expect(page.locator("div.text-2xl").nth(0)).toHaveText("General"); - await expect(page.getByRole("button", { name: "Search S" })).toHaveClass( - /text-text-application-untoggled/ - ); - await expect(page.getByRole("button", { name: "Chat D" })).toHaveClass( - /text-text-application-toggled/ - ); + + // Check for the "General" text in the new UI element + await expect( + page.locator("div.flex.items-center span.font-bold") + ).toHaveText("General"); + + // Check for the presence of the new UI element + await expect( + page.locator("div.flex.justify-center div.bg-black.rounded-full") + ).toBeVisible(); + + // Check for the SVG icon + await expect( + page.locator("div.flex.justify-center svg.w-5.h-5") + ).toBeVisible(); } ); diff --git a/web/tests/e2e/home.spec.ts b/web/tests/e2e/home.spec.ts index d2f87a2d21d..2b1605fa1d0 100644 --- a/web/tests/e2e/home.spec.ts +++ b/web/tests/e2e/home.spec.ts @@ -12,9 +12,9 @@ test( // Test redirect to login, and redirect to search after login const { email, password } = TEST_CREDENTIALS; - await page.goto("http://localhost:3000/search"); + await page.goto("http://localhost:3000/chat"); - await page.waitForURL("http://localhost:3000/auth/login?next=%2Fsearch"); + await page.waitForURL("http://localhost:3000/auth/login?next=%2Fchat"); await expect(page).toHaveTitle("Danswer"); @@ -26,6 +26,6 @@ test( // Click the login button await page.click('button[type="submit"]'); - await page.waitForURL("http://localhost:3000/search"); + await page.waitForURL("http://localhost:3000/chat"); } ); diff --git a/web/tests/e2e/search.spec.ts b/web/tests/e2e/search.spec.ts deleted file mode 100644 index 2b4a212479e..00000000000 --- a/web/tests/e2e/search.spec.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test, expect } from "@chromatic-com/playwright"; - -test( - "Search", - { - tag: "@admin", - }, - async ({ page }, testInfo) => { - // Test simple loading - await page.goto("http://localhost:3000/search"); - await expect(page.locator("div.text-3xl")).toHaveText("Unlock Knowledge"); - await expect(page.getByRole("button", { name: "Search S" })).toHaveClass( - /text-text-application-toggled/ - ); - await expect(page.getByRole("button", { name: "Chat D" })).toHaveClass( - /text-text-application-untoggled/ - ); - } -);