mirror of
https://gh.wpcy.net/https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2026-04-28 01:33:45 +08:00
136 lines
4.2 KiB
YAML
136 lines
4.2 KiB
YAML
name: E2E Tests
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
update-workflows:
|
|
description: 'Weather generate new snapshots'
|
|
type: boolean
|
|
default: false
|
|
wp-rc-version:
|
|
description: 'WordPress version for Release Candidate (i.e. 6.3-RC3)'
|
|
wc-rc-version:
|
|
description: 'WooCommerce version for Release Candidate (i.e. 8.0.0-rc.1)'
|
|
test-suite:
|
|
description: 'Test suite to run'
|
|
required: true
|
|
default: 'critical'
|
|
type: choice
|
|
options:
|
|
- critical
|
|
- onboarding
|
|
- all
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
name: Build package
|
|
uses: inpsyde/reusable-workflows/.github/workflows/build-plugin-archive.yml@a9af34f34e95cbe18703198c7e972e97ebcd7473
|
|
with:
|
|
PHP_VERSION: 7.4
|
|
NODE_VERSION: 22
|
|
PLUGIN_MAIN_FILE: ./woocommerce-paypal-payments.php
|
|
PLUGIN_VERSION: 3.0.0
|
|
PLUGIN_FOLDER_NAME: woocommerce-paypal-payments
|
|
ARCHIVE_NAME: woocommerce-paypal-payments
|
|
COMPILE_ASSETS_ARGS: '-vv --env=root'
|
|
|
|
E2ETests:
|
|
name: E2E Tests
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
FORCE_COLOR: 2
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: woocommerce-paypal-payments
|
|
path: ./tests/qa/resources/files
|
|
|
|
- name: Create and upload zip file
|
|
working-directory: ./tests/qa/resources/files
|
|
run: |
|
|
zip -r ./woocommerce-paypal-payments.zip ./woocommerce-paypal-payments
|
|
rm -rf woocommerce-paypal-payments
|
|
|
|
- name: Configure npm for GitHub Packages
|
|
working-directory: ./tests/qa
|
|
run: |
|
|
# Create clean .npmrc
|
|
echo "@inpsyde:registry=https://npm.pkg.github.com" > .npmrc
|
|
echo "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_SYDE }}" >> .npmrc
|
|
|
|
- name: Install Environment
|
|
working-directory: ./tests/qa
|
|
run: npm run setup:env
|
|
env:
|
|
COMPOSER_AUTH: '${{ secrets.COMPOSER_AUTH_SYDE }}'
|
|
|
|
- name: Install WP release candidate (optional)
|
|
if: github.event.inputs.wp-rc-version != ''
|
|
working-directory: ./tests/qa
|
|
env:
|
|
INPUT_WP_RC_VERSION: ${{ github.event.inputs.wp-rc-version }}
|
|
run: |
|
|
npm run -- wp-env run tests-cli -- wp core update --version="${INPUT_WP_RC_VERSION}"
|
|
npm run -- wp-env run tests-cli -- wp core update-db
|
|
|
|
- name: Install WC release candidate (optional)
|
|
if: github.event.inputs.wc-rc-version != ''
|
|
working-directory: ./tests/qa
|
|
env:
|
|
INPUT_WC_RC_VERSION: ${{ github.event.inputs.wc-rc-version }}
|
|
run: |
|
|
npm run -- wp-env run tests-cli -- wp plugin update woocommerce --version="${INPUT_WC_RC_VERSION}"
|
|
npm run -- wp-env run tests-cli -- wp wc update
|
|
|
|
- name: Install Tests
|
|
working-directory: ./tests/qa
|
|
run: npm run setup:tests
|
|
|
|
- name: Create .env file
|
|
working-directory: ./tests/qa
|
|
run: |
|
|
echo "${{ secrets.QA_ENV_FILE }}" > .env
|
|
|
|
- name: Run E2E tests
|
|
working-directory: ./tests/qa
|
|
run: |
|
|
if [ "${{ github.event.inputs.update_snapshots }}" == "true" ]; then
|
|
npm run tests:${{ github.event.inputs.test-suite }} -- --update-snapshots
|
|
else
|
|
npm run tests:${{ github.event.inputs.test-suite }}
|
|
fi
|
|
|
|
- name: Archive updated snapshots
|
|
if: github.event.inputs.update_snapshots == 'true'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: snapshots
|
|
path: tests/qa/snapshots
|
|
if-no-files-found: warn
|
|
retention-days: 5
|
|
|
|
- name: Archive Playwright Report
|
|
if: ${{ always() }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-test-results
|
|
path: tests/qa/playwright-report
|
|
if-no-files-found: ignore
|
|
retention-days: 5
|
|
|
|
- name: Archive Test Results
|
|
if: ${{ always() }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: test-results
|
|
path: tests/qa/test-results/
|
|
if-no-files-found: ignore
|
|
retention-days: 5
|