@@ -152,23 +152,26 @@ describe('<Link prefetch={true}> (runtime prefetch)', () => {
152
152
} ,
153
153
] )
154
154
155
- // Reveal the link to trigger a runtime prefetch for a different value of the root param
156
- await act ( async ( ) => {
157
- const linkToggle = await browser . elementByCss (
158
- `input[data-link-accordion="/with-root-param/de/${ prefix } /root-params"]`
159
- )
160
- await linkToggle . click ( )
161
- } , [
162
- // Should allow reading root params
163
- {
164
- includes : 'Lang: de' ,
165
- } ,
166
- // Should not prefetch the dynamic content
167
- {
168
- includes : 'Dynamic content' ,
169
- block : 'reject' ,
170
- } ,
171
- ] )
155
+ // TODO(runtime-ppr) - visiting root params that weren't in generateStaticParams errors when deployed
156
+ if ( ! isNextDeploy ) {
157
+ // Reveal the link to trigger a runtime prefetch for a different value of the root param
158
+ await act ( async ( ) => {
159
+ const linkToggle = await browser . elementByCss (
160
+ `input[data-link-accordion="/with-root-param/de/${ prefix } /root-params"]`
161
+ )
162
+ await linkToggle . click ( )
163
+ } , [
164
+ // Should allow reading root params
165
+ {
166
+ includes : 'Lang: de' ,
167
+ } ,
168
+ // Should not prefetch the dynamic content
169
+ {
170
+ includes : 'Dynamic content' ,
171
+ block : 'reject' ,
172
+ } ,
173
+ ] )
174
+ }
172
175
173
176
// Navigate to the first page
174
177
await act ( async ( ) => {
@@ -199,44 +202,47 @@ describe('<Link prefetch={true}> (runtime prefetch)', () => {
199
202
'Dynamic content'
200
203
)
201
204
202
- await browser . back ( )
205
+ // TODO(runtime-ppr) - visiting root params that weren't in generateStaticParams errors when deployed
206
+ if ( ! isNextDeploy ) {
207
+ await browser . back ( )
203
208
204
- // Reveal the link to the second page again. It should not be prefetched again
205
- await act ( async ( ) => {
206
- const linkToggle = await browser . elementByCss (
207
- `input[data-link-accordion="/with-root-param/de/${ prefix } /root-params"]`
208
- )
209
- await linkToggle . click ( )
210
- } , 'no-requests' )
209
+ // Reveal the link to the second page again. It should not be prefetched again
210
+ await act ( async ( ) => {
211
+ const linkToggle = await browser . elementByCss (
212
+ `input[data-link-accordion="/with-root-param/de/${ prefix } /root-params"]`
213
+ )
214
+ await linkToggle . click ( )
215
+ } , 'no-requests' )
211
216
212
- // Navigate to the other page
213
- await act ( async ( ) => {
214
- await act (
215
- async ( ) => {
216
- await browser
217
- . elementByCss (
218
- `a[href="/with-root-param/de/${ prefix } /root-params"]`
219
- )
220
- . click ( )
221
- } ,
222
- {
223
- // Temporarily block the navigation request.
224
- // The runtime-prefetched parts of the tree should be visible before it finishes.
225
- includes : 'Dynamic content' ,
226
- block : true ,
227
- }
228
- )
217
+ // Navigate to the other page
218
+ await act ( async ( ) => {
219
+ await act (
220
+ async ( ) => {
221
+ await browser
222
+ . elementByCss (
223
+ `a[href="/with-root-param/de/${ prefix } /root-params"]`
224
+ )
225
+ . click ( )
226
+ } ,
227
+ {
228
+ // Temporarily block the navigation request.
229
+ // The runtime-prefetched parts of the tree should be visible before it finishes.
230
+ includes : 'Dynamic content' ,
231
+ block : true ,
232
+ }
233
+ )
234
+ expect ( await browser . elementById ( 'root-param-value' ) . text ( ) ) . toEqual (
235
+ 'Lang: de'
236
+ )
237
+ } )
238
+ // After navigating, we should see both the parts that we prefetched and dynamic content.
229
239
expect ( await browser . elementById ( 'root-param-value' ) . text ( ) ) . toEqual (
230
240
'Lang: de'
231
241
)
232
- } )
233
- // After navigating, we should see both the parts that we prefetched and dynamic content.
234
- expect ( await browser . elementById ( 'root-param-value' ) . text ( ) ) . toEqual (
235
- 'Lang: de'
236
- )
237
- expect ( await browser . elementById ( 'dynamic-content' ) . text ( ) ) . toEqual (
238
- 'Dynamic content'
239
- )
242
+ expect ( await browser . elementById ( 'dynamic-content' ) . text ( ) ) . toEqual (
243
+ 'Dynamic content'
244
+ )
245
+ }
240
246
} )
241
247
242
248
it ( 'includes search params, but not dynamic content' , async ( ) => {
0 commit comments