woocommerce/plugins/woocommerce-blocks/.github/workflows/playwright.yml

65 lines
1.6 KiB
YAML

name: Playwright Tests
on:
push:
branches: [ trunk ]
pull_request:
jobs:
PlaywrightE2ETests:
name: Playwright E2E tests
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup node version and npm cache
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install Node dependencies
run: npm ci
- name: Build Assets
run: FORCE_REDUCED_MOTION=true npm run build
- name: blocks.ini setup
run: |
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
tools: composer
- name: Composer install
run: composer install
- name: Install Playwright
run: npx playwright install --with-deps
- name: Load wp-env
run: npm run env:start
- name: Run Playwright tests
run: npm run test:e2e-pw
- uses: actions/upload-artifact@v3
with:
name: playwright-report
path: ./tests/e2e-pw/artifacts/test-results