Skip to content

Commit 63e373b

Browse files
committed
test: partially disable root params tests when deployed
1 parent f05f9ef commit 63e373b

File tree

1 file changed

+56
-50
lines changed

1 file changed

+56
-50
lines changed

test/e2e/app-dir/segment-cache/prefetch-runtime/prefetch-runtime.test.ts

Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -152,23 +152,26 @@ describe('<Link prefetch={true}> (runtime prefetch)', () => {
152152
},
153153
])
154154

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+
}
172175

173176
// Navigate to the first page
174177
await act(async () => {
@@ -199,44 +202,47 @@ describe('<Link prefetch={true}> (runtime prefetch)', () => {
199202
'Dynamic content'
200203
)
201204

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()
203208

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')
211216

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.
229239
expect(await browser.elementById('root-param-value').text()).toEqual(
230240
'Lang: de'
231241
)
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+
}
240246
})
241247

242248
it('includes search params, but not dynamic content', async () => {

0 commit comments

Comments
 (0)