Skip to content

E2e testing with Playwright #31

E2e testing with Playwright

E2e testing with Playwright #31

Workflow file for this run

name: Playwright Tests
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Set the version suffix for the output
run: echo VERSION_SUFFIX=${GITHUB_REF_NAME//\//-} >> $GITHUB_ENV
- name: Build Stackable Free Plugin
run: |
npm ci --legacy-peer-deps
npm run build:no-translate
- name: Install Playwright Browsers
run: npx playwright install chromium firefox webkit --with-deps
- name: Install wp-env
run: |
npm install -g @wordpress/env
- name: Start wp-env
run: wp-env start
- name: Run playwright tests
env:
WP_BASE_URL: http://localhost:8888
WP_AUTH_STORAGE: wp-auth.json
WP_USERNAME: admin
WP_PASSWORD: password
STACKABLE_SLUG: Stackable/plugin
run: npm run test
- uses: markpatterson27/markdown-to-output@v1
id: mto
if: ${{ !cancelled() }}
with:
filepath: ./playwright-errors/errors.md
- uses: initdc/upload-artifact@baac12d9f85834b2f8baa26a08ff97c27cc82cd9
id: upload-traces
if: ${{ !cancelled() }}
with:
artifact-per-file: true
artifact-name-rule: ${dir}-${name}${ext}
path: |
test-results/*/trace.zip
retention-days: 1
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
id: artifact-upload-step
with:
name: playwright-report-${{ env.VERSION_SUFFIX }}
path: playwright-report/
overwrite: true
retention-days: 30
- name: Find Comment
uses: peter-evans/find-comment@v3
if: ${{ !cancelled() }}
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Playwright Report Artifact
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v4
if: ${{ !cancelled() }}
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
${{ steps.mto.outputs.body }}
## Playwright Report Artifact
| file | commit |
| ---- | ------ |
| [playwright-report-${{ env.VERSION_SUFFIX }}.zip](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.artifact-upload-step.outputs.artifact-id }}) | ${{ github.sha }} |
edit-mode: replace