1
1
import { nextTestSetup } from 'e2e-utils'
2
2
3
+ const isPPR = process . env . __NEXT_EXPERIMENTAL_PPR === 'true'
4
+
3
5
describe ( 'parallel-routes-and-interception' , ( ) => {
4
6
const { next, skipped } = nextTestSetup ( {
5
7
files : __dirname ,
@@ -22,7 +24,28 @@ describe('parallel-routes-and-interception', () => {
22
24
// we also check that the #children-slot id is not present
23
25
expect ( await browser . hasElementByCssSelector ( '#children-slot' ) ) . toBe ( false )
24
26
25
- const $ = await next . render$ ( '/' )
26
- expect ( $ ( 'title' ) . text ( ) ) . toBe ( 'layout title' )
27
+ if ( isPPR ) {
28
+ let $ = await next . render$ ( '/' )
29
+ expect ( $ ( 'title' ) . text ( ) ) . toBe ( '' )
30
+
31
+ // FIXME: (metadata) we're rendering a fallback `__next_error__` page in PPR
32
+ // when not found of missing slot error is thrown
33
+ $ = await next . render$ ( '/' , {
34
+ headers : {
35
+ 'User-Agent' : 'Discordbot' ,
36
+ } ,
37
+ } )
38
+ } else {
39
+ const $ = await next . render$ ( '/' )
40
+ expect ( $ ( 'title' ) . text ( ) ) . toBe ( 'layout title' )
41
+ }
42
+ } )
43
+
44
+ it ( 'should render the title once for the non-existed route' , async ( ) => {
45
+ const browser = await next . browser ( '/non-existed' )
46
+ const titles = await browser . elementsByCss ( 'title' )
47
+
48
+ // FIXME: (metadata), the title should only be rendered once and using the not-found title
49
+ expect ( titles ) . toHaveLength ( 3 )
27
50
} )
28
51
} )
0 commit comments