Skip to content

E2e testing with Playwright #42

E2e testing with Playwright

E2e testing with Playwright #42

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
strategy:
fail-fast: false # Ensures the matrix doesn't stop if one job fails
matrix:
include:
- php_version: 7.0
wp_version: 6.4
- php_version: 7.3
wp_version: null
- php_version: 8.2
wp_version: 6.4.5
- php_version: 8.2
wp_version: 6.5.5
- php_version: 8.2
wp_version: 6.6.2
- php_version: 8.2
wp_version: null
name: PHP ${{ matrix.php_version }} and WP ${{ matrix.wp_version || '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: Set WP Version and create .wp-env.json
run: |
WP_VERSION="${{ matrix.wp_version }}"
core='"Wordpress/Wordpress#'${{ matrix.wp_version }}'"'
if [[ -z "$WP_VERSION" || "$WP_VERSION" == "null" ]]; then
WP_VERSION="latest"
core=null
fi
echo "WP_VERSION=$WP_VERSION" >> $GITHUB_ENV
echo '{
"core": '$core',
"phpVersion": "${{ matrix.php_version }}",
"plugins": [ "." ],
"config": {
"SCRIPT_DEBUG": false
}
}' > .wp-env.json
cat .wp-env.json
- 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 --with-deps
- name: Install wp-env
run: |
npm install -g @wordpress/env
- name: Start wp-env
run: wp-env start
- name: Get PHP and WordPress versions
run: |
docker ps
wp-env logs
- name: Run playwright tests
if: ${{ !cancelled() }}
env:
WP_BASE_URL: http://localhost:8889
WP_AUTH_STORAGE: wp-auth.json
WP_USERNAME: admin
WP_PASSWORD: password
STACKABLE_SLUG: Stackable/plugin
run: npm run test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
id: artifact-upload-step
with:
name: playwright-report-php_${{ matrix.php_version }}-wp_${{ env.WP_VERSION }}-${{ env.VERSION_SUFFIX }}
path: playwright-report/
overwrite: true
retention-days: 30