Files
next.js/test/development/app-dir/basic/basic.test.ts
T
Sebastian SilbermannandGitHub fe8d953e2d Replace hasRedbox() (#67025)
...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)
2024-06-20 10:37:32 +02:00

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()
})
})