Skip to content

Commit 9496908

Browse files
Copilotmoufmouf
authored andcommitted
Migrate browser testing from airtap to vitest + playwright (#3)
* Migrate from airtap to vitest + playwright for browser testing * Add test screenshots to gitignore and remove them from git * Update CI workflow to keep browser testing optional * Fixing tests so they can run in both NodeJS and browsers * Run browser tests in CI * Upgrading to Node 20 (latest supported version)
1 parent 04d7a28 commit 9496908

File tree

11 files changed

+863
-5111
lines changed

11 files changed

+863
-5111
lines changed

.airtap.yml

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

.github/workflows/ci.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
os:
2222
- ubuntu-latest
2323
node:
24-
- '18'
24+
- '20'
2525
steps:
2626
- name: Install Setuptools for Python
2727
run: pip3 install setuptools
@@ -41,8 +41,12 @@ jobs:
4141
cache: 'pnpm'
4242

4343
- run: pnpm install --frozen-lockfile
44-
- run: echo "127.0.0.1 airtap.local" | sudo tee -a /etc/hosts
45-
- run: pnpm test
46-
env:
47-
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
48-
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
44+
45+
- name: Run Node.js tests
46+
run: pnpm test
47+
48+
- name: Install Playwright Browsers
49+
run: pnpm exec playwright install --with-deps chromium firefox webkit
50+
51+
- name: Run Playwright Browser Tests
52+
run: pnpm run test-browser-chromium

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules
33
package-lock.json
44
pnpm-lock.yaml
55
dist
6+
test/__screenshots__

package.json

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,27 @@
1919
"webrtc-polyfill": "^1.1.10"
2020
},
2121
"devDependencies": {
22-
"@babel/core": "^7.26.0",
23-
"@babel/preset-env": "^7.26.0",
22+
"@playwright/test": "^1.57.0",
2423
"@types/debug": "^4.1.12",
2524
"@types/node": "^24.10.2",
2625
"@types/streamx": "^2.9.5",
2726
"@types/webrtc": "^0.0.47",
2827
"@vitest/browser": "^4.0.15",
29-
"airtap": "^4.0.4",
30-
"airtap-manual": "^1.0.0",
31-
"airtap-system": "^0.1.0",
32-
"babelify": "^10.0.0",
28+
"@vitest/browser-playwright": "^4.0.15",
3329
"bowser": "^2.11.0",
30+
"buffer": "^6.0.3",
3431
"cross-env": "^7.0.3",
32+
"events": "^3.3.0",
3533
"happy-dom": "^20.0.11",
34+
"playwright": "^1.57.0",
3635
"prettier-bytes": "^1.0.4",
36+
"process": "^0.11.10",
3737
"speedometer": "^1.1.0",
38+
"stream-browserify": "^3.0.0",
3839
"string-to-stream": "^3.0.1",
3940
"thunky": "^1.1.0",
4041
"typescript": "^5.9.3",
42+
"util": "^0.12.5",
4143
"vite": "^7.2.7",
4244
"vitest": "^4.0.15",
4345
"ws": "^8.18.0"
@@ -88,8 +90,12 @@
8890
"test": "npm run build && vitest run",
8991
"test:watch": "vitest",
9092
"test-node": "vitest run",
91-
"test-browser": "airtap --concurrency 1 --all -- test/*.js test/browser/*.js | tap-spec",
92-
"test-browser-local": "airtap --preset local -- test/*.js | tap-spec"
93+
"test-browser": "npm run build && vitest run --config vitest.browser.config.ts",
94+
"test-browser-local": "npm run build && vitest --config vitest.browser.config.ts",
95+
"test-browser-all": "npm run test-browser-chromium && npm run test-browser-firefox && npm run test-browser-webkit",
96+
"test-browser-chromium": "npm run build && vitest run --config vitest.browser.config.ts --browser.name=chromium --browser.headless",
97+
"test-browser-firefox": "npm run build && vitest run --config vitest.browser.config.ts --browser.name=firefox --browser.headless",
98+
"test-browser-webkit": "npm run build && vitest run --config vitest.browser.config.ts --browser.name=webkit --browser.headless"
9399
},
94100
"contributors": [
95101
{

0 commit comments

Comments
 (0)