Commit 63e373bf authored by Janka Uryga's avatar Janka Uryga

test: partially disable root params tests when deployed

parent f05f9eff
...@@ -152,23 +152,26 @@ describe('<Link prefetch={true}> (runtime prefetch)', () => { ...@@ -152,23 +152,26 @@ describe('<Link prefetch={true}> (runtime prefetch)', () => {
}, },
]) ])
// Reveal the link to trigger a runtime prefetch for a different value of the root param // TODO(runtime-ppr) - visiting root params that weren't in generateStaticParams errors when deployed
await act(async () => { if (!isNextDeploy) {
const linkToggle = await browser.elementByCss( // Reveal the link to trigger a runtime prefetch for a different value of the root param
`input[data-link-accordion="/with-root-param/de/${prefix}/root-params"]` await act(async () => {
) const linkToggle = await browser.elementByCss(
await linkToggle.click() `input[data-link-accordion="/with-root-param/de/${prefix}/root-params"]`
}, [ )
// Should allow reading root params await linkToggle.click()
{ }, [
includes: 'Lang: de', // Should allow reading root params
}, {
// Should not prefetch the dynamic content includes: 'Lang: de',
{ },
includes: 'Dynamic content', // Should not prefetch the dynamic content
block: 'reject', {
}, includes: 'Dynamic content',
]) block: 'reject',
},
])
}
// Navigate to the first page // Navigate to the first page
await act(async () => { await act(async () => {
...@@ -199,44 +202,47 @@ describe('<Link prefetch={true}> (runtime prefetch)', () => { ...@@ -199,44 +202,47 @@ describe('<Link prefetch={true}> (runtime prefetch)', () => {
'Dynamic content' 'Dynamic content'
) )
await browser.back() // TODO(runtime-ppr) - visiting root params that weren't in generateStaticParams errors when deployed
if (!isNextDeploy) {
await browser.back()
// Reveal the link to the second page again. It should not be prefetched again // Reveal the link to the second page again. It should not be prefetched again
await act(async () => { await act(async () => {
const linkToggle = await browser.elementByCss( const linkToggle = await browser.elementByCss(
`input[data-link-accordion="/with-root-param/de/${prefix}/root-params"]` `input[data-link-accordion="/with-root-param/de/${prefix}/root-params"]`
) )
await linkToggle.click() await linkToggle.click()
}, 'no-requests') }, 'no-requests')
// Navigate to the other page // Navigate to the other page
await act(async () => { await act(async () => {
await act( await act(
async () => { async () => {
await browser await browser
.elementByCss( .elementByCss(
`a[href="/with-root-param/de/${prefix}/root-params"]` `a[href="/with-root-param/de/${prefix}/root-params"]`
) )
.click() .click()
}, },
{ {
// Temporarily block the navigation request. // Temporarily block the navigation request.
// The runtime-prefetched parts of the tree should be visible before it finishes. // The runtime-prefetched parts of the tree should be visible before it finishes.
includes: 'Dynamic content', includes: 'Dynamic content',
block: true, block: true,
} }
) )
expect(await browser.elementById('root-param-value').text()).toEqual(
'Lang: de'
)
})
// After navigating, we should see both the parts that we prefetched and dynamic content.
expect(await browser.elementById('root-param-value').text()).toEqual( expect(await browser.elementById('root-param-value').text()).toEqual(
'Lang: de' 'Lang: de'
) )
}) expect(await browser.elementById('dynamic-content').text()).toEqual(
// After navigating, we should see both the parts that we prefetched and dynamic content. 'Dynamic content'
expect(await browser.elementById('root-param-value').text()).toEqual( )
'Lang: de' }
)
expect(await browser.elementById('dynamic-content').text()).toEqual(
'Dynamic content'
)
}) })
it('includes search params, but not dynamic content', async () => { it('includes search params, but not dynamic content', async () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment