This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
e2e: Add hacky workaround for product image gallery #6785
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Playwright Tests | |
on: | |
push: | |
branches: [ trunk ] | |
pull_request: | |
jobs: | |
PlaywrightE2ETests: | |
name: Playwright E2E tests - ${{ matrix.config.name }} | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
config: [ | |
{ name: Normal, file: playwright.config.ts, resultPath: test-results }, | |
{ name: Classic, file: playwright.classic-theme.config.ts, resultPath: test-results-classic-theme }, | |
{ name: SideEffects, file: playwright.side-effects.config.ts, resultPath: test-results-side-effects }, | |
] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache node_modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-modified-build-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-modified-build-${{ env.cache-name }}- | |
${{ runner.os }}-modified-build- | |
${{ runner.os }}-modified- | |
- name: Setup node version and npm cache | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- name: Install Node dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
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 -- --config=tests/e2e/${{ matrix.config.file }} | |
- uses: actions/upload-artifact@v3 | |
if: ${{ failure() }} | |
with: | |
name: playwright-report-${{ matrix.config.name }} | |
path: artifacts/${{ matrix.config.resultPath }} | |
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` | |