Skip to content

chore: automated tests #4

chore: automated tests

chore: automated tests #4

Workflow file for this run

name: Playwright
on:
pull_request:
types: [labeled, synchronize, opened, reopened]
push:
branches:
- 'core'
paths-ignore:
- '**.md'
- '**.txt'
- '.gitignore'
- 'docs/**'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
actions: read
concurrency:
group: playwright-${{ github.event_name }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build-plugin:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
name: Build plugin
uses: ./.github/workflows/build.yml
Playwright:
name: Playwright test on PHP 8.1
runs-on: ubuntu-22.04
needs: [build-plugin]
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: |
npm run prepare-environment:ci
cd src && composer install
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.build-plugin.outputs.artifact_name }}
path: ./build
- name: Start WordPress environment
run: |
npx wp-env start
- name: Setup test data
run: npx wp-env run cli wp plugin activate code-snippets
- name: WordPress debug information
run: |
npx wp-env run cli wp core version
npx wp-env run cli wp --info
- name: Install playwright/test
run: |
npx playwright install chromium
- name: Run Playwright tests
run: npm run test:playwright
- name: Stop WordPress environment
if: always()
run: npx wp-env stop
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-test-results
path: test-results/
if-no-files-found: ignore
retention-days: 2
test-result:
needs: [Playwright]
if: always() && (needs.Playwright.result != 'skipped')
runs-on: ubuntu-22.04
name: Playwright - Test Results
steps:
- name: Test status
run: echo "Test status is - ${{ needs.Playwright.result }}"
- name: Check Playwright status
if: ${{ needs.Playwright.result != 'success' && needs.Playwright.result != 'skipped' }}
run: exit 1