Skip to content

Commit

Permalink
Example of using the waitForLoadState function and counts of results
Browse files Browse the repository at this point in the history
  • Loading branch information
dakota002 committed Jul 8, 2024
1 parent 06a9dfd commit e069102
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions __playwright__/circulars/archive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,18 @@ test.describe('Circulars archive page', () => {
page,
}) => {
await page.goto('/circulars?query=230812B')
await page.waitForFunction(
(n) =>
document.getElementsByTagName('ol')[0].getElementsByTagName('li')
.length >= n,
64
)
await page.waitForLoadState()
await expect(page.locator('ol', { has: page.locator('li') })).toBeVisible()
expect(await page.locator('ol > li').count()).toBe(64)
})

test('search finds no results for query with typo', async ({ page }) => {
// this highlights this search behaviour does not capture cases where there is a minor typo
await page.goto('/circulars?query=230812C')
await page.waitForFunction(
(n) =>
document.getElementsByTagName('ol')[0].getElementsByTagName('li')
.length === n,
0
)
await page.waitForLoadState()
await expect(
page.locator('ol', { has: page.locator('li') })
).not.toBeVisible()
})

test('search finds results that contain exact string but not similar strings', async ({
Expand Down

0 comments on commit e069102

Please sign in to comment.