Skip to content

Commit 1377a9f

Browse files
Add playwright workflow
1 parent a51fa86 commit 1377a9f

File tree

7 files changed

+45
-30
lines changed

7 files changed

+45
-30
lines changed

.github/workflows/playwright.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Playwright Tests
2+
on:
3+
push:
4+
branches: [main, master]
5+
pull_request:
6+
branches: [main, master]
7+
jobs:
8+
test:
9+
timeout-minutes: 60
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: 18
16+
- name: Install dependencies
17+
run: pnpm install
18+
- name: Install Playwright Browsers
19+
run: pnpm playwright install --with-deps
20+
- name: Run Playwright tests
21+
run: pnpm test || exit 1
22+
- uses: actions/upload-artifact@v3
23+
if: always()
24+
with:
25+
name: playwright-report
26+
path: playwright-report/
27+
retention-days: 30

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@ dist/
55
*.log*
66
.vscode
77
*.swp
8-
*.swo
8+
*.swo
9+
10+
# playwright
11+
/test-results/
12+
/playwright-report/
13+
/playwright/.cache/

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
"scripts": {
1818
"build": "tsup",
1919
"dev": "tsup --watch",
20+
"test": "playwright test",
2021
"clean": "rm -rf ./dist",
2122
"prepublish": "yarn clean && yarn build"
2223
},
2324
"devDependencies": {
25+
"@playwright/test": "^1.37.0",
2426
"@types/react": "^18.2.14",
2527
"@types/react-dom": "^18.2.6",
2628
"react": "^18.2.0",

test/playwright.config.ts renamed to playwright.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { defineConfig, devices } from '@playwright/test'
1010
* See https://playwright.dev/docs/test-configuration.
1111
*/
1212
export default defineConfig({
13-
testDir: './tests',
13+
testDir: './test',
1414
/* Run tests in files in parallel */
1515
fullyParallel: true,
1616
/* Fail the build on CI if you accidentally left test.only in the source code. */
@@ -31,6 +31,7 @@ export default defineConfig({
3131
webServer: {
3232
command: 'yarn run dev',
3333
url: 'http://127.0.0.1:3000',
34+
cwd: './test',
3435
reuseExistingServer: !process.env.CI
3536
},
3637
/* Configure projects for major browsers */

pnpm-lock.yaml

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

test/.github/workflows/playwright.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

test/tsconfig.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
"@/*": ["./src/*"]
1919
}
2020
},
21-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
21+
"include": [
22+
"next-env.d.ts",
23+
"**/*.ts",
24+
"**/*.tsx",
25+
"../playwright.config.ts"
26+
],
2227
"exclude": ["node_modules"]
2328
}

0 commit comments

Comments
 (0)