Skip to content

Commit

Permalink
de-flake test
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed May 20, 2024
1 parent 66ecd71 commit 13b0861
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'

describe('prefetch-searchparam', () => {
const { next } = nextTestSetup({
Expand All @@ -11,12 +12,14 @@ describe('prefetch-searchparam', () => {

// navigate to different search param, should update the search param
await browser.elementByCss('[href="/?q=bar"]').click()
await browser.waitForElementByCss('p', 5000)
expect(await browser.elementByCss('p').text()).toBe('{"q":"bar"}')
await retry(async () => {
expect(await browser.elementByCss('p').text()).toBe('{"q":"bar"}')
})

// navigate to home, should clear the searchParams value
await browser.elementByCss('[href="/"]').click()
await browser.waitForElementByCss('p', 5000)
expect(await browser.elementByCss('p').text()).toBe('{}')
await retry(async () => {
expect(await browser.elementByCss('p').text()).toBe('{}')
})
})
})

0 comments on commit 13b0861

Please sign in to comment.