Skip to content

Commit

Permalink
Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannes Bornö committed Dec 9, 2022
1 parent 5f27b9d commit e8f8a99
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions test/development/acceptance-app/ReactRefreshLogBox.test.ts
Expand Up @@ -1153,4 +1153,52 @@ describe('ReactRefreshLogBox app', () => {

await cleanup()
})

test('Server component errors should open up in fullscreen', async () => {
const { session, browser, cleanup } = await sandbox(
next,
new Map([
// Start with error
[
'app/page.js',
`
export default function Page() {
throw new Error('Server component error')
return <p id="text">Hello world</p>
}
`,
],
])
)
expect(await session.hasRedbox(true)).toBe(true)

// Remove error
await next.patchFile(
'app/page.js',
`
export default function Page() {
return <p id="text">Hello world</p>
}
`
)
expect(await browser.waitForElementByCss('#text').text()).toBe(
'Hello world'
)
expect(await session.hasRedbox()).toBe(false)

// Re-add error
await next.patchFile(
'app/page.js',
`
export default function Page() {
throw new Error('Server component error!')
return <p id="text">Hello world</p>
}
`
)

expect(await session.hasRedbox(true)).toBe(true)

await cleanup()
})
})

0 comments on commit e8f8a99

Please sign in to comment.