E2e testing with Playwright #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 --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 | |
- name: Zip Playwright Report | |
uses: montudor/action-zip@v1 | |
with: | |
args: zip -qq -r playwright-report-${{ env.VERSION_SUFFIX }}.zip playwright-report | |
- name: Upload Playwright report artifact | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: gavv/[email protected] | |
with: | |
commit: ${{ github.event.pull_request.head.sha }} | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts: playwright-report-${{ env.VERSION_SUFFIX }}.zip | |
artifacts-branch: artifacts |