Skip to content

Commit 74616f9

Browse files
committed
de-flake test
1 parent 66ecd71 commit 74616f9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/e2e/app-dir/prefetch-searchparam/prefetch-searchparam.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { nextTestSetup } from 'e2e-utils'
2+
import { retry } from '../../../lib/next-test-utils'
23

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

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

1719
// navigate to home, should clear the searchParams value
1820
await browser.elementByCss('[href="/"]').click()
19-
await browser.waitForElementByCss('p', 5000)
20-
expect(await browser.elementByCss('p').text()).toBe('{}')
21+
await retry(async () => {
22+
expect(await browser.elementByCss('p').text()).toBe('{}')
23+
})
2124
})
2225
})

0 commit comments

Comments
 (0)