Skip to content

Commit

Permalink
Rename waitForAndOpenRuntimeError to openRedbox
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Nov 20, 2024
1 parent 065f250 commit bb26a44
Show file tree
Hide file tree
Showing 15 changed files with 78 additions and 93 deletions.
12 changes: 6 additions & 6 deletions test/development/acceptance-app/ReactRefreshLogBox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
)
await session.evaluate(() => document.querySelector('a').click())

await session.waitForAndOpenRuntimeError()
await session.openRedbox()
expect(await session.getRedboxSource()).toMatchSnapshot()
})

Expand Down Expand Up @@ -149,7 +149,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`export default function FunctionDefault() { throw new Error('no'); }`
)

await session.waitForAndOpenRuntimeError()
await session.openRedbox()
expect(await session.getRedboxSource()).toMatchSnapshot()
expect(
await session.evaluate(() => document.querySelector('h2').textContent)
Expand Down Expand Up @@ -390,7 +390,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
)

await session.evaluate(() => document.querySelector('button').click())
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

const header = await session.getRedboxDescription()
expect(header).toMatchSnapshot()
Expand Down Expand Up @@ -435,7 +435,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
)

await session.evaluate(() => document.querySelector('button').click())
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

const header2 = await session.getRedboxDescription()
expect(header2).toMatchSnapshot()
Expand Down Expand Up @@ -480,7 +480,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
)

await session.evaluate(() => document.querySelector('button').click())
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

const header3 = await session.getRedboxDescription()
expect(header3).toMatchSnapshot()
Expand Down Expand Up @@ -525,7 +525,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
)

await session.evaluate(() => document.querySelector('button').click())
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

const header4 = await session.getRedboxDescription()
expect(header4).toEqual(
Expand Down
2 changes: 1 addition & 1 deletion test/development/acceptance-app/error-message-url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('Error overlay - error message urls', () => {
])
)
const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

