this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add e2e tests to create-next-app example

authored by

Peter Bacon Darwin and committed by
Victor Berchet
d0b7eb8e 231c4dc7

+145 -20
+1 -1
examples/api/package.json
··· 14 14 "e2e": "playwright test" 15 15 }, 16 16 "dependencies": { 17 - "builder": "workspace:*", 18 17 "next": "14.2.5", 19 18 "react": "^18", 20 19 "react-dom": "^18" 21 20 }, 22 21 "devDependencies": { 22 + "builder": "workspace:*", 23 23 "@playwright/test": "1.47.0", 24 24 "@types/node": "^22.2.0", 25 25 "node-url": "npm:url@^0.11.4",
+9
examples/create-next-app/.gitignore
··· 34 34 # typescript 35 35 *.tsbuildinfo 36 36 next-env.d.ts 37 + 38 + # wrangler 39 + .wrangler 40 + 41 + # playwright 42 + /test-results/ 43 + /playwright-report/ 44 + /blob-report/ 45 + /playwright/.cache/
+8
examples/create-next-app/e2e/base.spec.ts
··· 1 + import { test, expect } from "@playwright/test"; 2 + 3 + test("the index page of the application shows the Next.js logo", async ({ 4 + page, 5 + }) => { 6 + await page.goto("http://localhost:8770/"); 7 + await expect(page.getByAltText("Next.js logo")).toBeVisible(); 8 + });
+80
examples/create-next-app/e2e/playwright.config.ts
··· 1 + import { defineConfig, devices } from "@playwright/test"; 2 + 3 + declare const process: { env: Record<string, string> }; 4 + 5 + /** 6 + * Read environment variables from file. 7 + * https://github.com/motdotla/dotenv 8 + */ 9 + // import dotenv from 'dotenv'; 10 + // dotenv.config({ path: path.resolve(__dirname, '.env') }); 11 + 12 + /** 13 + * See https://playwright.dev/docs/test-configuration. 14 + */ 15 + export default defineConfig({ 16 + testDir: "./", 17 + /* Run tests in files in parallel */ 18 + fullyParallel: true, 19 + /* Fail the build on CI if you accidentally left test.only in the source code. */ 20 + forbidOnly: !!process.env.CI, 21 + /* Retry on CI only */ 22 + retries: process.env.CI ? 2 : 0, 23 + /* Opt out of parallel tests on CI. */ 24 + workers: process.env.CI ? 1 : undefined, 25 + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ 26 + reporter: "html", 27 + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ 28 + use: { 29 + /* Base URL to use in actions like `await page.goto('/')`. */ 30 + // baseURL: 'http://127.0.0.1:3000', 31 + 32 + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ 33 + trace: "on-first-retry", 34 + }, 35 + 36 + /* Configure projects for major browsers */ 37 + projects: [ 38 + { 39 + name: "chromium", 40 + use: { ...devices["Desktop Chrome"] }, 41 + }, 42 + 43 + { 44 + name: "firefox", 45 + use: { ...devices["Desktop Firefox"] }, 46 + }, 47 + 48 + { 49 + name: "webkit", 50 + use: { ...devices["Desktop Safari"] }, 51 + }, 52 + 53 + /* Test against mobile viewports. */ 54 + // { 55 + // name: 'Mobile Chrome', 56 + // use: { ...devices['Pixel 5'] }, 57 + // }, 58 + // { 59 + // name: 'Mobile Safari', 60 + // use: { ...devices['iPhone 12'] }, 61 + // }, 62 + 63 + /* Test against branded browsers. */ 64 + // { 65 + // name: 'Microsoft Edge', 66 + // use: { ...devices['Desktop Edge'], channel: 'msedge' }, 67 + // }, 68 + // { 69 + // name: 'Google Chrome', 70 + // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, 71 + // }, 72 + ], 73 + 74 + /* Run your local dev server before starting the tests */ 75 + webServer: { 76 + command: "pnpm preview:worker", 77 + url: "http://localhost:8770", 78 + reuseExistingServer: !process.env.CI, 79 + }, 80 + });
+11 -6
examples/create-next-app/package.json
··· 7 7 "build": "next build", 8 8 "start": "next start", 9 9 "lint": "next lint", 10 - "prepreview": "node ../../builder/dist/index.mjs", 11 - "preview": "wrangler dev" 10 + "build:worker": "builder", 11 + "dev:worker": "wrangler dev --port 8770", 12 + "preview:worker": "pnpm build:worker && pnpm dev:worker", 13 + "pree2e": "playwright install --with-deps", 14 + "e2e": "playwright test -c e2e/playwright.config.ts" 12 15 }, 13 16 "dependencies": { 14 17 "react": "^18", ··· 16 19 "next": "14.2.11" 17 20 }, 18 21 "devDependencies": { 19 - "typescript": "^5", 22 + "builder": "workspace:*", 23 + "@playwright/test": "1.47.0", 20 24 "@types/node": "^20", 21 25 "@types/react": "^18", 22 26 "@types/react-dom": "^18", 23 - "postcss": "^8", 24 - "tailwindcss": "^3.4.1", 25 - "node-url": "npm:url@^0.11.4", 26 27 "eslint": "^8", 27 28 "eslint-config-next": "14.2.11", 29 + "postcss": "^8", 30 + "node-url": "npm:url@^0.11.4", 31 + "tailwindcss": "^3.4.1", 32 + "typescript": "^5", 28 33 "wrangler": "^3.77.0" 29 34 } 30 35 }
+3 -1
package.json
··· 1 1 { 2 - "name": "POC-NextJS", 2 + "name": "poc-next", 3 + "version": "0.0.0.0", 4 + "private": true, 3 5 "devDependencies": { 4 6 "prettier": "3.3.3" 5 7 },
+18 -12
pnpm-lock.yaml
··· 35 35 36 36 examples/api: 37 37 dependencies: 38 - builder: 39 - specifier: workspace:* 40 - version: link:../../builder 41 38 next: 42 39 specifier: 14.2.5 43 40 version: 14.2.5(@playwright/test@1.47.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) ··· 54 51 '@types/node': 55 52 specifier: ^22.2.0 56 53 version: 22.2.0 54 + builder: 55 + specifier: workspace:* 56 + version: link:../../builder 57 57 node-url: 58 58 specifier: npm:url@^0.11.4 59 59 version: url@0.11.4 ··· 73 73 specifier: ^18 74 74 version: 18.3.1(react@18.3.1) 75 75 devDependencies: 76 + '@playwright/test': 77 + specifier: 1.47.0 78 + version: 1.47.0 76 79 '@types/node': 77 80 specifier: ^20 78 81 version: 20.16.5 ··· 82 85 '@types/react-dom': 83 86 specifier: ^18 84 87 version: 18.3.0 88 + builder: 89 + specifier: workspace:* 90 + version: link:../../builder 85 91 eslint: 86 92 specifier: ^8 87 93 version: 8.57.0 ··· 3462 3468 '@typescript-eslint/parser': 7.2.0(eslint@8.57.0)(typescript@5.5.4) 3463 3469 eslint: 8.57.0 3464 3470 eslint-import-resolver-node: 0.3.9 3465 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@8.57.0) 3466 - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0) 3471 + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0) 3472 + eslint-plugin-import: 2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) 3467 3473 eslint-plugin-jsx-a11y: 6.10.0(eslint@8.57.0) 3468 3474 eslint-plugin-react: 7.36.1(eslint@8.57.0) 3469 3475 eslint-plugin-react-hooks: 4.6.2(eslint@8.57.0) ··· 3482 3488 transitivePeerDependencies: 3483 3489 - supports-color 3484 3490 3485 - eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@8.57.0): 3491 + eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0): 3486 3492 dependencies: 3487 3493 '@nolyfill/is-core-module': 1.0.39 3488 3494 debug: 4.3.6 3489 3495 enhanced-resolve: 5.17.1 3490 3496 eslint: 8.57.0 3491 - eslint-module-utils: 2.11.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@8.57.0))(eslint@8.57.0) 3497 + eslint-module-utils: 2.11.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) 3492 3498 fast-glob: 3.3.2 3493 3499 get-tsconfig: 4.8.0 3494 3500 is-bun-module: 1.2.1 3495 3501 is-glob: 4.0.3 3496 3502 optionalDependencies: 3497 - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0) 3503 + eslint-plugin-import: 2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) 3498 3504 transitivePeerDependencies: 3499 3505 - '@typescript-eslint/parser' 3500 3506 - eslint-import-resolver-node 3501 3507 - eslint-import-resolver-webpack 3502 3508 - supports-color 3503 3509 3504 - eslint-module-utils@2.11.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@8.57.0))(eslint@8.57.0): 3510 + eslint-module-utils@2.11.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0): 3505 3511 dependencies: 3506 3512 debug: 3.2.7 3507 3513 optionalDependencies: 3508 3514 '@typescript-eslint/parser': 7.2.0(eslint@8.57.0)(typescript@5.5.4) 3509 3515 eslint: 8.57.0 3510 3516 eslint-import-resolver-node: 0.3.9 3511 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@8.57.0) 3517 + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0) 3512 3518 transitivePeerDependencies: 3513 3519 - supports-color 3514 3520 3515 - eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0): 3521 + eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0): 3516 3522 dependencies: 3517 3523 '@rtsao/scc': 1.1.0 3518 3524 array-includes: 3.1.8 ··· 3523 3529 doctrine: 2.1.0 3524 3530 eslint: 8.57.0 3525 3531 eslint-import-resolver-node: 0.3.9 3526 - eslint-module-utils: 2.11.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@8.57.0))(eslint@8.57.0) 3532 + eslint-module-utils: 2.11.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0))(eslint@8.57.0))(eslint@8.57.0) 3527 3533 hasown: 2.0.2 3528 3534 is-core-module: 2.15.1 3529 3535 is-glob: 4.0.3
+15
pnpm-workspace.yaml
··· 1 1 packages: 2 2 - "builder" 3 3 - "examples/*" 4 + 5 + catalog: 6 + "@playwright/test": 1.47.0 7 + "@types/node": ^22.2.0 8 + "@types/react": ^18 9 + "@types/react-dom": ^18 10 + "eslint": ^8 11 + "eslint-config-next": 14.2.11 12 + "next": 14.2.11 13 + "react": ^18 14 + "react-dom": ^18 15 + "typescript": ^5.5.4 16 + "wrangler": ^3.77.0 17 + 18 +