Skip to content

Commit 7f8ba2d

Browse files
authored
Fix flake in rewrites-manual-href-as test (vercel#92948)
CI is failing on a modal not showing up after navigation. It looks like a timing bug. This adds retry to wait for the UI to show up
1 parent 1931877 commit 7f8ba2d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

test/integration/rewrites-manual-href-as/test/index.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
launchApp,
99
nextBuild,
1010
nextStart,
11+
retry,
1112
} from 'next-test-utils'
1213
import webdriver from 'next-webdriver'
1314

@@ -26,8 +27,10 @@ const runTests = () => {
2627

2728
await browser.elementByCss('#to-modal').click()
2829

30+
await retry(async () => {
31+
expect(await browser.hasElementByCssSelector('#modal')).toBeTruthy()
32+
})
2933
expect(await browser.elementByCss('#index').text()).toBe('index page')
30-
expect(await browser.hasElementByCssSelector('#modal')).toBeTruthy()
3134
expect(await browser.eval('window.beforeNav')).toBe(1)
3235
expect(JSON.parse(await browser.elementByCss('#query').text())).toEqual({
3336
imageId: '123',
@@ -86,8 +89,10 @@ const runTests = () => {
8689
.click()
8790
.waitForElementByCss('#index')
8891

92+
await retry(async () => {
93+
expect(await browser.hasElementByCssSelector('#modal')).toBeTruthy()
94+
})
8995
expect(await browser.elementByCss('#index').text()).toBe('index page')
90-
expect(await browser.hasElementByCssSelector('#modal')).toBeTruthy()
9196
expect(await browser.eval('window.beforeNav')).toBe(1)
9297
expect(JSON.parse(await browser.elementByCss('#query').text())).toEqual({
9398
imageId: '123',

0 commit comments

Comments
 (0)