Unverified Commit 370f9c2c authored by vercel-fleet-prod[bot]'s avatar vercel-fleet-prod[bot] Committed by GitHub

test: wait for head to settle in metadata intercepting route test

Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
parent 43cb38c7
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'
import { import {
getCommonMetadataHeadTags, getCommonMetadataHeadTags,
readFixtureBuffer, readFixtureBuffer,
...@@ -45,6 +46,17 @@ describe('metadata-files-static-output-intercepting-route', () => { ...@@ -45,6 +46,17 @@ describe('metadata-files-static-output-intercepting-route', () => {
'window.location.pathname === "/intercept-me"' 'window.location.pathname === "/intercept-me"'
) )
// The URL is committed as soon as the intercepted page segment can render,
// but if the click lands while the segment prefetch is still in flight the
// head arrives later with the dynamic navigation response. Poll until the
// head has settled instead of asserting on the in-between state.
// Snapshot mismatches don't throw, so poll with plain matchers first.
await retry(async () => {
const { links, metas } = await getCommonMetadataHeadTags(browser)
expect(links).toHaveLength(4)
expect(metas).toHaveLength(10)
})
expect(await getCommonMetadataHeadTags(browser)).toMatchInlineSnapshot(` expect(await getCommonMetadataHeadTags(browser)).toMatchInlineSnapshot(`
{ {
"links": [ "links": [
......
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