File size: 904 Bytes
b91e262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { nextTestSetup } from 'e2e-utils'
import { retry, waitFor } from 'next-test-utils'

describe('duplicate-runtime-error', () => {
  const { next } = nextTestSetup({
    files: __dirname,
  })

  it('should not rerender the overlay for the same runtime error', async () => {
    const browser = await next.browser('/')
    const badge = await browser.elementByCss('[data-next-badge]')

    // Wait until the badge is showing "errored"
    await retry(async () => {
      const errorProp = await badge.getAttribute('data-error')

      expect(errorProp).toBe('true')
    })

    // Still present the same value after a while without re-rendersw.
    // Should always display the badge, should not re-render by hiding it again
    for (let i = 0; i < 40; i++) {
      const errorProp = await badge.getAttribute('data-error')

      expect(errorProp).toBe('true')
      await waitFor(50)
    }
  })
})