Skip to content

Commit f47b5a5

Browse files
authored
chore: rename fixtures (#413)
* chore: rename fixtures * chore: skip PPR tests on non-canary
1 parent 57d8d26 commit f47b5a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+104
-490
lines changed

.prettierignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ package-lock.json
77
package.json
88
edge-runtime/vendor/
99
deno.lock
10-
tests/fixtures/simple-next-app-dist-dir/cool/output
10+
tests/fixtures/dist-dir/cool/output
1111
.nx
1212
custom-dist-dir
1313
pnpm.lock

tests/e2e/package-manager.test.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { test } from '../utils/playwright-helpers.js'
55
test.describe.configure({ mode: 'parallel' })
66

77
test.describe('[Yarn] Package manager', () => {
8-
test.describe('simple-next-app', () => {
9-
test('Renders the Home page correctly', async ({ page, simpleNextAppYarn }) => {
10-
await page.goto(simpleNextAppYarn.url)
8+
test.describe('simple app', () => {
9+
test('Renders the Home page correctly', async ({ page, yarn }) => {
10+
await page.goto(yarn.url)
1111

1212
await expect(page).toHaveTitle('Simple Next App')
1313

@@ -18,9 +18,9 @@ test.describe('[Yarn] Package manager', () => {
1818
})
1919

2020
test.describe('[PNPM] Package manager', () => {
21-
test.describe('simple-next-app-pnpm', () => {
22-
test('Renders the Home page correctly', async ({ page, simpleNextAppPNPM }) => {
23-
await page.goto(simpleNextAppPNPM.url)
21+
test.describe('pnpm', () => {
22+
test('Renders the Home page correctly', async ({ page, pnpm }) => {
23+
await page.goto(pnpm.url)
2424

2525
await expect(page).toHaveTitle('Simple Next App')
2626

@@ -30,9 +30,9 @@ test.describe('[PNPM] Package manager', () => {
3030
})
3131
})
3232
test.describe('[Bun] Package manager', () => {
33-
test.describe('simple-next-app', () => {
34-
test('Renders the Home page correctly', async ({ page, simpleNextAppBun }) => {
35-
await page.goto(simpleNextAppBun.url)
33+
test.describe('simple app', () => {
34+
test('Renders the Home page correctly', async ({ page, bun }) => {
35+
await page.goto(bun.url)
3636

3737
await expect(page).toHaveTitle('Simple Next App')
3838

tests/e2e/simple-app.test.ts

+30-33
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const expectImageWasLoaded = async (locator: Locator) => {
66
expect(await locator.evaluate((img: HTMLImageElement) => img.naturalHeight)).toBeGreaterThan(0)
77
}
88

9-
test('Renders the Home page correctly', async ({ page, simpleNextApp }) => {
10-
const response = await page.goto(simpleNextApp.url)
9+
test('Renders the Home page correctly', async ({ page, simple }) => {
10+
const response = await page.goto(simple.url)
1111
const headers = response?.headers() || {}
1212

1313
await expect(page).toHaveTitle('Simple Next App')
@@ -19,17 +19,14 @@ test('Renders the Home page correctly', async ({ page, simpleNextApp }) => {
1919

2020
await expectImageWasLoaded(page.locator('img'))
2121

22-
await page.goto(`${simpleNextApp.url}/api/static`)
22+
await page.goto(`${simple.url}/api/static`)
2323

2424
const body = (await page.$('body').then((el) => el?.textContent())) || '{}'
2525
expect(body).toBe('{"words":"hello world"}')
2626
})
2727

28-
test('Renders the Home page correctly with output export', async ({
29-
page,
30-
simpleNextAppExport,
31-
}) => {
32-
const response = await page.goto(simpleNextAppExport.url)
28+
test('Renders the Home page correctly with output export', async ({ page, outputExport }) => {
29+
const response = await page.goto(outputExport.url)
3330
const headers = response?.headers() || {}
3431

3532
await expect(page).toHaveTitle('Simple Next App')
@@ -42,8 +39,8 @@ test('Renders the Home page correctly with output export', async ({
4239
await expectImageWasLoaded(page.locator('img'))
4340
})
4441

45-
test('Renders the Home page correctly with distDir', async ({ page, simpleNextAppDistDir }) => {
46-
await page.goto(simpleNextAppDistDir.url)
42+
test('Renders the Home page correctly with distDir', async ({ page, distDir }) => {
43+
await page.goto(distDir.url)
4744

4845
await expect(page).toHaveTitle('Simple Next App')
4946

@@ -53,29 +50,29 @@ test('Renders the Home page correctly with distDir', async ({ page, simpleNextAp
5350
await expectImageWasLoaded(page.locator('img'))
5451
})
5552

56-
test('Serves a static image correctly', async ({ page, simpleNextApp }) => {
57-
const response = await page.goto(`${simpleNextApp.url}/next.svg`)
53+
test('Serves a static image correctly', async ({ page, simple }) => {
54+
const response = await page.goto(`${simple.url}/next.svg`)
5855

5956
expect(response?.status()).toBe(200)
6057
expect(response?.headers()['content-type']).toBe('image/svg+xml')
6158
})
6259

63-
test('Redirects correctly', async ({ page, simpleNextApp }) => {
64-
await page.goto(`${simpleNextApp.url}/redirect/response`)
60+
test('Redirects correctly', async ({ page, simple }) => {
61+
await page.goto(`${simple.url}/redirect/response`)
6562
await expect(page).toHaveURL(`https://www.netlify.com/`)
6663

67-
await page.goto(`${simpleNextApp.url}/redirect`)
64+
await page.goto(`${simple.url}/redirect`)
6865
await expect(page).toHaveURL(`https://www.netlify.com/`)
6966
})
7067

7168
const waitFor = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
7269

7370
// adaptation of https://github.com/vercel/next.js/blob/canary/test/e2e/app-dir/app-static/app-static.test.ts#L1716-L1755
74-
test.skip('streams stale responses', async ({ simpleNextApp }) => {
71+
test.skip('streams stale responses', async ({ simple }) => {
7572
// Introduced in https://github.com/vercel/next.js/pull/55978
7673
test.skip(!nextVersionSatisfies('>=13.5.4'), 'This test is only for Next.js 13.5.4+')
7774
// Prime the cache.
78-
const path = `${simpleNextApp.url}/stale-cache-serving/app-page`
75+
const path = `${simple.url}/stale-cache-serving/app-page`
7976
const res = await fetch(path)
8077
expect(res.status).toBe(200)
8178

@@ -122,10 +119,10 @@ test.skip('streams stale responses', async ({ simpleNextApp }) => {
122119
})
123120

124121
test.describe('next/image is using Netlify Image CDN', () => {
125-
test('Local images', async ({ page, simpleNextApp }) => {
122+
test('Local images', async ({ page, simple }) => {
126123
const nextImageResponsePromise = page.waitForResponse('**/_next/image**')
127124

128-
await page.goto(`${simpleNextApp.url}/image/local`)
125+
await page.goto(`${simple.url}/image/local`)
129126

130127
const nextImageResponse = await nextImageResponsePromise
131128
expect(nextImageResponse.request().url()).toContain('_next/image?url=%2Fsquirrel.jpg')
@@ -140,11 +137,11 @@ test.describe('next/image is using Netlify Image CDN', () => {
140137

141138
test('Remote images: remote patterns #1 (protocol, hostname, pathname set)', async ({
142139
page,
143-
simpleNextApp,
140+
simple,
144141
}) => {
145142
const nextImageResponsePromise = page.waitForResponse('**/_next/image**')
146143

147-
await page.goto(`${simpleNextApp.url}/image/remote-pattern-1`)
144+
await page.goto(`${simple.url}/image/remote-pattern-1`)
148145

149146
const nextImageResponse = await nextImageResponsePromise
150147

@@ -162,11 +159,11 @@ test.describe('next/image is using Netlify Image CDN', () => {
162159

163160
test('Remote images: remote patterns #2 (just hostname starting with wildcard)', async ({
164161
page,
165-
simpleNextApp,
162+
simple,
166163
}) => {
167164
const nextImageResponsePromise = page.waitForResponse('**/_next/image**')
168165

169-
await page.goto(`${simpleNextApp.url}/image/remote-pattern-2`)
166+
await page.goto(`${simple.url}/image/remote-pattern-2`)
170167

171168
const nextImageResponse = await nextImageResponsePromise
172169

@@ -182,10 +179,10 @@ test.describe('next/image is using Netlify Image CDN', () => {
182179
await expectImageWasLoaded(page.locator('img'))
183180
})
184181

185-
test('Remote images: domains', async ({ page, simpleNextApp }) => {
182+
test('Remote images: domains', async ({ page, simple }) => {
186183
const nextImageResponsePromise = page.waitForResponse('**/_next/image**')
187184

188-
await page.goto(`${simpleNextApp.url}/image/remote-domain`)
185+
await page.goto(`${simple.url}/image/remote-domain`)
189186

190187
const nextImageResponse = await nextImageResponsePromise
191188

@@ -201,13 +198,13 @@ test.describe('next/image is using Netlify Image CDN', () => {
201198
await expectImageWasLoaded(page.locator('img'))
202199
})
203200

204-
test('Handling of browser-cached Runtime v4 redirect', async ({ page, simpleNextApp }) => {
201+
test('Handling of browser-cached Runtime v4 redirect', async ({ page, simple }) => {
205202
// Runtime v4 redirects for next/image are 301 and would be cached by browser
206203
// So this test checks behavior when migrating from v4 to v5 for site visitors
207204
// and ensure that images are still served through Image CDN
208205
const nextImageResponsePromise = page.waitForResponse('**/_ipx/**')
209206

210-
await page.goto(`${simpleNextApp.url}/image/migration-from-v4-runtime`)
207+
await page.goto(`${simple.url}/image/migration-from-v4-runtime`)
211208

212209
const nextImageResponse = await nextImageResponsePromise
213210
// ensure fixture is replicating runtime v4 redirect
@@ -224,9 +221,9 @@ test.describe('next/image is using Netlify Image CDN', () => {
224221

225222
test('requesting a non existing page route that needs to be fetched from the blob store like 404.html', async ({
226223
page,
227-
simpleNextApp,
224+
simple,
228225
}) => {
229-
const response = await page.goto(new URL('non-existing', simpleNextApp.url).href)
226+
const response = await page.goto(new URL('non-existing', simple.url).href)
230227
const headers = response?.headers() || {}
231228
expect(response?.status()).toBe(404)
232229

@@ -240,9 +237,9 @@ test('requesting a non existing page route that needs to be fetched from the blo
240237

241238
test('requesting a non existing page route that needs to be fetched from the blob store like 404.html (notFound())', async ({
242239
page,
243-
simpleNextApp,
240+
simple,
244241
}) => {
245-
const response = await page.goto(new URL('not-found', simpleNextApp.url).href)
242+
const response = await page.goto(new URL('not-found', simple.url).href)
246243
const headers = response?.headers() || {}
247244
expect(response?.status()).toBe(404)
248245

@@ -254,8 +251,8 @@ test('requesting a non existing page route that needs to be fetched from the blo
254251
expect(headers['cache-control']).toBe('public,max-age=0,must-revalidate')
255252
})
256253

257-
test('Compressed rewrites are readable', async ({ simpleNextApp }) => {
258-
const resp = await fetch(`${simpleNextApp.url}/rewrite-no-basepath`)
254+
test('Compressed rewrites are readable', async ({ simple }) => {
255+
const resp = await fetch(`${simple.url}/rewrite-no-basepath`)
259256
expect(resp.headers.get('content-length')).toBeNull()
260257
expect(resp.headers.get('transfer-encoding')).toEqual('chunked')
261258
expect(resp.headers.get('content-encoding')).toEqual('br')

tests/fixtures/simple-next-app-export/package.json renamed to tests/fixtures/base-path/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "simple-next-app",
2+
"name": "base-path",
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {

tests/fixtures/simple-next-app/package.json renamed to tests/fixtures/dist-dir/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "simple-next-app",
2+
"name": "dist-dir",
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {

tests/fixtures/simple-next-app-dist-dir/package.json renamed to tests/fixtures/output-export/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "simple-next-app-dist-dir",
2+
"name": "output-export",
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {

tests/fixtures/simple-next-app-pnpm/package.json renamed to tests/fixtures/pnpm/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "simple-next-app-pnpm",
2+
"name": "pnpm",
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "simple-next-app",
2+
"name": "ppr",
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
@@ -8,8 +8,13 @@
88
"build": "next build"
99
},
1010
"dependencies": {
11-
"next": "^14.1.1-canary.66",
11+
"next": "canary",
1212
"react": "18.2.0",
1313
"react-dom": "18.2.0"
14+
},
15+
"test": {
16+
"dependencies": {
17+
"next": "canary"
18+
}
1419
}
1520
}

0 commit comments

Comments
 (0)