mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2026-07-28 01:57:35 +08:00
137 lines
4.9 KiB
YAML
137 lines
4.9 KiB
YAML
name: E2E Tests
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: [ "Build and distribute" ]
|
|
types: [ completed ]
|
|
branches: [ dev/develop ]
|
|
workflow_dispatch:
|
|
inputs:
|
|
TEST_SUITE:
|
|
description: 'Test suite'
|
|
required: true
|
|
default: 'smoke:parallel'
|
|
type: choice
|
|
options:
|
|
- all:parallel
|
|
- smoke:parallel
|
|
- critical:parallel
|
|
- shard:plugin-foundation
|
|
- shard:onboarding
|
|
- shard:settings
|
|
- shard:transaction-usa
|
|
- shard:transaction-mexico
|
|
# - shard:transaction-googlepay - temporarily disabled due to instability in CI
|
|
- shard:refund
|
|
- shard:vaulting
|
|
- shard:subscription
|
|
- stress
|
|
XRAY_TEST_EXEC_KEY:
|
|
description: 'Xray Test Execution Key'
|
|
required: false
|
|
default: ''
|
|
type: string
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
name: Build tested plugin package
|
|
if: >-
|
|
github.event_name == 'workflow_dispatch' ||
|
|
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
|
|
uses: inpsyde/reusable-workflows/.github/workflows/build-and-distribute.yml@main
|
|
secrets:
|
|
GITHUB_USER_EMAIL: ${{ secrets.DEPLOYBOT_EMAIL }}
|
|
GITHUB_USER_NAME: ${{ secrets.DEPLOYBOT_USER }}
|
|
GITHUB_USER_SSH_KEY: ${{ secrets.DEPLOYBOT_SSH_PRIVATE_KEY }}
|
|
GITHUB_USER_SSH_PUBLIC_KEY: ${{ secrets.DEPLOYBOT_SSH_PUBLIC_KEY }}
|
|
NPM_REGISTRY_TOKEN: ${{ secrets.DEPLOYBOT_GITHUB_TOKEN_PACKAGES }}
|
|
with:
|
|
PACKAGE_NAME: woocommerce-paypal-payments
|
|
NODE_VERSION: 22
|
|
|
|
resolve-playwright-matrix:
|
|
name: Resolve Playwright matrix
|
|
runs-on: ubuntu-latest
|
|
if: >-
|
|
github.event_name == 'workflow_dispatch' ||
|
|
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
|
|
outputs:
|
|
matrix: ${{ steps.resolve.outputs.matrix }}
|
|
steps:
|
|
- name: Resolve test scripts
|
|
id: resolve
|
|
shell: bash
|
|
run: |
|
|
SHARDS=(
|
|
plugin-foundation
|
|
onboarding
|
|
settings
|
|
transaction-usa
|
|
transaction-mexico
|
|
# transaction-googlepay - temporarily disabled due to instability in CI
|
|
refund
|
|
vaulting
|
|
subscription
|
|
)
|
|
|
|
TEST_SUITE='${{ inputs.TEST_SUITE || 'smoke:parallel' }}'
|
|
|
|
if [[ "$TEST_SUITE" == *':parallel' ]]; then
|
|
SUFFIX=""
|
|
[[ "$TEST_SUITE" != "all:parallel" ]] && SUFFIX=":${TEST_SUITE%:parallel}"
|
|
|
|
entry() { echo "{\"script\":\"e2e:test:shard:${1}${SUFFIX}\",\"name_suffix\":\" / ${1}\",\"artifact_name\":\"playwright-artifact-${1}\"}"; }
|
|
|
|
ITEMS=()
|
|
for shard in "${SHARDS[@]}"; do
|
|
ITEMS+=("$(entry "$shard")")
|
|
done
|
|
JOINED=$(IFS=,; echo "${ITEMS[*]}")
|
|
|
|
echo "matrix={\"include\":[${JOINED}]}" >> "$GITHUB_OUTPUT"
|
|
else
|
|
NAME="${TEST_SUITE#shard:}"
|
|
echo "matrix={\"include\":[{\"script\":\"e2e:test:${TEST_SUITE}\",\"name_suffix\":\" / ${NAME}\",\"artifact_name\":\"playwright-artifact-${NAME}\"}]}" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
e2e-playwright:
|
|
name: Run Playwright E2E Tests${{ matrix.name_suffix }}
|
|
needs:
|
|
- build
|
|
- resolve-playwright-matrix
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJson(needs.resolve-playwright-matrix.outputs.matrix) }}
|
|
uses: inpsyde/reusable-workflows/.github/workflows/test-playwright.yml@main
|
|
with:
|
|
PLAYWRIGHT_SCRIPT: ${{ matrix.script }}
|
|
PLAYWRIGHT_ARTIFACT_NAME: ${{ matrix.artifact_name }}
|
|
PLAYWRIGHT_ARTIFACT_PATH: |
|
|
artifacts/*
|
|
playwright-report/
|
|
test-results/
|
|
PLAYWRIGHT_ARTIFACT_INCLUDE_HIDDEN_FILES: true
|
|
NODE_VERSION: 22
|
|
PLAYWRIGHT_BROWSER_ARGS: 'chromium --with-deps'
|
|
XRAY_TEST_EXEC_KEY: ${{ inputs.XRAY_TEST_EXEC_KEY }}
|
|
PRE_SCRIPT: |
|
|
# 1. Download and unzip the built plugin
|
|
gh run download ${{ github.run_id }} -p "woocommerce-paypal-payments-*" -D tests/qa/resources/files
|
|
(
|
|
cd tests/qa/resources/files
|
|
mv woocommerce-paypal-payments-*/woocommerce-paypal-payments .
|
|
zip -rq woocommerce-paypal-payments.zip woocommerce-paypal-payments
|
|
rm -rf woocommerce-paypal-payments woocommerce-paypal-payments-*/
|
|
)
|
|
|
|
# 2. Add private composer repository and download WooCommerce Subscriptions
|
|
composer config repositories.repo-name composer https://repo.packagist.com/inpsyde/payment-gateways/
|
|
composer require inpsyde-mirror/woocommerce-subscriptions
|
|
secrets:
|
|
ENV_FILE_DATA: ${{ secrets.QA_ENV_FILE }}
|
|
NPM_REGISTRY_TOKEN: ${{ secrets.DEPLOYBOT_GITHUB_TOKEN_PACKAGES }}
|
|
COMPOSER_AUTH_JSON: ${{ secrets.COMPOSER_AUTH_JSON }}
|