Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
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

- 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
4 changes: 4 additions & 0 deletions tests/inc/inpsyde/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!composer.json
!composer.lock
!.gitignore
20 changes: 20 additions & 0 deletions tests/inc/inpsyde/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "woocommerce-paypal-payments/tests",
"description": "Private test dependencies for WooCommerce PayPal Payments tests",
"type": "project",
"repositories": {
"packagist.org": false,
"private-packagist": {
"type": "composer",
"url": "https://repo.packagist.com/inpsyde/"
}
},
"require": {
"inpsyde-mirror/woocommerce-subscriptions": "^7.9"
},
"config": {
"allow-plugins": {
"composer/installers": true
}
}
}
199 changes: 199 additions & 0 deletions tests/inc/inpsyde/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading