Files
wp-plugin-starter-template-…/.github/workflows/playground-tests-fix.yml

62 lines
1.6 KiB
YAML

name: WordPress Playground Tests Fix
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
playground-test:
name: WordPress Playground Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Add WordPress Playground CLI to dependencies
run: npm install --save-dev @wp-playground/cli
- name: Create plugin zip
uses: ./.github/actions/create-plugin-zip
- name: Run tests with WordPress Playground
run: |
# Set base URL for Cypress
export CYPRESS_BASE_URL=http://localhost:8888
# Start WordPress Playground with our blueprint
npx @wp-playground/cli server --blueprint playground/blueprint.json --port 8888 --login &
# Wait for WordPress Playground to be ready
echo "Waiting for WordPress Playground to be ready..."
timeout 60 bash -c 'until curl -s http://localhost:8888; do sleep 2; done'
# Run Cypress tests against WordPress Playground
npx cypress run --spec "cypress/e2e/playground-single-site.cy.js"
- name: Upload Cypress artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-playground-results
path: |
cypress/videos
cypress/screenshots