Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 106a6ef

Browse files
committed
feat(package*): add @playwright/test
1 parent f0907ac commit 106a6ef

File tree

3 files changed

+110
-4
lines changed

3 files changed

+110
-4
lines changed

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@
99
"main": "dist/core/index.js",
1010
"typings": "dist/core/index.d.ts",
1111
"scripts": {
12-
"compiler": "tsc --noEmit ./compiler/src/index.ts && tsx ./compiler/src/index.ts"
12+
"compiler": "tsc --noEmit ./compiler/src/index.ts && tsx ./compiler/src/index.ts",
13+
"dev": "next dev",
14+
"dev:e2e": "cd e2e/site && npm run dev -- -p 4000",
15+
"test:e2e": "playwright test"
1316
},
1417
"dependencies": {
1518
"fast-glob": "^3.3.2",
1619
"tsx": "^4.15.7"
1720
},
1821
"devDependencies": {
19-
"typescript": "^5.4.5",
20-
"@types/react": "^18.3.3",
22+
"@playwright/test": "^1.46.0",
23+
"@types/css-modules": "^1.0.5",
2124
"@types/node": "^20.12.13",
22-
"@types/css-modules": "^1.0.5"
25+
"@types/react": "^18.3.3",
26+
"typescript": "^5.4.5"
2327
}
2428
}

playwright.config.ts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { defineConfig, devices } from '@playwright/test';
2+
3+
export default defineConfig({
4+
webServer: {
5+
command: 'pnpm next dev e2e/site --port 4000',
6+
reuseExistingServer: !process.env.CI,
7+
port: 4000,
8+
},
9+
testDir: './e2e',
10+
/* Run tests in files in parallel */
11+
fullyParallel: true,
12+
/* Fail the build on CI if you accidentally left test.only in the source code. */
13+
forbidOnly: !!process.env.CI,
14+
/* Retry on CI only */
15+
retries: process.env.CI ? 2 : 0,
16+
/* Opt out of parallel tests on CI. */
17+
workers: process.env.CI ? 1 : undefined,
18+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
19+
reporter: 'html',
20+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
21+
use: {
22+
/* Base URL to use in actions like `await page.goto('/')`. */
23+
baseURL: 'http://localhost:4000',
24+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
25+
trace: 'on-first-retry',
26+
},
27+
28+
/* Configure projects for major browsers */
29+
projects: [
30+
{
31+
name: 'chromium',
32+
use: { ...devices['Desktop Chrome'] },
33+
},
34+
35+
{
36+
name: 'firefox',
37+
use: { ...devices['Desktop Firefox'] },
38+
},
39+
40+
{
41+
name: 'webkit',
42+
use: { ...devices['Desktop Safari'] },
43+
},
44+
45+
/* Test against mobile viewports. */
46+
{
47+
name: 'Mobile Chrome',
48+
use: { ...devices['Pixel 5'] },
49+
},
50+
{
51+
name: 'Mobile Safari',
52+
use: { ...devices['iPhone 12'] },
53+
},
54+
55+
/* Test against branded browsers. */
56+
{
57+
name: 'Microsoft Edge',
58+
use: { ...devices['Desktop Edge'], channel: 'msedge' },
59+
},
60+
{
61+
name: 'Google Chrome',
62+
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
63+
},
64+
],
65+
66+
/* Run your local dev server before starting the tests */
67+
});

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)