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

73 lines
2.7 KiB
YAML
Raw Normal View History

name: Run Blocks Playwright Tests
on:
pull_request:
paths:
- '.github/workflows/blocks-playwright.yml' # This file
- 'plugins/woocommerce-blocks/**'
- 'plugins/woocommerce/src/Blocks/**'
- 'plugins/woocommerce/templates/**'
- 'plugins/woocommerce/patterns/**'
# Allow manually triggering the workflow.
workflow_dispatch:
env:
FORCE_COLOR: 1
jobs:
e2e:
name: ${{ matrix.config.name }} [${{ matrix.shards.name }}]
timeout-minutes: 60
runs-on: ubuntu-latest
defaults:
run:
working-directory: plugins/woocommerce-blocks
strategy:
fail-fast: false
matrix:
config:
- name: Default (Block) Theme
file: playwright.config.ts
resultPath: test-results
- name: Classic Theme
file: playwright.classic-theme.config.ts
resultPath: test-results-classic-theme
- name: Side Effects
file: playwright.side-effects.config.ts
resultPath: test-results-side-effects
- name: Block Theme With Templates
file: playwright.block-theme-with-templates.config.ts
resultPath: test-results-block-theme-with-templates
shards:
- name: 1/5
- name: 2/5
- name: 3/5
- name: 4/5
- name: 5/5
steps:
- uses: actions/checkout@v3
- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
with:
install: '@woocommerce/plugin-woocommerce...'
build: '@woocommerce/plugin-woocommerce'
- name: Install Playwright
run: pnpm --filter='@woocommerce/block-library' exec playwright install --with-deps
- name: Start wp-env
run: pnpm --filter='@woocommerce/block-library' env:start
- name: Run Playwright tests
working-directory: plugins/woocommerce-blocks
run: pnpm playwright test --config=tests/e2e/${{ matrix.config.file }} --shard ${{ matrix.shards.name }}
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: playwright-report-${{ matrix.config.name }}
path: plugins/woocommerce-blocks/tests/e2e/artifacts/${{ matrix.config.resultPath }}
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`