mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
...with `assertHasRedbox` and `assertNoRedbox`. `hasRedbox()` has a hardcoded timeout of 5s that is only required for the negative assertion. Instead, we now have dedicated assertions for the positive (`assertHasRedbox`) and negative case (`assertNoRedbox`). The negative assertion still has the hardcoded timeout. But the positive assertion just retries until we find the Redbox. This speeds up tests using the positive assertion. Removing `hasRedbox` also uncovered some unused expressions e.g. `await hasRedbox(browser)`. These expressions probably wanted to use `expect(await hasRedbox(browser)).toBe(true)
27 lines
699 B
TypeScript
27 lines
699 B
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import { describeVariants as describe, waitFor } from 'next-test-utils'
|
|
import { sandbox, waitForHydration } from 'development-sandbox'
|
|
|
|
describe.each(['default', 'turbo'])('basic app-dir tests', () => {
|
|
const { next } = nextTestSetup({
|
|
files: __dirname,
|
|
})
|
|
|
|
it('should reload app pages without error', async () => {
|
|
const { session, cleanup, browser } = await sandbox(next, undefined, '/')
|
|
await session.assertNoRedbox()
|
|
|
|
browser.refresh()
|
|
|
|
await waitFor(750)
|
|
await waitForHydration(browser)
|
|
|
|
for (let i = 0; i < 15; i++) {
|
|
await session.assertNoRedbox()
|
|
await waitFor(1000)
|
|
}
|
|
|
|
await cleanup()
|
|
})
|
|
})
|