-
Notifications
You must be signed in to change notification settings - Fork 28.2k
/
Copy pathparallel-routes-not-found.test.ts
50 lines (41 loc) · 1.55 KB
/
parallel-routes-not-found.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { nextTestSetup } from 'e2e-utils'
const isPPR = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
describe('parallel-routes-and-interception', () => {
const { next, isNextDev, skipped } = nextTestSetup({
files: __dirname,
// TODO: remove after deployment handling is updated
skipDeployment: true,
})
if (skipped) {
return
}
// TODO: revisit the error for missing parallel routes slot
it('should not render the @children slot when the @slot is not found', async () => {
const browser = await next.browser('/')
// we make sure the page is available through navigating
expect(await browser.elementByCss('body').text()).toMatch(
/This page could not be found/
)
// we also check that the #children-slot id is not present
expect(await browser.hasElementByCssSelector('#children-slot')).toBe(false)
if (isPPR && !isNextDev) {
let $ = await next.render$('/')
expect($('title').text()).toBe('')
$ = await next.render$('/', null, {
headers: {
'User-Agent': 'Discordbot',
},
})
expect($('title').text()).toBe('layout title')
} else {
const $ = await next.render$('/')
expect($('title').text()).toBe('layout title')
}
})
it('should render the title once for the non-existed route', async () => {
const browser = await next.browser('/non-existed')
const titles = await browser.elementsByCss('title')
// FIXME: (metadata), the title should only be rendered once and using the not-found title
expect(titles).toHaveLength(3)
})
})