From 4b1fa45c3a11342412e5c92d195d0b1511b8db68 Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Tue, 5 Aug 2025 10:19:40 -0700 Subject: [PATCH] fix: Async issues with UI validation workflow --- tests/search.spec.ts | 2 +- tests/utils/commonUtils.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/search.spec.ts b/tests/search.spec.ts index c0b60f150..4640f46a9 100644 --- a/tests/search.spec.ts +++ b/tests/search.spec.ts @@ -4,7 +4,7 @@ import { handleConsentPopup, waitFor } from '../tests/utils/commonUtils.ts' test.describe("Testing search page", () => { test('Searchbar is visible', async ({ page }) => { await page.goto('/'); - await waitFor(() => handleConsentPopup(page)); + await waitFor(async () => await handleConsentPopup(page)); const searchBox = page.locator('.CoveoSearchbox').first(); const searchButton = page.locator('.CoveoSearchButton'); diff --git a/tests/utils/commonUtils.ts b/tests/utils/commonUtils.ts index 31585a9db..4a20e87b7 100644 --- a/tests/utils/commonUtils.ts +++ b/tests/utils/commonUtils.ts @@ -6,8 +6,7 @@ export async function handleConsentPopup(page: Page) { const consentContent = page.locator('#truste-consent-content'); const isConsentContentVisibile = await consentContent.isVisible(); if(isConsentContentVisibile) { - const consentButton = page.locator('#truste-consent-required').first(); - console.log((await consentButton.all()).length); + const consentButton = page.locator('#truste-consent-required'); expect(consentButton).toBeVisible(); await consentButton.click(); }