Skip to content

Upgrade @wp-playground/client to v3 for PHP 8.5 support #97

Upgrade @wp-playground/client to v3 for PHP 8.5 support

Upgrade @wp-playground/client to v3 for PHP 8.5 support #97

Workflow file for this run

name: Playwright Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# Run 3 times a week: Monday, Wednesday, Friday at 9 AM UTC
- cron: '0 9 * * 1,3,5'
workflow_dispatch:
jobs:
playwright:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup PHP
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
- name: Install PHP Dependencies
if: github.event_name == 'push' || github.event_name == 'pull_request'
run: |
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
cp .env.example .env
php artisan key:generate
- name: Install Node.js Dependencies and Build Assets
run: npm ci && npm run build
- name: Install Playwright Browsers
run: npx playwright install chromium --with-deps
- name: Install npm dependencies (production tests)
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
run: npm ci
- name: Start server and run tests (local)
if: github.event_name == 'push' || github.event_name == 'pull_request'
run: |
php artisan serve &
for i in {1..15}; do
if [[ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8000)" == "200" ]]; then
echo "Server is up with 200 response!"
break
fi
echo "Waiting for server to start..."
sleep 2
done
npx playwright test
- name: Run tests (production)
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
run: npm run playwright:prod
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Notify Slack on failure
if: failure() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
uses: slackapi/slack-github-action@v1
with:
payload: |
{
"text": "Playwright tests failed in ${{ github.repository }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "❌ *Playwright Tests Failed*\n*Repository:* ${{ github.repository }}\n*Branch:* ${{ github.ref_name }}\n*Workflow:* ${{ github.workflow }}\n*Run:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}