test: wait for the expected search result before asserting

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pull/5412/head
Divyansh Singh 2 weeks ago
parent 02d1763be5
commit d1b318dba4

@ -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(

Loading…
Cancel
Save