2023-12-15 17:34:29 +00:00
|
|
|
name: Run Blocks Playwright Tests
|
2024-03-07 19:32:58 +00:00
|
|
|
|
2023-12-15 17:34:29 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths:
|
2024-03-07 19:32:58 +00:00
|
|
|
- '.github/workflows/blocks-playwright.yml' # This file
|
2023-12-15 17:34:29 +00:00
|
|
|
- 'plugins/woocommerce-blocks/**'
|
|
|
|
- 'plugins/woocommerce/src/Blocks/**'
|
|
|
|
- 'plugins/woocommerce/templates/**'
|
|
|
|
- 'plugins/woocommerce/patterns/**'
|
2024-03-07 13:01:22 +00:00
|
|
|
# Allow manually triggering the workflow.
|
|
|
|
workflow_dispatch:
|
|
|
|
|
2023-12-15 17:34:29 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
FORCE_COLOR: 1
|
|
|
|
|
|
|
|
jobs:
|
2024-03-07 13:32:29 +00:00
|
|
|
e2e:
|
|
|
|
name: ${{ matrix.config.name }} [${{ matrix.shards.name }}]
|
2023-12-15 17:34:29 +00:00
|
|
|
timeout-minutes: 60
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: plugins/woocommerce-blocks
|
|
|
|
strategy:
|
2024-02-15 17:27:17 +00:00
|
|
|
fail-fast: false
|
2023-12-15 17:34:29 +00:00
|
|
|
matrix:
|
|
|
|
config:
|
2024-03-07 13:32:29 +00:00
|
|
|
- name: Default (Block) Theme
|
2024-02-15 17:27:17 +00:00
|
|
|
file: playwright.config.ts
|
|
|
|
resultPath: test-results
|
2024-03-07 13:32:29 +00:00
|
|
|
- name: Classic Theme
|
2024-02-15 17:27:17 +00:00
|
|
|
file: playwright.classic-theme.config.ts
|
|
|
|
resultPath: test-results-classic-theme
|
2024-03-07 13:32:29 +00:00
|
|
|
- name: Side Effects
|
2024-02-15 17:27:17 +00:00
|
|
|
file: playwright.side-effects.config.ts
|
|
|
|
resultPath: test-results-side-effects
|
2024-03-07 13:32:29 +00:00
|
|
|
- name: Block Theme With Templates
|
2024-02-15 17:27:17 +00:00
|
|
|
file: playwright.block-theme-with-templates.config.ts
|
|
|
|
resultPath: test-results-block-theme-with-templates
|
2024-03-06 16:52:37 +00:00
|
|
|
shards:
|
|
|
|
- name: 1/5
|
|
|
|
- name: 2/5
|
|
|
|
- name: 3/5
|
|
|
|
- name: 4/5
|
|
|
|
- name: 5/5
|
2023-12-15 17:34:29 +00:00
|
|
|
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
|
2024-03-06 16:52:37 +00:00
|
|
|
run: pnpm playwright test --config=tests/e2e/${{ matrix.config.file }} --shard ${{ matrix.shards.name }}
|
2023-12-15 17:34:29 +00:00
|
|
|
|
|
|
|
- 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`
|