Skip to content

Commit 4262902

Browse files
refactor: resolve E2E Playwright matrix in one job
1 parent 6092c70 commit 4262902

1 file changed

Lines changed: 22 additions & 50 deletions

File tree

.github/workflows/e2e-tests.yml

Lines changed: 22 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -40,62 +40,34 @@ jobs:
4040
PACKAGE_NAME: woocommerce-paypal-payments
4141
NODE_VERSION: 22
4242

43-
e2e-playwright:
44-
name: Run Playwright E2E Tests
45-
if: ${{ inputs.TEST_SUITE != 'e2e:test:all:parallel' }}
46-
needs: build
47-
uses: inpsyde/reusable-workflows/.github/workflows/test-playwright.yml@fix/test-playwright
48-
with:
49-
WORK_DIR: tests/qa
50-
PLAYWRIGHT_SCRIPT: ${{ inputs.TEST_SUITE }}
51-
ARTIFACT_PATH: |
52-
tests/qa/artifacts/*
53-
tests/qa/playwright-report/
54-
tests/qa/test-results/
55-
ARTIFACT_INCLUDE_HIDDEN_FILES: true
56-
NODE_VERSION: 22
57-
PLAYWRIGHT_BROWSER_ARGS: 'chromium --with-deps'
58-
XRAY_TEST_EXEC_KEY: ${{ inputs.XRAY_TEST_EXEC_KEY }}
59-
PRE_SCRIPT: |
60-
# 1. Download and unzip the built plugin
61-
gh run download ${{ github.run_id }} -p "woocommerce-paypal-payments-*" -D resources/files
62-
pushd resources/files
63-
mv woocommerce-paypal-payments-*/woocommerce-paypal-payments .
64-
zip -r woocommerce-paypal-payments.zip woocommerce-paypal-payments
65-
rm -rf woocommerce-paypal-payments woocommerce-paypal-payments-*/
66-
popd
67-
68-
# 2. Add private composer repository and download WooCommerce Subscriptions
69-
pushd ../../
70-
composer config repositories.repo-name composer https://repo.packagist.com/inpsyde/payment-gateways/
71-
composer require inpsyde-mirror/woocommerce-subscriptions
72-
popd
43+
resolve-playwright-matrix:
44+
name: Resolve Playwright matrix
45+
runs-on: ubuntu-latest
46+
outputs:
47+
matrix: ${{ steps.resolve.outputs.matrix }}
48+
steps:
49+
- name: Resolve test scripts
50+
id: resolve
51+
shell: bash
52+
run: |
53+
if [[ '${{ inputs.TEST_SUITE }}' == 'e2e:test:all:parallel' ]]; then
54+
echo 'matrix={"include":[{"script":"e2e:test:shard:plugin-foundation","name_suffix":" / plugin-foundation"},{"script":"e2e:test:shard:onboarding-settings","name_suffix":" / onboarding-settings"},{"script":"e2e:test:shard:transactions","name_suffix":" / transactions"},{"script":"e2e:test:shard:refund","name_suffix":" / refund"},{"script":"e2e:test:shard:vaulting","name_suffix":" / vaulting"},{"script":"e2e:test:shard:subscription","name_suffix":" / subscription"}]}' >> "$GITHUB_OUTPUT"
55+
else
56+
echo 'matrix={"include":[{"script":"${{ inputs.TEST_SUITE }}","name_suffix":""}]}' >> "$GITHUB_OUTPUT"
57+
fi
7358
74-
# 3. Setup wp-env
75-
npm run e2e:setup:env
76-
secrets:
77-
ENV_FILE_DATA: ${{ secrets.QA_ENV_FILE }}
78-
NPM_REGISTRY_TOKEN: ${{ secrets.DEPLOYBOT_GITHUB_TOKEN_PACKAGES }}
79-
COMPOSER_AUTH_JSON: ${{ secrets.COMPOSER_AUTH_JSON }}
80-
81-
e2e-playwright-parallel:
82-
name: Run Playwright E2E Tests / ${{ matrix.shard }}
83-
if: ${{ inputs.TEST_SUITE == 'e2e:test:all:parallel' }}
84-
needs: build
59+
e2e-playwright:
60+
name: Run Playwright E2E Tests${{ matrix.name_suffix }}
61+
needs:
62+
- build
63+
- resolve-playwright-matrix
8564
strategy:
8665
fail-fast: false
87-
matrix:
88-
shard:
89-
- plugin-foundation
90-
- onboarding-settings
91-
- transactions
92-
- refund
93-
- vaulting
94-
- subscription
66+
matrix: ${{ fromJson(needs.resolve-playwright-matrix.outputs.matrix) }}
9567
uses: inpsyde/reusable-workflows/.github/workflows/test-playwright.yml@fix/test-playwright
9668
with:
9769
WORK_DIR: tests/qa
98-
PLAYWRIGHT_SCRIPT: e2e:test:shard:${{ matrix.shard }}
70+
PLAYWRIGHT_SCRIPT: ${{ matrix.script }}
9971
ARTIFACT_PATH: |
10072
tests/qa/artifacts/*
10173
tests/qa/playwright-report/

0 commit comments

Comments
 (0)