Skip to content

Commit 6092c70

Browse files
add: parallel E2E test execution in CI
1 parent a96febb commit 6092c70

3 files changed

Lines changed: 90 additions & 1 deletion

File tree

.github/workflows/e2e-tests.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
- e2e:test:critical
1616
- e2e:test:stress
1717
- e2e:test:all
18+
- e2e:test:all:parallel
1819
XRAY_TEST_EXEC_KEY:
1920
description: 'Xray Test Execution Key'
2021
required: false
@@ -41,6 +42,7 @@ jobs:
4142

4243
e2e-playwright:
4344
name: Run Playwright E2E Tests
45+
if: ${{ inputs.TEST_SUITE != 'e2e:test:all:parallel' }}
4446
needs: build
4547
uses: inpsyde/reusable-workflows/.github/workflows/test-playwright.yml@fix/test-playwright
4648
with:
@@ -75,3 +77,51 @@ jobs:
7577
ENV_FILE_DATA: ${{ secrets.QA_ENV_FILE }}
7678
NPM_REGISTRY_TOKEN: ${{ secrets.DEPLOYBOT_GITHUB_TOKEN_PACKAGES }}
7779
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
85+
strategy:
86+
fail-fast: false
87+
matrix:
88+
shard:
89+
- plugin-foundation
90+
- onboarding-settings
91+
- transactions
92+
- refund
93+
- vaulting
94+
- subscription
95+
uses: inpsyde/reusable-workflows/.github/workflows/test-playwright.yml@fix/test-playwright
96+
with:
97+
WORK_DIR: tests/qa
98+
PLAYWRIGHT_SCRIPT: e2e:test:shard:${{ matrix.shard }}
99+
ARTIFACT_PATH: |
100+
tests/qa/artifacts/*
101+
tests/qa/playwright-report/
102+
tests/qa/test-results/
103+
ARTIFACT_INCLUDE_HIDDEN_FILES: true
104+
NODE_VERSION: 22
105+
PLAYWRIGHT_BROWSER_ARGS: 'chromium --with-deps'
106+
XRAY_TEST_EXEC_KEY: ${{ inputs.XRAY_TEST_EXEC_KEY }}
107+
PRE_SCRIPT: |
108+
# 1. Download and unzip the built plugin
109+
gh run download ${{ github.run_id }} -p "woocommerce-paypal-payments-*" -D resources/files
110+
pushd resources/files
111+
mv woocommerce-paypal-payments-*/woocommerce-paypal-payments .
112+
zip -r woocommerce-paypal-payments.zip woocommerce-paypal-payments
113+
rm -rf woocommerce-paypal-payments woocommerce-paypal-payments-*/
114+
popd
115+
116+
# 2. Add private composer repository and download WooCommerce Subscriptions
117+
pushd ../../
118+
composer config repositories.repo-name composer https://repo.packagist.com/inpsyde/payment-gateways/
119+
composer require inpsyde-mirror/woocommerce-subscriptions
120+
popd
121+
122+
# 3. Setup wp-env
123+
npm run e2e:setup:env
124+
secrets:
125+
ENV_FILE_DATA: ${{ secrets.QA_ENV_FILE }}
126+
NPM_REGISTRY_TOKEN: ${{ secrets.DEPLOYBOT_GITHUB_TOKEN_PACKAGES }}
127+
COMPOSER_AUTH_JSON: ${{ secrets.COMPOSER_AUTH_JSON }}

tests/qa/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@
5454
"env:setup:checkout:block": "npx playwright test --grep=\"setup:checkout:block;\"",
5555
"env:setup:checkout:classic": "npx playwright test --grep=\"setup:checkout:classic;\"",
5656
"env:setup:tax:inc": "npx playwright test --grep=\"setup:tax:inc;\"",
57-
"env:setup:tax:exc": "npx playwright test --grep=\"setup:tax:exc;\""
57+
"env:setup:tax:exc": "npx playwright test --grep=\"setup:tax:exc;\"",
58+
59+
"e2e:test:shard:plugin-foundation": "npx playwright test --project \"shard:plugin-foundation\"",
60+
"e2e:test:shard:onboarding-settings": "npx playwright test --project \"shard:onboarding-settings\"",
61+
"e2e:test:shard:transactions": "npx playwright test --project \"shard:transactions\"",
62+
"e2e:test:shard:refund": "npx playwright test --project \"shard:refund\"",
63+
"e2e:test:shard:vaulting": "npx playwright test --project \"shard:vaulting\"",
64+
"e2e:test:shard:subscription": "npx playwright test --project \"shard:subscription\""
5865
},
5966
"eslintConfig": {
6067
"extends": [

tests/qa/playwright.config.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,37 @@ export default defineConfig< BaseExtend >( {
139139
dependencies: [ 'setup-woocommerce' ],
140140
testMatch: /stress\.spec\.ts/,
141141
},
142+
143+
// Parallel CI
144+
{
145+
name: 'shard:plugin-foundation',
146+
dependencies: [ 'setup-woocommerce' ],
147+
testMatch: /01-plugin-foundation\/.*\.spec\.ts/,
148+
},
149+
{
150+
name: 'shard:onboarding-settings',
151+
dependencies: [ 'setup-woocommerce' ],
152+
testMatch: /(02-onboarding|03-plugin-settings)\/.*\.spec\.ts/,
153+
},
154+
{
155+
name: 'shard:transactions',
156+
dependencies: [ 'setup-woocommerce' ],
157+
testMatch: /05-transactions\/.*\.spec\.ts/,
158+
},
159+
{
160+
name: 'shard:refund',
161+
dependencies: [ 'setup-woocommerce' ],
162+
testMatch: /06-refund\/.*\.spec\.ts/,
163+
},
164+
{
165+
name: 'shard:vaulting',
166+
dependencies: [ 'setup-woocommerce' ],
167+
testMatch: /07-vaulting\/.*\.spec\.ts/,
168+
},
169+
{
170+
name: 'shard:subscription',
171+
dependencies: [ 'setup-woocommerce' ],
172+
testMatch: /08-subscription\/.*\.spec\.ts/,
173+
},
142174
],
143175
} );

0 commit comments

Comments
 (0)