From e5883f179ce6f6ed9104ba416c62e5ca8c16bf22 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Mon, 21 Apr 2025 11:26:35 +0500 Subject: [PATCH] web: fix search tests --- apps/web/__e2e__/search.test.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/apps/web/__e2e__/search.test.ts b/apps/web/__e2e__/search.test.ts index b6fce7260..7bea730ca 100644 --- a/apps/web/__e2e__/search.test.ts +++ b/apps/web/__e2e__/search.test.ts @@ -24,32 +24,28 @@ import { getTestId } from "./utils"; test("closing search via close button should clear query", async ({ page }) => { const app = new AppModel(page); await app.goto(); - let searchinput = page.locator(getTestId("search-input")); + const searchInput = page.locator(getTestId("search-input")); const searchButton = page.locator(getTestId("search-button")); - const openSearch = page.locator(getTestId("open-search")); - await openSearch.click(); + await searchInput.focus(); await page.keyboard.type("test"); await page.waitForTimeout(500); await searchButton.click(); - await openSearch.click(); - expect(await searchinput.inputValue()).toBe(""); + expect(await searchInput.inputValue()).toBe(""); }); -test("closing search via keyboard escape button should not clear query", async ({ +test("closing search via keyboard escape button should clear query", async ({ page }) => { const app = new AppModel(page); await app.goto(); - const searchinput = page.locator(getTestId("search-input")); - const openSearch = page.locator(getTestId("open-search")); + const searchInput = page.locator(getTestId("search-input")); - await openSearch.click(); + await searchInput.focus(); await page.keyboard.type("test"); await page.waitForTimeout(500); await page.keyboard.press("Escape"); - await openSearch.click(); - expect(await searchinput.inputValue()).toBe("test"); + expect(await searchInput.inputValue()).toBe(""); });