-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathwith-integrations.test.ts
56 lines (46 loc) · 2.34 KB
/
with-integrations.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { expect } from '@playwright/test'
import { test } from '../utils/playwright-helpers.js'
test('Renders the Home page correctly', async ({ page, withIntegrations }) => {
await page.goto(withIntegrations.url)
expect(page.locator('body')).toHaveText('Hello World')
})
test.describe('Should clear stale functions produced by previous builds by @netlify/plugin-nextjs', () => {
test('Serverless functions', async ({ page, withIntegrations }) => {
const response1 = await page.goto(new URL('/test/serverless/v4', withIntegrations.url).href)
expect(response1?.status()).toBe(404)
const response2 = await page.goto(new URL('/test/serverless/v5', withIntegrations.url).href)
expect(response2?.status()).toBe(404)
})
test('Edge functions', async ({ page, withIntegrations }) => {
const response1 = await page.goto(new URL('/test/edge/v4', withIntegrations.url).href)
expect(response1?.status()).toBe(404)
const response2 = await page.goto(new URL('/test/edge/v5', withIntegrations.url).href)
expect(response2?.status()).toBe(404)
})
})
test.describe('Should keep functions produced by other build plugins', () => {
test('Serverless functions', async ({ page, withIntegrations }) => {
const response1 = await page.goto(
new URL('/test/serverless/integration-with-json-config', withIntegrations.url).href,
)
expect(response1?.status()).toBe(200)
expect(await response1?.text()).toBe('Hello from /test/serverless/integration-with-json-config')
const response2 = await page.goto(
new URL('/test/serverless/integration-with-json-config', withIntegrations.url).href,
)
expect(response2?.status()).toBe(200)
expect(await response2?.text()).toBe('Hello from /test/serverless/integration-with-json-config')
})
test('Edge functions', async ({ page, withIntegrations }) => {
const response1 = await page.goto(
new URL('/test/edge/integration-in-manifest', withIntegrations.url).href,
)
expect(response1?.status()).toBe(200)
expect(await response1?.text()).toBe('Hello from /test/edge/integration-in-manifest')
const response2 = await page.goto(
new URL('/test/edge/integration-not-in-manifest', withIntegrations.url).href,
)
expect(response2?.status()).toBe(200)
expect(await response2?.text()).toBe('Hello from /test/edge/integration-not-in-manifest')
})
})