Skip to content

Commit e939d9f

Browse files
enable e2e/app-router tests to run in CI (#314)
1 parent 156d9f1 commit e939d9f

11 files changed

+35
-15
lines changed

examples/e2e/app-router/e2e/after.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { expect, test } from "@playwright/test";
22

3-
test("Next after", async ({ request }) => {
3+
// Cache is currently not supported: https://github.com/opennextjs/opennextjs-cloudflare/issues/105
4+
// (Note: specifically this test relied on `unstable_cache`: https://github.com/opennextjs/opennextjs-cloudflare/issues/105#issuecomment-2627074820)
5+
test.skip("Next after", async ({ request }) => {
46
const initialSSG = await request.get("/api/after/ssg");
57
expect(initialSSG.status()).toEqual(200);
68
const initialSSGJson = await initialSSG.json();

examples/e2e/app-router/e2e/host.test.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ import { expect, test } from "@playwright/test";
22

33
/**
44
* Tests that the request.url is the deployed host and not localhost
5+
*
6+
* This test is skipped since e2e tests for the cloudflare adapter
7+
* run only locally to the baseURL doesn't match
58
*/
6-
test("Request.url is host", async ({ baseURL, page }) => {
9+
test.skip("Request.url is host", async ({ baseURL, page }) => {
710
await page.goto("/api/host");
811

912
const el = page.getByText(`{"url":"${baseURL}/api/host"}`);

examples/e2e/app-router/e2e/image-optimization.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { expect, test } from "@playwright/test";
22

3-
test("Image Optimization", async ({ page }) => {
3+
// Image Optimization is currently not supported: https://github.com/opennextjs/opennextjs-cloudflare/issues/106
4+
test.skip("Image Optimization", async ({ page }) => {
45
await page.goto("/");
56

67
const imageResponsePromise = page.waitForResponse(/https%3A%2F%2Fopennext.js.org%2Farchitecture.png/);

examples/e2e/app-router/e2e/isr.revalidate.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { expect, test } from "@playwright/test";
22

3-
test("Test revalidate", async ({ request }) => {
3+
// Cache (and revalidation) is currently not supported: https://github.com/opennextjs/opennextjs-cloudflare/issues/105
4+
test.skip("Test revalidate", async ({ request }) => {
45
const result = await request.get("/api/isr");
56

67
expect(result.status()).toEqual(200);

examples/e2e/app-router/e2e/isr.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { expect, test } from "@playwright/test";
22

3-
test("Incremental Static Regeneration", async ({ page }) => {
3+
// ISR is currently not supported: https://github.com/opennextjs/opennextjs-cloudflare/issues/105
4+
test.skip("Incremental Static Regeneration", async ({ page }) => {
45
test.setTimeout(45000);
56
await page.goto("/");
67
await page.locator("[href='/isr']").click();
@@ -40,7 +41,8 @@ test("Incremental Static Regeneration", async ({ page }) => {
4041
expect(newTime).not.toEqual(finalTime);
4142
});
4243

43-
test("headers", async ({ page }) => {
44+
// ISR is currently not supported: https://github.com/opennextjs/opennextjs-cloudflare/issues/105
45+
test.skip("headers", async ({ page }) => {
4446
let responsePromise = page.waitForResponse((response) => {
4547
return response.status() === 200;
4648
});

examples/e2e/app-router/e2e/revalidateTag.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { expect, test } from "@playwright/test";
22

3-
test("Revalidate tag", async ({ page, request }) => {
3+
// Cache (and revalidateTag) is currently not supported: https://github.com/opennextjs/opennextjs-cloudflare/issues/105
4+
test.skip("Revalidate tag", async ({ page, request }) => {
45
test.setTimeout(45000);
56
// We need to hit the page twice to make sure it's properly cached
67
// Turbo might cache next build result, resulting in the tag being newer than the page
@@ -68,7 +69,8 @@ test("Revalidate tag", async ({ page, request }) => {
6869
expect(nextCacheHeaderNested).toEqual("HIT");
6970
});
7071

71-
test("Revalidate path", async ({ page, request }) => {
72+
// Cache (and revalidatePath) is currently not supported: https://github.com/opennextjs/opennextjs-cloudflare/issues/105
73+
test.skip("Revalidate path", async ({ page, request }) => {
7274
await page.goto("/revalidate-path");
7375

7476
let elLayout = page.getByText("RequestID:");

examples/e2e/app-router/e2e/ssr.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import { expect, test } from "@playwright/test";
55

66
// NOTE: We don't await page load b/c we want to see the Loading page
7-
test("Server Side Render and loading.tsx", async ({ page }) => {
7+
// loading.tsx doesn't currently work: https://github.com/opennextjs/opennextjs-cloudflare/issues/313
8+
test.skip("Server Side Render and loading.tsx", async ({ page }) => {
89
test.setTimeout(600000);
910
await page.goto("/");
1011
await page.getByRole("link", { name: "SSR" }).click();

examples/e2e/app-router/e2e/trailing.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { expect, test } from "@playwright/test";
22

3-
test("trailingSlash redirect", async ({ page }) => {
3+
// trailingSlash redirecting doesn't work: https://github.com/opennextjs/opennextjs-cloudflare/issues/312
4+
test.skip("trailingSlash redirect", async ({ page }) => {
45
const response = await page.goto("/ssr/");
56

67
expect(response?.request().redirectedFrom()?.url()).toMatch(/\/ssr\/$/);
78
expect(response?.request().url()).toMatch(/\/ssr$/);
89
});
910

10-
test("trailingSlash redirect with search parameters", async ({ page }) => {
11+
// trailingSlash redirecting doesn't work: https://github.com/opennextjs/opennextjs-cloudflare/issues/312
12+
test.skip("trailingSlash redirect with search parameters", async ({ page }) => {
1113
const response = await page.goto("/ssr/?happy=true");
1214

1315
expect(response?.request().redirectedFrom()?.url()).toMatch(/\/ssr\/\?happy=true$/);

examples/e2e/app-router/open-next.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { OpenNextConfig } from "@opennextjs/aws/types/open-next.js";
2+
import cache from "@opennextjs/cloudflare/kvCache";
23

34
const config: OpenNextConfig = {
45
default: {
56
override: {
67
wrapper: "cloudflare-node",
78
converter: "edge",
8-
// Unused implementation
9-
incrementalCache: "dummy",
9+
incrementalCache: async () => cache,
1010
tagCache: "dummy",
1111
queue: "dummy",
1212
},

examples/e2e/app-router/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"build:worker": "pnpm opennextjs-cloudflare",
1313
"dev:worker": "wrangler dev --port 8790 --inspector-port 9350",
1414
"preview": "pnpm build:worker && pnpm dev:worker",
15-
"e2e-fix": "playwright test -c e2e/playwright.config.ts"
15+
"e2e": "playwright test -c e2e/playwright.config.ts"
1616
},
1717
"dependencies": {
1818
"@opennextjs/cloudflare": "workspace:*",

examples/e2e/app-router/wrangler.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,11 @@
77
"assets": {
88
"directory": ".open-next/assets",
99
"binding": "ASSETS"
10-
}
10+
},
11+
"kv_namespaces": [
12+
{
13+
"binding": "NEXT_CACHE_WORKERS_KV",
14+
"id": "<BINDING_ID>"
15+
}
16+
]
1117
}

0 commit comments

Comments
 (0)