Skip to content

Commit 68a8411

Browse files
authored
test: fix i18n+basePath test to use correct fixture (#3124)
1 parent 7aa75c4 commit 68a8411

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

tests/e2e/page-router.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,13 +1352,15 @@ test.describe('Page Router with basePath and i18n', () => {
13521352

13531353
test('requesting a non existing page route that needs to be fetched from the blob store like 404.html', async ({
13541354
page,
1355-
pageRouter,
1355+
pageRouterBasePathI18n,
13561356
}) => {
1357-
const response = await page.goto(new URL('non-existing', pageRouter.url).href)
1357+
const response = await page.goto(
1358+
new URL('base/path/non-existing', pageRouterBasePathI18n.url).href,
1359+
)
13581360
const headers = response?.headers() || {}
13591361
expect(response?.status()).toBe(404)
13601362

1361-
expect(await page.textContent('p')).toBe('Custom 404 page')
1363+
expect(await page.textContent('p')).toBe('Custom 404 page for locale: en')
13621364

13631365
expect(headers['debug-netlify-cdn-cache-control']).toMatch(
13641366
/no-cache, no-store, max-age=0, must-revalidate, durable/m,
@@ -1368,13 +1370,15 @@ test.describe('Page Router with basePath and i18n', () => {
13681370

13691371
test('requesting a non existing page route that needs to be fetched from the blob store like 404.html (notFound: true)', async ({
13701372
page,
1371-
pageRouter,
1373+
pageRouterBasePathI18n,
13721374
}) => {
1373-
const response = await page.goto(new URL('static/not-found', pageRouter.url).href)
1375+
const response = await page.goto(
1376+
new URL('base/path/static/not-found', pageRouterBasePathI18n.url).href,
1377+
)
13741378
const headers = response?.headers() || {}
13751379
expect(response?.status()).toBe(404)
13761380

1377-
expect(await page.textContent('p')).toBe('Custom 404 page')
1381+
expect(await page.textContent('p')).toBe('Custom 404 page for locale: en')
13781382

13791383
// Prior to v14.2.4 notFound pages are not cacheable
13801384
// https://github.com/vercel/next.js/pull/66674

tests/utils/playwright-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const test = base.extend<
9898
if (response.url().includes('/_next/static/')) {
9999
expect(
100100
response.headers()['cache-control'],
101-
'_next/static assets should have immutable cache control',
101+
`_next/static asset (${response.url()}) should have immutable cache control`,
102102
).toContain('public,max-age=31536000,immutable')
103103
}
104104
})

0 commit comments

Comments
 (0)