Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a GitHub Action workflow to run QIT E2E Integration tests. #3640

Merged
merged 11 commits into from
Jan 6, 2025
104 changes: 104 additions & 0 deletions .github/workflows/qit-e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: QIT E2E tests

on:
pull_request

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix:
checkout: [ 'Default', 'Legacy' ]

name: ${{ matrix.checkout }} QIT E2E tests
steps:
- name: Checkout repo
uses: actions/checkout@v4

# PHP
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: composer
coverage: none

- name: Cache Composer deps
id: composer-cache
uses: actions/cache@v4
with:
path: ./vendor
key: ${{ runner.os }}-vendor-${{ hashFiles('composer.lock') }}

- name: Install composer dependencies
if: ${{ steps.composer-cache.outputs.cache-hit == false }}
shell: bash
run: composer install --no-progress

# Node
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- name: Cache Node deps
id: node-cache
uses: actions/cache@v4
with:
path: |
./node_modules
~/.cache/ms-playwright
key: ${{ runner.os }}-node_modules-${{ hashFiles('package-lock.json') }}

- name: Install node dependencies
if: ${{ steps.node-cache.outputs.cache-hit == false }}
shell: bash
run: npm ci

# Build
- name: Build plugin package
shell: bash
run: |
npm run build

# QIT CLI
- name: Install QIT via composer
run: composer require woocommerce/qit-cli --dev

- name: Add partner for QIT
run: ./vendor/bin/qit partner:add --user='${{ secrets.PARTNER_USER }}' --application_password='${{ secrets.PARTNER_SECRET }}'

# E2E test environment
- name: Fill in .env
run: |
echo 'STRIPE_PUB_KEY="${{ secrets.E2E_STRIPE_PUBLISHABLE_KEY }}"' >> .env
echo 'STRIPE_SECRET_KEY="${{ secrets.E2E_STRIPE_SECRET_KEY }}"' >> .env
echo 'PAYPAL_MERCHANT_ID="${{ secrets.PAYPAL_MERCHANT_ID }}"' >> .env
echo 'PAYPAL_MERCHANT_EMAIL="${{ secrets.PAYPAL_MERCHANT_EMAIL }}"' >> .env
echo 'PAYPAL_CLIENT_ID="${{ secrets.PAYPAL_CLIENT_ID }}"' >> .env
echo 'PAYPAL_CLIENT_SECRET="${{ secrets.PAYPAL_CLIENT_SECRET }}"' >> .env
echo 'PAYPAL_CUSTOMER_EMAIL="${{ secrets.PAYPAL_CUSTOMER_EMAIL }}"' >> .env
echo 'PAYPAL_CUSTOMER_PASSWORD="${{ secrets.PAYPAL_CUSTOMER_PASSWORD }}"' >> .env

- name: Run ${{ matrix.checkout }} E2E tests
shell: bash
run: ./vendor/bin/qit run:e2e woocommerce-gateway-stripe ${{ matrix.checkout == 'Legacy' && 'legacy' || '' }} --source ./ --plugin woocommerce --plugin woocommerce-subscriptions --plugin woocommerce-paypal-payments:test:setup-tests --env_file .env

- name: Set the path in an env var
if: ${{ failure() }}
run: echo "E2E_REPORT_PATH=$(./vendor/bin/qit e2e-report --dir_only --local)/playwright" >> $GITHUB_ENV

- name: Upload ${{ matrix.checkout }} QIT E2E test results
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.checkout }}-qit-e2e-test-results
path: ${{ env.E2E_REPORT_PATH }}
if-no-files-found: ignore
retention-days: 14
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* Tweak - Improve webhook status related messages on the settings page.
* Update - Prevent editing of orders awaiting payment capture.
* Add - Introduce locking and unlocking in refund flow to prevent double refund due to race condition.
* Dev - Add a GitHub Action workflow to run QIT E2E Integrations tests.
* Fix - Check billing interval and period to set in mandate options.
* Fix - Check order currency on pay for order page to display supported payment methods.

Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
* Tweak - Improve webhook status related messages on the settings page.
* Update - Prevent editing of orders awaiting payment capture.
* Add - Introduce locking and unlocking in refund flow to prevent double refund due to race condition.
* Dev - Add a GitHub Action workflow to run QIT E2E Integrations tests.
* Fix - Check billing interval and period to set in mandate options.
* Fix - Check order currency on pay for order page to display supported payment methods.

Expand Down
Loading