Skip to content

Commit 2200b4b

Browse files
authored
Update e2e tests to Next 16 (webpack) (#1016)
1 parent e8971cd commit 2200b4b

File tree

39 files changed

+454
-352
lines changed

39 files changed

+454
-352
lines changed

.changeset/cold-rivers-bathe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
Update e2e tests to Next 16 (webpack)

examples/bugs/gh-219/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"zod": "^3.24.1"
4141
},
4242
"devDependencies": {
43-
"@cloudflare/workers-types": "^4.20241224.0",
43+
"@cloudflare/workers-types": "catalog:",
4444
"@eslint/eslintrc": "^3",
4545
"@opennextjs/cloudflare": "workspace:*",
4646
"@playwright/test": "catalog:",

examples/bugs/gh-223/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"react-dom": "^19.0.0"
2222
},
2323
"devDependencies": {
24-
"@cloudflare/workers-types": "^4.20241224.0",
24+
"@cloudflare/workers-types": "catalog:",
2525
"@opennextjs/cloudflare": "workspace:*",
2626
"@playwright/test": "catalog:",
2727
"@types/node": "^22.10.2",

examples/create-next-app/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
],
2020
"paths": {
2121
"@/*": ["./src/*"]
22-
}
22+
},
23+
"target": "ES2017"
2324
},
2425
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
2526
"exclude": ["node_modules", "open-next.config.ts"]

examples/e2e/app-pages-router/app/parallel/layout.tsx

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,13 @@ export default function Layout({ a, b, children }: { children: ReactNode; a: Rea
99

1010
return (
1111
<div>
12-
<div className="flex flex-col mb-10">
13-
<label htmlFor="a">
14-
Enable A
15-
<input
16-
name="a"
17-
type="checkbox"
18-
checked={routeA}
19-
onChange={(e) => {
20-
setRouteA(e.target.checked);
21-
}}
22-
/>
23-
</label>
24-
<label htmlFor="b">
25-
Enable B
26-
<input
27-
name="b"
28-
type="checkbox"
29-
checked={routeB}
30-
onChange={(e) => {
31-
setRouteB(e.target.checked);
32-
}}
33-
/>
34-
</label>
12+
<div className="flex flex-col items-start mb-10">
13+
<button onClick={() => setRouteA(!routeA)} data-testid="enable-a">
14+
{routeA ? "Disable A" : "Enable A"}
15+
</button>
16+
<button onClick={() => setRouteB(!routeB)} data-testid="enable-b">
17+
{routeB ? "Disable B" : "Enable B"}
18+
</button>
3519
</div>
3620

3721
{routeA && a}

examples/e2e/app-pages-router/e2e/parallel.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect, test } from "@playwright/test";
22

33
test("Parallel routes", async ({ page }) => {
44
await page.goto("/");
5-
await page.locator('[href="/parallel"]').click();
5+
await page.getByRole("link", { name: "Parallel" }).click();
66

77
await page.waitForURL("/parallel");
88

@@ -13,13 +13,13 @@ test("Parallel routes", async ({ page }) => {
1313
await expect(routeB).not.toBeVisible();
1414

1515
// Enable A, which should be visible but not B
16-
await page.locator('input[name="a"]').check();
16+
await page.getByTestId("enable-a").click();
1717
routeA = page.getByText("Parallel Route A");
1818
await expect(routeA).toBeVisible();
1919
await expect(routeB).not.toBeVisible();
2020

2121
// Enable B, both should be visible
22-
await page.locator('input[name="b"]').check();
22+
await page.getByTestId("enable-b").click();
2323
routeB = page.getByText("Parallel Route B");
2424
await expect(routeA).toBeVisible();
2525
await expect(routeB).toBeVisible();

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,10 @@ import type { NextConfig } from "next";
33
const nextConfig: NextConfig = {
44
poweredByHeader: false,
55
cleanDistDir: true,
6-
transpilePackages: ["@example/shared"],
76
output: "standalone",
8-
// outputFileTracingRoot: "../sst",
97
typescript: {
108
ignoreBuildErrors: true,
119
},
12-
eslint: {
13-
ignoreDuringBuilds: true,
14-
},
1510
trailingSlash: true,
1611
skipTrailingSlashRedirect: true,
1712
};

examples/e2e/app-pages-router/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"openbuild": "node ../../packages/open-next/dist/index.js build --build-command \"npx turbo build\"",
77
"dev": "next dev --turbopack --port 3003",
8-
"build": "next build",
8+
"build": "next build --webpack",
99
"start": "next start --port 3003",
1010
"lint": "next lint",
1111
"clean": "rm -rf .turbo node_modules .next .open-next",

examples/e2e/app-pages-router/tsconfig.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"moduleResolution": "NodeNext",
1313
"resolveJsonModule": true,
1414
"isolatedModules": true,
15-
"jsx": "preserve",
15+
"jsx": "react-jsx",
1616
"incremental": true,
1717
"plugins": [
1818
{
@@ -24,6 +24,13 @@
2424
"@example/shared": ["../shared"]
2525
}
2626
},
27-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "../utils.ts"],
27+
"include": [
28+
"next-env.d.ts",
29+
"**/*.ts",
30+
"**/*.tsx",
31+
".next/types/**/*.ts",
32+
"../utils.ts",
33+
".next/dev/types/**/*.ts"
34+
],
2835
"exclude": ["node_modules", "open-next.config.ts"]
2936
}

examples/e2e/app-router/app/api/after/revalidate/route.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ export function POST() {
66
() =>
77
new Promise<void>((resolve) =>
88
setTimeout(() => {
9-
revalidateTag("date");
9+
revalidateTag("date", {
10+
// We want to expire the "date" tag immediately
11+
expire: 0,
12+
});
1013
resolve();
1114
}, 5000)
1215
)

0 commit comments

Comments
 (0)