Skip to content

Commit e2613a2

Browse files
bfintalcursoragent
andcommitted
Add GitHub Actions workflow to run Playwright e2e tests
The PR check only built the plugin but never executed the e2e suite added in e2e/. This spins up wp-env, builds the plugin, and runs Playwright against the test WordPress instance on every push/PR to master and develop. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent f682c96 commit e2613a2

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

‎.github/workflows/e2e-tests.yml‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: E2E Tests
2+
3+
on:
4+
push:
5+
branches: [ master, develop ]
6+
pull_request:
7+
branches: [ master, develop ]
8+
9+
jobs:
10+
e2e:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Check out
15+
uses: actions/checkout@v4
16+
17+
- name: Use Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '20'
21+
cache: npm
22+
23+
- name: Install dependencies
24+
run: npm ci --legacy-peer-deps
25+
26+
- name: Build plugin for e2e testing
27+
run: npm run build:e2e
28+
29+
- name: Install Playwright browsers
30+
run: npx playwright install --with-deps chromium
31+
32+
- name: Start WordPress environment
33+
run: npx wp-env start
34+
35+
- name: Create .env file for Playwright
36+
run: |
37+
cat <<EOF > .env
38+
WP_BASE_URL=http://localhost:8889
39+
WP_AUTH_STORAGE=wp-auth.json
40+
WP_USERNAME=admin
41+
WP_PASSWORD=password
42+
CIMO_SLUG=Cimo/cimo
43+
EOF
44+
45+
- name: Run Playwright e2e tests
46+
run: npm run test
47+
48+
- name: Upload Playwright report
49+
if: always()
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: playwright-report
53+
path: playwright-report/
54+
retention-days: 14
55+
56+
- name: Print WordPress logs on failure
57+
if: failure()
58+
run: npx wp-env logs

0 commit comments

Comments
 (0)