const link = await browser.elementByCss('#nextjs__container_errors__link a')
const text = await link.text()
Expand Down
4 changes: 2 additions & 2 deletions test/development/acceptance-app/error-recovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe.each(['default', 'turbo'])('Error recovery app %s', () => {
await session.evaluate(() => document.querySelector('p').textContent)
).toBe('1')

await session.waitForAndOpenRuntimeError()
await session.openRedbox()

expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"index.js (7:11) @ Index.useCallback[increment]
Expand Down Expand Up @@ -282,7 +282,7 @@ describe.each(['default', 'turbo'])('Error recovery app %s', () => {
)

await new Promise((resolve) => setTimeout(resolve, 1000))
await session.waitForAndOpenRuntimeError()
await session.openRedbox()
expect(await session.getRedboxSource()).not.toInclude(
"Expected '}', got '<eof>'"
)
Expand Down
30 changes: 15 additions & 15 deletions test/development/acceptance-app/hydration-error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('Error overlay for hydration errors in App router', () => {
])
)
const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()
expect(await getRedboxTotalErrorCount(browser)).toBe(1)
Expand Down Expand Up @@ -153,7 +153,7 @@ describe('Error overlay for hydration errors in App router', () => {
])
)
const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()
expect(await getRedboxTotalErrorCount(browser)).toBe(1)
Expand Down Expand Up @@ -203,7 +203,7 @@ describe('Error overlay for hydration errors in App router', () => {
])
)
const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()
expect(await getRedboxTotalErrorCount(browser)).toBe(1)
Expand Down Expand Up @@ -239,7 +239,7 @@ describe('Error overlay for hydration errors in App router', () => {
])
)
const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()
expect(await getRedboxTotalErrorCount(browser)).toBe(1)
Expand Down Expand Up @@ -288,7 +288,7 @@ describe('Error overlay for hydration errors in App router', () => {
])
)
const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()
expect(await getRedboxTotalErrorCount(browser)).toBe(1)
Expand Down Expand Up @@ -330,7 +330,7 @@ describe('Error overlay for hydration errors in App router', () => {
])
)
const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()
expect(await getRedboxTotalErrorCount(browser)).toBe(1)
Expand Down Expand Up @@ -378,7 +378,7 @@ describe('Error overlay for hydration errors in App router', () => {
])
)
const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()
expect(await getRedboxTotalErrorCount(browser)).toBe(2)
Expand Down Expand Up @@ -427,7 +427,7 @@ describe('Error overlay for hydration errors in App router', () => {
])
)
const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()
await retry(async () => {
Expand Down Expand Up @@ -489,7 +489,7 @@ describe('Error overlay for hydration errors in App router', () => {
])
)
const { session } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

const pseudoHtml = await session.getRedboxComponentStack()
if (isTurbopack) {
Expand Down Expand Up @@ -574,7 +574,7 @@ describe('Error overlay for hydration errors in App router', () => {
)

const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()
expect(await getRedboxTotalErrorCount(browser)).toBe(2)
Expand Down Expand Up @@ -633,7 +633,7 @@ describe('Error overlay for hydration errors in App router', () => {
)

const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()
expect(await getRedboxTotalErrorCount(browser)).toBe(2)
Expand Down Expand Up @@ -672,7 +672,7 @@ describe('Error overlay for hydration errors in App router', () => {
)

const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()
expect(await getRedboxTotalErrorCount(browser)).toBe(2)
Expand Down Expand Up @@ -726,7 +726,7 @@ describe('Error overlay for hydration errors in App router', () => {
)

const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()
expect(await getRedboxTotalErrorCount(browser)).toBe(2)
Expand Down Expand Up @@ -798,7 +798,7 @@ describe('Error overlay for hydration errors in App router', () => {
])
)
const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()

Expand Down Expand Up @@ -870,7 +870,7 @@ describe('Error overlay for hydration errors in App router', () => {
])
)
const { session, browser } = sandbox
await session.waitForAndOpenRuntimeError()
await session.openRedbox()

await session.assertHasRedbox()
expect(await getRedboxTotalErrorCount(browser)).toBe(1)
Expand Down
2 changes: 1 addition & 1 deletion test/development/acceptance-app/version-staleness.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Error Overlay version staleness', () => {
`
)

await session.waitForAndOpenRuntimeError()
await session.openRedbox()

if (process.env.TURBOPACK) {
expect(await getStaleness(browser)).toMatchInlineSnapshot(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
getRedboxTitle,
getRedboxSource,
getRedboxTotalErrorCount,
waitForAndOpenRuntimeError,
openRedbox,
} from 'next-test-utils'

async function getRedboxResult(browser: any) {
Expand All @@ -33,7 +33,7 @@ describe('app-dir - capture-console-error-owner-stack', () => {
const browser = await next.browser('/browser/event')
await browser.elementByCss('button').click()

await waitForAndOpenRuntimeError(browser)
await openRedbox(browser)
await assertHasRedbox(browser)

const result = await getRedboxResult(browser)
Expand Down Expand Up @@ -82,8 +82,7 @@ describe('app-dir - capture-console-error-owner-stack', () => {
it('should capture browser console error in render and dedupe if necessary', async () => {
const browser = await next.browser('/browser/render')

await waitForAndOpenRuntimeError(browser)
await assertHasRedbox(browser)
await openRedbox(browser)

const result = await getRedboxResult(browser)

Expand Down Expand Up @@ -129,8 +128,7 @@ describe('app-dir - capture-console-error-owner-stack', () => {
it('should capture browser console error in render and dedupe when multi same errors logged', async () => {
const browser = await next.browser('/browser/render')

await waitForAndOpenRuntimeError(browser)
await assertHasRedbox(browser)
await openRedbox(browser)

const result = await getRedboxResult(browser)

Expand Down Expand Up @@ -176,8 +174,7 @@ describe('app-dir - capture-console-error-owner-stack', () => {
it('should capture server replay string error from console error', async () => {
const browser = await next.browser('/ssr')

await waitForAndOpenRuntimeError(browser)
await assertHasRedbox(browser)
await openRedbox(browser)

const result = await getRedboxResult(browser)

Expand Down Expand Up @@ -223,8 +220,7 @@ describe('app-dir - capture-console-error-owner-stack', () => {
it('should capture server replay error instance from console error', async () => {
const browser = await next.browser('/ssr-error-instance')

await waitForAndOpenRuntimeError(browser)
await assertHasRedbox(browser)
await openRedbox(browser)

const result = await getRedboxResult(browser)

Expand Down Expand Up @@ -270,8 +266,7 @@ describe('app-dir - capture-console-error-owner-stack', () => {
it('should be able to capture rsc logged error', async () => {
const browser = await next.browser('/rsc')

await waitForAndOpenRuntimeError(browser)
await assertHasRedbox(browser)
await openRedbox(browser)

const result = await getRedboxResult(browser)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { nextTestSetup } from 'e2e-utils'
import {
assertHasRedbox,
getRedboxCallStack,
getRedboxDescription,
getRedboxTitle,
getRedboxSource,
getRedboxTotalErrorCount,
waitForAndOpenRuntimeError,
openRedbox,
} from 'next-test-utils'

async function getRedboxResult(browser: any) {
Expand Down Expand Up @@ -41,8 +40,7 @@ describe('app-dir - capture-console-error', () => {
const browser = await next.browser('/browser/event')
await browser.elementByCss('button').click()

await waitForAndOpenRuntimeError(browser)
await assertHasRedbox(browser)
await openRedbox(browser)

const result = await getRedboxResult(browser)

Expand Down Expand Up @@ -88,8 +86,7 @@ describe('app-dir - capture-console-error', () => {
it('should capture browser console error in render and dedupe if necessary', async () => {
const browser = await next.browser('/browser/render')

await waitForAndOpenRuntimeError(browser)
await assertHasRedbox(browser)
await openRedbox(browser)

const result = await getRedboxResult(browser)

Expand Down Expand Up @@ -135,8 +132,7 @@ describe('app-dir - capture-console-error', () => {
it('should capture browser console error in render and dedupe when multi same errors logged', async () => {
const browser = await next.browser('/browser/render')

await waitForAndOpenRuntimeError(browser)
await assertHasRedbox(browser)
await openRedbox(browser)

const result = await getRedboxResult(browser)

Expand Down Expand Up @@ -182,8 +178,7 @@ describe('app-dir - capture-console-error', () => {
it('should capture server replay string error from console error', async () => {
const browser = await next.browser('/ssr')

await waitForAndOpenRuntimeError(browser)
await assertHasRedbox(browser)
await openRedbox(browser)

const result = await getRedboxResult(browser)

Expand Down Expand Up @@ -229,8 +224,7 @@ describe('app-dir - capture-console-error', () => {
it('should capture server replay error instance from console error', async () => {
const browser = await next.browser('/ssr-error-instance')

await waitForAndOpenRuntimeError(browser)
await assertHasRedbox(browser)
await openRedbox(browser)

const result = await getRedboxResult(browser)

Expand Down Expand Up @@ -276,8 +270,7 @@ describe('app-dir - capture-console-error', () => {
it('should be able to capture rsc logged error', async () => {
const browser = await next.browser('/rsc')

await waitForAndOpenRuntimeError(browser)
await assertHasRedbox(browser)
await openRedbox(browser)

const result = await getRedboxResult(browser)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { nextTestSetup } from 'e2e-utils'
import {
getRedboxDescription,
waitForAndOpenRuntimeError,
openRedbox,
assertNoRedbox,
retry,
} from 'next-test-utils'
Expand Down Expand Up @@ -72,15 +72,15 @@ describe('Dynamic IO Dev Errors', () => {
let desc

const browser = await next.browser('/uncached')
await waitForAndOpenRuntimeError(browser)
await openRedbox(browser)
desc = await getRedboxDescription(browser)

expect(desc).toContain(
'Route "/uncached": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it'
)

await browser.refresh()
await waitForAndOpenRuntimeError(browser)
await openRedbox(browser)
desc = await getRedboxDescription(browser)

expect(desc).toContain(
Expand Down
Loading

0 comments on commit bb26a44

Please sign in to comment.