From d1b318dba478416bf6e086b662f190aa9e6f14ae Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Sun, 30 Aug 2026 20:46:59 +0530 Subject: [PATCH] test: wait for the expected search result before asserting Co-Authored-By: Claude Fable 5 --- __tests__/e2e/local-search/local-search.test.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/__tests__/e2e/local-search/local-search.test.ts b/__tests__/e2e/local-search/local-search.test.ts index 463dd87a..3788ff54 100644 --- a/__tests__/e2e/local-search/local-search.test.ts +++ b/__tests__/e2e/local-search/local-search.test.ts @@ -87,12 +87,17 @@ describe('local search', () => { await page.locator('.VPNavBarSearchButton').click() const input = await page.waitForSelector('input#localsearch-input') - await input.type('Frontmatter Title Resolved') + await input.fill('Frontmatter Title Resolved') const searchResults = page.locator('#localsearch-list') await page.waitForFunction(() => { - return document.querySelectorAll('#localsearch-list li[role=option]') - .length + const options = [ + ...document.querySelectorAll('#localsearch-list li[role=option]') + ] + + return options.some((option) => + option.textContent?.includes('Frontmatter Title Resolved') + ) }) expect(