2023-12-15 17:34:29 +00:00
|
|
|
name: Run Blocks Playwright Tests
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- '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:
|
|
|
|
PlaywrightE2ETests:
|
|
|
|
name: Playwright E2E tests - ${{ matrix.config.name }}
|
|
|
|
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-02-15 17:27:17 +00:00
|
|
|
- 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
|
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`
|