Unverified Commit 1cf02b2c authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[test] Skip failing segment-cache deploy test (#90601)

Co-authored-by: 's avatarCursor Agent <cursoragent@cursor.com>
parent 420560d0
...@@ -3,7 +3,7 @@ import { createRouterAct } from 'router-act' ...@@ -3,7 +3,7 @@ import { createRouterAct } from 'router-act'
import { waitFor } from 'next-test-utils' import { waitFor } from 'next-test-utils'
describe('segment cache (basic tests)', () => { describe('segment cache (basic tests)', () => {
const { next, isNextDev } = nextTestSetup({ const { next, isNextDev, isNextDeploy } = nextTestSetup({
files: __dirname, files: __dirname,
}) })
if (isNextDev) { if (isNextDev) {
...@@ -277,71 +277,75 @@ describe('segment cache (basic tests)', () => { ...@@ -277,71 +277,75 @@ describe('segment cache (basic tests)', () => {
expect(await dynamicDiv.innerHTML()).toBe('Dynamic page') expect(await dynamicDiv.innerHTML()).toBe('Dynamic page')
}) })
it('refreshes page segments when navigating to the exact same URL as the current location', async () => { // TODO: Fix same-page navigation refresh behavior in deploy mode
let act: ReturnType<typeof createRouterAct> ;(isNextDeploy ? it.skip : it)(
const browser = await next.browser('/same-page-nav', { 'refreshes page segments when navigating to the exact same URL as the current location',
beforePageLoad(page) { async () => {
act = createRouterAct(page) let act: ReturnType<typeof createRouterAct>
}, const browser = await next.browser('/same-page-nav', {
}) beforePageLoad(page) {
act = createRouterAct(page)
const linkWithNoHash = await browser.elementByCss( },
'a[href="/same-page-nav"]' })
)
const linkWithHashA = await browser.elementByCss( const linkWithNoHash = await browser.elementByCss(
'a[href="/same-page-nav#hash-a"]' 'a[href="/same-page-nav"]'
) )
const linkWithHashB = await browser.elementByCss( const linkWithHashA = await browser.elementByCss(
'a[href="/same-page-nav#hash-b"]' 'a[href="/same-page-nav#hash-a"]'
) )
const linkWithHashB = await browser.elementByCss(
async function readRandomNumberFromPage() { 'a[href="/same-page-nav#hash-b"]'
const randomNumber = await browser.elementById('random-number') )
return await randomNumber.textContent()
} async function readRandomNumberFromPage() {
const randomNumber = await browser.elementById('random-number')
// Navigating to the same URL should refresh the page return await randomNumber.textContent()
const randomNumber = await readRandomNumberFromPage()
await act(async () => {
await linkWithNoHash.click()
}, [
{
includes: 'random-number',
},
{
// Only the page segments should be refreshed, not the layouts.
// TODO: We plan to change this in the future.
block: 'reject',
includes: 'same-page-nav-layout',
},
])
const randomNumber2 = await readRandomNumberFromPage()
expect(randomNumber2).not.toBe(randomNumber)
// Navigating to a different hash should *not* refresh the page
await act(async () => {
await linkWithHashA.click()
}, 'no-requests')
expect(await readRandomNumberFromPage()).toBe(randomNumber2)
// Navigating to the same hash again should refresh the page
await act(
async () => {
await linkWithHashA.click()
},
{
includes: 'random-number',
} }
)
const randomNumber3 = await readRandomNumberFromPage()
expect(randomNumber3).not.toBe(randomNumber2)
// Navigating to a different hash should *not* refresh the page // Navigating to the same URL should refresh the page
await act(async () => { const randomNumber = await readRandomNumberFromPage()
await linkWithHashB.click() await act(async () => {
}, 'no-requests') await linkWithNoHash.click()
expect(await readRandomNumberFromPage()).toBe(randomNumber3) }, [
}) {
includes: 'random-number',
},
{
// Only the page segments should be refreshed, not the layouts.
// TODO: We plan to change this in the future.
block: 'reject',
includes: 'same-page-nav-layout',
},
])
const randomNumber2 = await readRandomNumberFromPage()
expect(randomNumber2).not.toBe(randomNumber)
// Navigating to a different hash should *not* refresh the page
await act(async () => {
await linkWithHashA.click()
}, 'no-requests')
expect(await readRandomNumberFromPage()).toBe(randomNumber2)
// Navigating to the same hash again should refresh the page
await act(
async () => {
await linkWithHashA.click()
},
{
includes: 'random-number',
}
)
const randomNumber3 = await readRandomNumberFromPage()
expect(randomNumber3).not.toBe(randomNumber2)
// Navigating to a different hash should *not* refresh the page
await act(async () => {
await linkWithHashB.click()
}, 'no-requests')
expect(await readRandomNumberFromPage()).toBe(randomNumber3)
}
)
it('does not throw an error when navigating to a page with a server action', async () => { it('does not throw an error when navigating to a page with a server action', async () => {
let act: ReturnType<typeof createRouterAct> let act: ReturnType<typeof createRouterAct>
......
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