mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
The rest of this test is valid for a deployed environment, we just won't have access to runtime logs.
77 lines
2.0 KiB
TypeScript
77 lines
2.0 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import { check } from 'next-test-utils'
|
|
|
|
describe('parallel-route-not-found', () => {
|
|
const { next, isNextDeploy } = nextTestSetup({
|
|
files: __dirname,
|
|
})
|
|
|
|
it('should behave correctly without any errors', async () => {
|
|
const browser = await next.browser('/en')
|
|
|
|
// Deploy doesn't have access to runtime logs
|
|
if (!isNextDeploy) {
|
|
await check(() => {
|
|
if (
|
|
next.cliOutput.includes('TypeError') ||
|
|
next.cliOutput.includes('Warning')
|
|
) {
|
|
return 'has-errors'
|
|
}
|
|
|
|
return 'success'
|
|
}, 'success')
|
|
}
|
|
|
|
expect(await browser.elementByCss('body').text()).not.toContain(
|
|
'Interception Modal'
|
|
)
|
|
expect(await browser.elementByCss('body').text()).toContain('Locale: en')
|
|
|
|
await browser.elementByCss("[href='/en/show']").click()
|
|
|
|
// Deploy doesn't have access to runtime logs
|
|
if (!isNextDeploy) {
|
|
await check(() => {
|
|
if (
|
|
next.cliOutput.includes('TypeError') ||
|
|
next.cliOutput.includes('Warning')
|
|
) {
|
|
return 'has-errors'
|
|
}
|
|
|
|
return 'success'
|
|
}, 'success')
|
|
}
|
|
|
|
await check(() => browser.elementByCss('body').text(), /Interception Modal/)
|
|
await check(() => browser.elementByCss('body').text(), /Locale: en/)
|
|
|
|
await browser.refresh()
|
|
await check(() => browser.elementByCss('body').text(), /Regular Modal Page/)
|
|
await check(() => browser.elementByCss('body').text(), /Locale: en/)
|
|
})
|
|
|
|
it('should handle the not found case correctly without any errors', async () => {
|
|
const browser = await next.browser('/de/show')
|
|
|
|
// Deploy doesn't have access to runtime logs
|
|
if (!isNextDeploy) {
|
|
await check(() => {
|
|
if (
|
|
next.cliOutput.includes('TypeError') ||
|
|
next.cliOutput.includes('Warning')
|
|
) {
|
|
return 'has-errors'
|
|
}
|
|
|
|
return 'success'
|
|
}, 'success')
|
|
}
|
|
|
|
expect(await browser.elementByCss('body').text()).toContain(
|
|
'Custom Not Found'
|
|
)
|
|
})
|
|
})
|