Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Tweak flakey metadata error tests #66060

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'

describe('css-client-side-nav-parallel-routes', () => {
const { next } = nextTestSetup({
Expand All @@ -9,11 +10,15 @@ describe('css-client-side-nav-parallel-routes', () => {
it('should apply styles after navigation', async () => {
const browser = await next.browser('/source')
await browser.elementByCss('a').click()
expect(
await browser.elementByCss('#global').getComputedCss('background-color')
).toBe('rgb(0, 255, 0)')
expect(
await browser.elementByCss('#module').getComputedCss('background-color')
).toBe('rgb(0, 255, 0)')

// transition might not be instant so we wrap in retry
retry(async () => {
expect(
await browser.elementByCss('#global').getComputedCss('background-color')
).toBe('rgb(0, 255, 0)')
expect(
await browser.elementByCss('#module').getComputedCss('background-color')
).toBe('rgb(0, 255, 0)')
})
})
})
14 changes: 4 additions & 10 deletions test/e2e/app-dir/metadata-dynamic-routes/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,17 +463,14 @@ describe('app dir - metadata dynamic routes', () => {
}
`

const outputBeforeFetch = next.cliOutput + ''
const originalOutputIndex = next.cliOutput.length

await next.patchFile(iconFilePath, contentMissingIdProperty)
await next.fetch('/metadata-base/unset/icon/100')

const outputAfterFetch = next.cliOutput + ''
const output = outputAfterFetch.replace(outputBeforeFetch, '')

try {
await check(async () => {
expect(output).toContain(
expect(next.cliOutput.substring(originalOutputIndex)).toContain(
`id property is required for every item returned from generateImageMetadata`
)
return 'success'
Expand Down Expand Up @@ -504,17 +501,14 @@ describe('app dir - metadata dynamic routes', () => {
]
}`

const outputBeforeFetch = next.cliOutput + ''
const originalOutputIndex = next.cliOutput.length

await next.patchFile(sitemapFilePath, contentMissingIdProperty)
await next.fetch('/metadata-base/unset/sitemap/0')

const outputAfterFetch = next.cliOutput + ''
const output = outputAfterFetch.replace(outputBeforeFetch, '')

try {
await check(async () => {
expect(output).toContain(
expect(next.cliOutput.substring(originalOutputIndex)).toContain(
`id property is required for every item returned from generateSitemaps`
)
return 'success'
Expand Down
Loading