Files
Hendrik LiebauandGitHub 7999f9634e Ensure client reference manifest is traced for global not found page (#74919)
Follow-up fix for #74876. Not all app dir entries have an
`absolutePagePath` in their module build info, e.g. the global not found
page does not have one. But we still need to include the client
reference manifest in the trace for those entries.


[x-ref](https://vercel.com/vtest314-next-e2e-tests/vtest314-e2e-tests/EngjzrvvzQ4GQra6tnGCy98PR6yd/logs?startDate=1736936280&endDate=1736938140&selectedLogId=fl27k-1736937944551-421fa6816369)
2025-01-15 12:50:46 +01:00

43 lines
1.4 KiB
TypeScript

import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'
describe('prefetching-not-found', () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should correctly navigate to/from a global 404 page when following links with prefetch=auto', async () => {
let browser = await next.browser('/')
expect(await browser.elementByCss('h1').text()).toBe('Home Page')
await browser.elementByCss("[href='/fake-link']").click()
await retry(async () => {
expect(await browser.elementByCss('body').text()).toContain(
'This page could not be found.'
)
})
await browser.elementByCss("[href='/']").click()
await retry(async () => {
expect(await browser.elementByCss('h1').text()).toBe('Home Page')
})
// Assert the same behavior, but starting at the not found page. This is to
// ensure that when we seed the prefetch cache, we don't have any cache
// collisions that would cause the not-found page to remain rendered when
// following a link to the home page.
browser = await next.browser('/fake-link')
expect(await browser.elementByCss('body').text()).toContain(
'This page could not be found.'
)
await browser.elementByCss("[href='/']").click()
await retry(async () => {
expect(await browser.elementByCss('h1').text()).toBe('Home Page')
})
})
})