Skip to content

Commit 0a0b629

Browse files
committed
Add Playwright
1 parent 83b6e74 commit 0a0b629

File tree

3 files changed

+97
-22
lines changed

3 files changed

+97
-22
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"lint:docs:ci": "eslint --ignore-path .gitignore src/pages/learn --format eslint-formatter-github",
1818
"postbuild": "next-sitemap",
1919
"prebuild": "tsx src/get-github-info.ts",
20-
"test": "echo \"no tests\" && exit 1",
20+
"test": "playwright test",
21+
"test:ui": "playwright test --ui",
2122
"validate:snippets": "node scripts/validate-snippets.js"
2223
},
2324
"dependencies": {
@@ -75,6 +76,7 @@
7576
"devDependencies": {
7677
"@graphql-eslint/eslint-plugin": "4.3.0",
7778
"@next/eslint-plugin-next": "^15.3.3",
79+
"@playwright/test": "^1.54.2",
7880
"@svgr/webpack": "^8.1.0",
7981
"@types/codemirror": "5.60.16",
8082
"@types/hast": "3.0.4",
@@ -90,6 +92,7 @@
9092
"eslint-plugin-react": "^7.37.5",
9193
"eslint-plugin-react-hooks": "^5.2.0",
9294
"eslint-plugin-tailwindcss": "3.17.5",
95+
"playwright": "^1.54.2",
9396
"prettier": "3.5.3",
9497
"prettier-plugin-pkg": "^0.20.0",
9598
"prettier-plugin-tailwindcss": "^0.6.12",

playwright.config.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { defineConfig, devices } from "@playwright/test"
2+
3+
/**
4+
* @see https://playwright.dev/docs/test-configuration
5+
*/
6+
export default defineConfig({
7+
testDir: "./test/e2e",
8+
fullyParallel: true,
9+
forbidOnly: !!process.env.CI,
10+
retries: process.env.CI ? 2 : 0,
11+
workers: process.env.CI ? 1 : undefined,
12+
reporter: "html",
13+
use: {
14+
baseURL: "http://localhost:3000",
15+
trace: "on-first-retry",
16+
},
17+
18+
projects: [
19+
{
20+
name: "chromium",
21+
use: { ...devices["Desktop Chrome"] },
22+
},
23+
],
24+
25+
webServer: {
26+
command: "pnpm dev",
27+
url: "http://localhost:3000",
28+
reuseExistingServer: !process.env.CI,
29+
},
30+
})

pnpm-lock.yaml

Lines changed: 63 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)