Skip to content

- add composer install step to the workflow #2

- add composer install step to the workflow

- add composer install step to the workflow #2

name: GraphiQL End-to-End Tests
on:
push:
branches:
- develop
- master
pull_request:
branches:
- develop
- master
paths:
- '**.js'
- '.github/workflows/*.yml'
- '!docs/**'
jobs:
e2e-tests:
name: E2E tests on Node ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Setup PHP
uses: shivammathur/setup-php@v2

Check failure on line 34 in .github/workflows/graphiql-e2e-tests.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/graphiql-e2e-tests.yml

Invalid workflow file

You have an error in your yaml syntax on line 34
with:
php-version: 7.4
extensions: mbstring, intl
tools: composer
- name: Install PHP dependencies
run: |
composer install --optimize-autoloader
- name: Install JavaScript dependencies
run: npm ci
- name: Build Assets
run: npm run build
- name: Install Playwright dependencies
run: |
npx playwright install chromium firefox webkit --with-deps
- name: Start WordPress Environment
run: npm run wp-env -- start
- name: Run E2E tests
run: npm run test:e2e
continue-on-error: true # This allows the workflow to continue even if this step fails, so that screenshots can be collected.
- name: List Screenshots
if: always() # Ensures this step always runs for diagnostic purposes
run: |
echo "Listing contents of artifacts/test-results/"
ls -R artifacts/test-results/ || echo "No screenshots directory found"
- name: Check for Screenshots and Upload if Present
if: always() # This ensures the step runs regardless of previous success/failure
run: |
if [ -d artifacts/test-results/ ] && [ "$(ls -A artifacts/test-results/)" ]; then
echo "Screenshots found, uploading..."
echo "::set-output name=upload_screenshots::true"
else
echo "No screenshots found, skipping upload."
echo "::set-output name=upload_screenshots::false"
fi
id: check_screenshots
- name: Upload Screenshots on Failure
if: always() # This ensures that the following steps are only run if the previous step fails.
uses: actions/upload-artifact@v4
with:
name: failed-test-screenshots
path: artifacts/test-results/
compression-level: 1
if-no-files-found: warn
retention-days: 1
overwrite: true
- name: Stop WordPress Environment
run: npm run wp-env -- stop