Skip to content

Commit 138ac65

Browse files
fix parallel e2e runs
1 parent 00b2208 commit 138ac65

File tree

7 files changed

+12
-18
lines changed

7 files changed

+12
-18
lines changed

.github/workflows/playwright.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ jobs:
1717
run: npm install -g pnpm && pnpm install
1818
- name: Install Playwright browsers
1919
run: pnpm run install-playwright
20-
- name: Run Playwright tests
21-
run: pnpm run e2e
22-
# - uses: actions/upload-artifact@v4
23-
# if: always()
24-
# with:
25-
# name: api-playwright-report
26-
# path: next-apps/*/playwright-report/
27-
# retention-days: 30
20+
- name: Run playwright tests (api)
21+
run: pnpm -F api run e2e
22+
- name: Run playwright tests (create-next-app)
23+
run: pnpm -F create-next-app run e2e

examples/api/e2e-tests/base.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { test, expect } from "@playwright/test";
33
test("the application's noop index page is visible and it allows navigating to the hello-world api route", async ({
44
page,
55
}) => {
6-
await page.goto("http://localhost:8770/");
6+
await page.goto("/");
77
await expect(page.getByText("This application doesn't have")).toBeVisible();
88
await page.getByRole("link", { name: "/api/hello" }).click();
99
await expect(page.getByText("Hello World!")).toBeVisible();
1010
});
1111

1212
test("the hello-world api route works as intended", async ({ page }) => {
13-
const res = await fetch("http://localhost:8770/api/hello");
14-
expect(res.headers.get("content-type")).toContain("text/plain");
13+
const res = await page.request.get("/api/hello");
14+
expect(res.headers()["content-type"]).toContain("text/plain");
1515
expect(await res.text()).toEqual("Hello World!");
1616
});

examples/api/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"build:worker": "builder",
1111
"dev:worker": "wrangler dev --port 8770",
1212
"preview:worker": "pnpm build:worker && pnpm dev:worker",
13-
"pree2e": "playwright install --with-deps",
1413
"e2e": "playwright test"
1514
},
1615
"dependencies": {

examples/api/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default defineConfig({
2727
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2828
use: {
2929
/* Base URL to use in actions like `await page.goto('/')`. */
30-
// baseURL: 'http://127.0.0.1:3000',
30+
baseURL: "http://localhost:8770",
3131

3232
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3333
trace: "on-first-retry",

examples/create-next-app/e2e/base.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { test, expect } from "@playwright/test";
33
test("the index page of the application shows the Next.js logo", async ({
44
page,
55
}) => {
6-
await page.goto("http://localhost:8770/");
6+
await page.goto("/");
77
await expect(page.getByAltText("Next.js logo")).toBeVisible();
88
});

examples/create-next-app/e2e/playwright.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default defineConfig({
2727
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2828
use: {
2929
/* Base URL to use in actions like `await page.goto('/')`. */
30-
// baseURL: 'http://127.0.0.1:3000',
30+
baseURL: "http://localhost:8771",
3131

3232
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3333
trace: "on-first-retry",
@@ -74,7 +74,7 @@ export default defineConfig({
7474
/* Run your local dev server before starting the tests */
7575
webServer: {
7676
command: "pnpm preview:worker",
77-
url: "http://localhost:8770",
77+
url: "http://localhost:8771",
7878
reuseExistingServer: !process.env.CI,
7979
},
8080
});

examples/create-next-app/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
"start": "next start",
99
"lint": "next lint",
1010
"build:worker": "builder",
11-
"dev:worker": "wrangler dev --port 8770",
11+
"dev:worker": "wrangler dev --port 8771",
1212
"preview:worker": "pnpm build:worker && pnpm dev:worker",
13-
"pree2e": "playwright install --with-deps",
1413
"e2e": "playwright test -c e2e/playwright.config.ts"
1514
},
1615
"dependencies": {

0 commit comments

Comments
 (0)