11name : E2E Tests
22
33on :
4+ workflow_run :
5+ workflows : [ "Build and distribute" ]
6+ types : [ completed ]
7+ branches : [ dev/develop ]
48 workflow_dispatch :
59 inputs :
610 TEST_SUITE :
711 description : ' Test suite'
812 required : true
9- default : ' e2e:test:dev '
13+ default : ' smoke:parallel '
1014 type : choice
1115 options :
12- - e2e:test:plugin-foundation
13- - e2e:test:dev
14- - e2e:test:smoke
15- - e2e:test:critical
16- - e2e:test:stress
17- - e2e:test:all
16+ - all:parallel
17+ - smoke:parallel
18+ - critical:parallel
19+ - shard:plugin-foundation
20+ - shard:onboarding
21+ - shard:settings
22+ - shard:transaction-usa
23+ - shard:transaction-mexico
24+ - shard:transaction-germany
25+ - shard:refund
26+ - shard:vaulting
27+ - shard:subscription
28+ - stress
1829 XRAY_TEST_EXEC_KEY :
1930 description : ' Xray Test Execution Key'
2031 required : false
2132 default : ' '
2233 type : string
2334
2435concurrency :
25- group : ${{ github.workflow }}-${{ github.ref }}
36+ group : ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github. ref }}
2637 cancel-in-progress : true
2738
2839jobs :
2940 build :
3041 name : Build tested plugin package
42+ if : >-
43+ github.event_name == 'workflow_dispatch' ||
44+ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
3145 uses : inpsyde/reusable-workflows/.github/workflows/build-and-distribute.yml@main
3246 secrets :
3347 GITHUB_USER_EMAIL : ${{ secrets.DEPLOYBOT_EMAIL }}
@@ -39,38 +53,87 @@ jobs:
3953 PACKAGE_NAME : woocommerce-paypal-payments
4054 NODE_VERSION : 22
4155
56+ resolve-playwright-matrix :
57+ name : Resolve Playwright matrix
58+ runs-on : ubuntu-latest
59+ if : >-
60+ github.event_name == 'workflow_dispatch' ||
61+ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
62+ outputs :
63+ matrix : ${{ steps.resolve.outputs.matrix }}
64+ steps :
65+ - name : Resolve test scripts
66+ id : resolve
67+ shell : bash
68+ run : |
69+ SHARDS=(
70+ plugin-foundation
71+ onboarding
72+ settings
73+ transaction-usa
74+ transaction-mexico
75+ transaction-germany
76+ refund
77+ vaulting
78+ subscription
79+ )
80+
81+ TEST_SUITE='${{ inputs.TEST_SUITE || 'smoke:parallel' }}'
82+
83+ if [[ "$TEST_SUITE" == *':parallel' ]]; then
84+ SUFFIX=""
85+ [[ "$TEST_SUITE" != "all:parallel" ]] && SUFFIX=":${TEST_SUITE%:parallel}"
86+
87+ entry() { echo "{\"script\":\"e2e:test:shard:${1}${SUFFIX}\",\"name_suffix\":\" / ${1}\",\"artifact_name\":\"playwright-artifact-${1}\"}"; }
88+
89+ ITEMS=()
90+ for shard in "${SHARDS[@]}"; do
91+ ITEMS+=("$(entry "$shard")")
92+ done
93+ JOINED=$(IFS=,; echo "${ITEMS[*]}")
94+
95+ echo "matrix={\"include\":[${JOINED}]}" >> "$GITHUB_OUTPUT"
96+ else
97+ NAME="${TEST_SUITE#shard:}"
98+ echo "matrix={\"include\":[{\"script\":\"e2e:test:${TEST_SUITE}\",\"name_suffix\":\" / ${NAME}\",\"artifact_name\":\"playwright-artifact-${NAME}\"}]}" >> "$GITHUB_OUTPUT"
99+ fi
100+
42101 e2e-playwright :
43- name : Run Playwright E2E Tests
44- needs : build
45- uses : inpsyde/reusable-workflows/.github/workflows/test-playwright.yml@fix/test-playwright
102+ name : Run Playwright E2E Tests${{ matrix.name_suffix }}
103+ needs :
104+ - build
105+ - resolve-playwright-matrix
106+ strategy :
107+ fail-fast : false
108+ matrix : ${{ fromJson(needs.resolve-playwright-matrix.outputs.matrix) }}
109+ uses : inpsyde/reusable-workflows/.github/workflows/test-playwright.yml@main
46110 with :
47- WORK_DIR : tests/qa
48- PLAYWRIGHT_SCRIPT : ${{ inputs.TEST_SUITE }}
49- ARTIFACT_PATH : |
50- tests/qa/ artifacts/*
51- tests/qa/ playwright-report/
52- tests/qa/ test-results/
53- ARTIFACT_INCLUDE_HIDDEN_FILES : true
111+ PLAYWRIGHT_SCRIPT : ${{ matrix.script }}
112+ PLAYWRIGHT_ARTIFACT_NAME : ${{ matrix.artifact_name }}
113+ PLAYWRIGHT_ARTIFACT_PATH : |
114+ artifacts/*
115+ playwright-report/
116+ test-results/
117+ PLAYWRIGHT_ARTIFACT_INCLUDE_HIDDEN_FILES : true
54118 NODE_VERSION : 22
55119 PLAYWRIGHT_BROWSER_ARGS : ' chromium --with-deps'
56120 XRAY_TEST_EXEC_KEY : ${{ inputs.XRAY_TEST_EXEC_KEY }}
57121 PRE_SCRIPT : |
58122 # 1. Download and unzip the built plugin
59- gh run download ${{ github.run_id }} -p "woocommerce-paypal-payments-*" -D resources/files
60- pushd resources/files
61- mv woocommerce-paypal-payments-*/woocommerce-paypal-payments .
62- zip -r woocommerce-paypal-payments.zip woocommerce-paypal-payments
63- rm -rf woocommerce-paypal-payments woocommerce-paypal-payments-*/
64- popd
123+ gh run download ${{ github.run_id }} -p "woocommerce-paypal-payments-*" -D tests/qa/resources/files
124+ (
125+ cd tests/qa/resources/files
126+ mv woocommerce-paypal-payments-*/woocommerce-paypal-payments .
127+ zip -rq woocommerce-paypal-payments.zip woocommerce-paypal-payments
128+ rm -rf woocommerce-paypal-payments woocommerce-paypal-payments-*/
129+ )
65130
66131 # 2. Add private composer repository and download WooCommerce Subscriptions
67- pushd ../../
132+ # Pinned below 9.0.0: that release folded "All Products for Subscriptions" into
133+ # core and replaced the legacy `type: subscription` + `_subscription_*` meta
134+ # product-creation API our test data relies on with a plan-based model.
68135 composer config repositories.repo-name composer https://repo.packagist.com/inpsyde/payment-gateways/
69- composer require inpsyde-mirror/woocommerce-subscriptions
70- popd
71-
72- # 3. Setup wp-env
73- npm run e2e:setup:env
136+ composer require "inpsyde-mirror/woocommerce-subscriptions:<9.0"
74137 secrets :
75138 ENV_FILE_DATA : ${{ secrets.QA_ENV_FILE }}
76139 NPM_REGISTRY_TOKEN : ${{ secrets.DEPLOYBOT_GITHUB_TOKEN_PACKAGES }}
0 commit comments