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

71 lines
2.6 KiB
YAML
Raw Normal View History

name: Run Blocks Playwright Tests
on:
pull_request:
paths:
- '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:
PlaywrightE2ETests:
name: Playwright E2E tests - ${{ matrix.config.name }}
timeout-minutes: 60
runs-on: ubuntu-latest
defaults:
run:
working-directory: plugins/woocommerce-blocks
strategy:
fail-fast: false
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
- name: BlockThemeWithTemplates
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`