Skip to content

Commit

Permalink
Update flakey relay analytics test (#39877)
Browse files Browse the repository at this point in the history
Implements `check` on relay analytics test as the timing can be indeterminate. 

Fixes: https://github.com/vercel/next.js/runs/7979410199?check_suite_focus=true#step:9:230
  • Loading branch information
ijjk committed Aug 23, 2022
1 parent ec25b47 commit 7f5bc71
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/integration/relay-analytics/test/index.test.js
Expand Up @@ -117,9 +117,15 @@ function runTest() {
)
// INP metric is only reported on pagehide or visibilitychange event, so refresh the page
await browser.refresh()
const INP = parseInt(await browser.eval('localStorage.getItem("INP")'), 10)
// We introduced a delay of 100ms, so INP duration should be >= 100
expect(INP).toBeGreaterThanOrEqual(100)
await check(async () => {
const INP = parseInt(
await browser.eval('localStorage.getItem("INP")'),
10
)
// We introduced a delay of 100ms, so INP duration should be >= 100
expect(INP).toBeGreaterThanOrEqual(100)
return 'success'
}, 'success')
await browser.close()
})
}

0 comments on commit 7f5bc71

Please sign in to comment.