Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
ebb5a08
Add QIT development tools and E2E testing setup
mgascam Sep 16, 2025
bd1afc7
Remove QIT development tools and simplify E2E test setup for WooComme…
mgascam Sep 17, 2025
c30457d
Refactor QIT development tools for WooPayments: update comments, enha…
mgascam Sep 16, 2025
e3064e3
Add E2E test credentials and enhance WooPayments setup scripts
mgascam Sep 17, 2025
ff3ff3b
Add GitHub Actions workflow for QIT E2E tests
mgascam Sep 17, 2025
acbf4fe
Enhance security for token handling in CI workflow
mgascam Sep 17, 2025
d87f97a
Add changelog
mgascam Sep 18, 2025
0359bc7
Amend comment
mgascam Sep 18, 2025
9de0e5d
Merge branch 'dev/qit-e2e-foundation' into dev/qit-e2e-basic-checkout
mgascam Sep 18, 2025
34e488a
Use QIT E2E secrets
mgascam Sep 18, 2025
ffe04a1
Add changelog
mgascam Sep 18, 2025
0e2b1c9
Remove wrongly committed files
mgascam Sep 18, 2025
a3d157d
Amend comment
mgascam Sep 18, 2025
4600402
Whitelist subscriptions core package to fix the build error
mgascam Sep 18, 2025
63abbe8
Add a step to install QIT
mgascam Sep 18, 2025
3a5e6b7
Refactor QIT CLI installation and update test command syntax in E2E s…
mgascam Sep 18, 2025
f4f436b
Fix qit command error
mgascam Sep 18, 2025
cceb6f9
Refactor QIT E2E test execution and streamline environment variable h…
mgascam Sep 18, 2025
07efbd5
Update QIT E2E test command to use correct paths and environment vari…
mgascam Sep 18, 2025
c12814c
Remove upload step
mgascam Sep 18, 2025
020c053
Merge branch 'dev/qit-e2e-basic-checkout' into dev/qit-e2e-workflows
mgascam Sep 18, 2025
af5f4b3
Merge branch 'develop' into dev/qit-e2e-foundation
mgascam Sep 22, 2025
e6b2e0f
Merge branch 'dev/qit-e2e-foundation' into dev/qit-e2e-basic-checkout
mgascam Sep 22, 2025
ff1439d
Merge branch 'dev/qit-e2e-basic-checkout' into dev/qit-e2e-workflows
mgascam Sep 22, 2025
797ec4d
Revert changes to composer.*
mgascam Sep 22, 2025
6114d8f
Upgrade qit cli package
mgascam Sep 22, 2025
9023c4a
Merge branch 'dev/qit-e2e-foundation' into dev/qit-e2e-basic-checkout
mgascam Sep 22, 2025
79cb164
Restore composer files
mgascam Sep 22, 2025
c4d211e
Merge branch 'dev/qit-e2e-basic-checkout' into dev/qit-e2e-workflows
mgascam Sep 22, 2025
e1bc769
Add 'tests/qit/e2e' to path ignore patterns in Jest config
mgascam Sep 23, 2025
97c0335
Merge branch 'dev/qit-e2e-foundation' into dev/qit-e2e-basic-checkout
mgascam Sep 23, 2025
ff6a72d
Merge branch 'dev/qit-e2e-basic-checkout' into dev/qit-e2e-workflows
mgascam Sep 23, 2025
5c33c7f
Merge branch 'develop' into dev/qit-e2e-foundation
mgascam Sep 24, 2025
34dd024
Merge branch 'dev/qit-e2e-foundation' into dev/qit-e2e-basic-checkout
mgascam Sep 24, 2025
55fb917
Merge branch 'dev/qit-e2e-basic-checkout' into dev/qit-e2e-workflows
mgascam Sep 24, 2025
c252170
Add wp-cli-stubs dependency and update psalm-loader for static analysis
mgascam Sep 24, 2025
1f941ec
Merge branch 'dev/qit-e2e-basic-checkout' into dev/qit-e2e-workflows
mgascam Sep 24, 2025
506c1b1
Merge branch 'develop' into dev/qit-e2e-foundation
mgascam Oct 1, 2025
d53a75a
Merge branch 'dev/qit-e2e-foundation' into dev/qit-e2e-basic-checkout
mgascam Oct 1, 2025
13faa5d
Merge branch 'dev/qit-e2e-basic-checkout' into dev/qit-e2e-workflows
mgascam Oct 1, 2025
02348e5
Refine plugin row locator to exclude update rows in activation test
mgascam Oct 1, 2025
673c891
Merge branch 'dev/qit-e2e-foundation' into dev/qit-e2e-basic-checkout
mgascam Oct 1, 2025
77ce07c
Rename misspelled vars on env file
mgascam Oct 1, 2025
cf73eb2
Merge branch 'develop' into dev/qit-e2e-foundation
mgascam Oct 2, 2025
ebdcc7c
Merge branch 'dev/qit-e2e-basic-checkout' into dev/qit-e2e-workflows
mgascam Oct 3, 2025
7eb756c
Merge branch 'dev/qit-e2e-foundation' into dev/qit-e2e-basic-checkout
mgascam Oct 3, 2025
c3134c8
Merge branch 'dev/qit-e2e-basic-checkout' into dev/qit-e2e-workflows
mgascam Oct 3, 2025
0989ba8
Merge branch 'develop' into dev/qit-e2e-foundation
mgascam Oct 7, 2025
c5506bf
Merge branch 'dev/qit-e2e-foundation' into dev/qit-e2e-basic-checkout
mgascam Oct 7, 2025
b1935f7
WIP refactor cli commands
mgascam Oct 7, 2025
220ecbb
Refactor QIT Jetpack connection setup and status scripts
mgascam Oct 7, 2025
1ec81fa
Remove wp-cli-stubs dependency from composer.json and psalm-loader.php
mgascam Oct 7, 2025
d180a65
Merge branch 'dev/qit-e2e-basic-checkout' into dev/qit-e2e-workflows
mgascam Oct 7, 2025
33a294c
Add safety checks for JetPack commands and update environment setup s…
mgascam Oct 8, 2025
d9ea91d
Merge branch 'dev/qit-e2e-basic-checkout' into dev/qit-e2e-workflows
mgascam Oct 8, 2025
5822362
Merge branch 'develop' into dev/qit-e2e-foundation
mgascam Oct 8, 2025
24f5fce
Merge branch 'develop' into dev/qit-e2e-foundation
mgascam Oct 10, 2025
9f25161
Merge branch 'dev/qit-e2e-foundation' into dev/qit-e2e-basic-checkout
mgascam Oct 10, 2025
991e3fe
Merge branch 'dev/qit-e2e-basic-checkout' into dev/qit-e2e-workflows
mgascam Oct 10, 2025
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
131 changes: 131 additions & 0 deletions .github/workflows/qit-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: QIT E2E Tests

on:
pull_request:
paths:
- 'client/**'
- 'includes/**'
- 'src/**'
- 'tests/qit/e2e/**'
- 'tests/qit/qit.yml'
- '.github/workflows/qit-e2e.yml'
push:
branches:
- 'develop'
- 'trunk'
- 'dev/qit-e2e-*' # Allow testing on QIT E2E development branches
schedule:
# Run daily at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
woocommerce_version:
description: 'WooCommerce version to test against'
required: false
default: 'stable'
type: choice
options:
- 'stable'
- '8.9.3'
- '7.7.0'
- 'rc'
- 'beta'
php_version:
description: 'PHP version'
required: false
default: '8.3'
type: choice
options:
- '8.3'
- '8.2'
- '8.1'
- '7.4'
run_ui_mode:
description: 'Run tests in UI mode for debugging'
required: false
default: false
type: boolean

permissions:
contents: read

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

jobs:
qit-e2e-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Pull requests: Test against stable and L-1 WooCommerce versions
- wc_version: "stable"
php_version: "8.3"
test_group: "basic"
- wc_version: "8.9.3" # L-1 version
php_version: "8.3"
test_group: "basic"
# Full runs: Include business continuity version
- wc_version: "7.7.0"
php_version: "7.4"
test_group: "basic"

steps:
- name: "Checkout repository"
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: "Set up repository"
uses: ./.github/actions/setup-repo

- name: "Build the plugin"
id: build_plugin
uses: ./.github/actions/build

- name: "Install QIT CLI for running tests"
run: |
# Install dev dependencies to get QIT CLI
composer install --optimize-autoloader

- name: Authenticate QIT
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
run: ./vendor/bin/qit partner:add --user='${{ secrets.QIT_CI_USER }}' --application_password='${{ secrets.QIT_CI_SECRET }}'

- name: Set test options
id: test_options
run: |
OPTIONS=""
if [[ "${{ inputs.run_ui_mode }}" == "true" ]]; then
OPTIONS="${OPTIONS} --ui"
fi

# Use input versions if provided, otherwise use matrix
WC_VERSION="${{ inputs.woocommerce_version || matrix.wc_version }}"
PHP_VERSION="${{ inputs.php_version || matrix.php_version }}"

OPTIONS="${OPTIONS} --php_version=${PHP_VERSION} --woo=${WC_VERSION}"

echo "options=${OPTIONS}" >> $GITHUB_OUTPUT
echo "Will run with options: ${OPTIONS}"

- name: Mask sensitive values
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
run: |
# Mask tokens in GitHub Actions logs to prevent accidental exposure
echo "::add-mask::${{ secrets.E2E_QIT_JP_SITE_ID }}"
echo "::add-mask::${{ secrets.E2E_QIT_JP_BLOG_TOKEN }}"
echo "::add-mask::${{ secrets.E2E_QIT_JP_USER_TOKEN }}"

- name: Run QIT Tests
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
run: |
cd tests/qit
../../vendor/bin/qit run:e2e woocommerce-payments ./e2e \
--source ../../woocommerce-payments.zip \
--env E2E_JP_SITE_ID="${{ secrets.E2E_QIT_JP_SITE_ID }}" \
--env E2E_JP_BLOG_TOKEN="${{ secrets.E2E_QIT_JP_BLOG_TOKEN }}" \
--env E2E_JP_USER_TOKEN="${{ secrets.E2E_QIT_JP_USER_TOKEN }}" \
${{ steps.test_options.outputs.options }}
5 changes: 5 additions & 0 deletions changelog/dev-qit-e2e-foundation
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Add foundation to run E2E tests with QIT and basic tests.


5 changes: 5 additions & 0 deletions changelog/dev-qit-e2e-workflows
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Add Github workflows to run E2E tests in CI


2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"cweagans/composer-patches": "1.7.1",
"automattic/jetpack-changelogger": "3.3.2",
"spatie/phpunit-watcher": "1.23.6",
"woocommerce/qit-cli": "0.4.0",
"woocommerce/qit-cli": "0.10.0",
"slevomat/coding-standard": "8.15.0",
"dg/bypass-finals": "1.5.1",
"sirbrillig/phpcs-variable-analysis": "^2.11",
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"test:qit-phpstan": "npm run build:release && ./tests/qit/phpstan.sh",
"test:qit-phpstan-local": "npm run build:release && ./tests/qit/phpstan.sh --local",
"test:qit-malware": "npm run build:release && ./tests/qit/malware.sh --local",
"test:qit-e2e": "./tests/qit/e2e-runner.sh",
"watch": "webpack --watch",
"hmr": "webpack server",
"start": "npm run watch",
Expand Down
2 changes: 2 additions & 0 deletions tests/js/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ module.exports = {
'<rootDir>/.*/build-module/',
'<rootDir>/docker/',
'<rootDir>/tests/e2e',
'<rootDir>/tests/qit/e2e',
],
watchPathIgnorePatterns: [
'/node_modules/',
Expand All @@ -54,6 +55,7 @@ module.exports = {
'<rootDir>/.*/build-module/',
'<rootDir>/docker/',
'<rootDir>/tests/e2e',
'<rootDir>/tests/qit/e2e',
],
transform: {
...tsjPreset.transform,
Expand Down
20 changes: 17 additions & 3 deletions tests/qit/config/default.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Create `local.env` and supply actual values.
QIT_USER=""
QIT_PASSWORD=""
# QIT Configuration for WooCommerce Payments
# Copy this file to local.env and update with your values

# ===========================================
# QIT CLI CREDENTIALS (for security, phpstan, malware, custom e2e tests)
# ===========================================
QIT_USER=your_qit_username
QIT_PASSWORD=your_qit_application_password

# ===========================================
# E2E TEST CREDENTIALS (optional - for basic connectivity testing)
# ===========================================
# These provide basic WooPayments plugin connectivity for E2E tests
E2E_JP_SITE_ID=your_site_id_here
E2E_JP_BLOG_TOKEN=your_blog_token_here
E2E_JP_USER_TOKEN=your_user_token_here

115 changes: 115 additions & 0 deletions tests/qit/e2e-runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#!/usr/bin/env bash

# Enable strict error handling and safe field splitting for reliability
set -euo pipefail
IFS=$'\n\t'

# E2E test runner for WooPayments using QIT
cwd=$(pwd)
WCP_ROOT="$cwd"
QIT_ROOT="$cwd/tests/qit"

# Load local env variables if present
if [[ -f "$QIT_ROOT/config/local.env" ]]; then
. "$QIT_ROOT/config/local.env"
fi

# If QIT_BINARY is not set, default to ./vendor/bin/qit
QIT_BINARY=${QIT_BINARY:-./vendor/bin/qit}

echo "Running E2E tests..."

# Change to project root directory to build plugin
cd "$WCP_ROOT"

# Compute a signature of sources relevant to the release build and
# skip rebuilding if nothing has changed since the last build.
compute_build_signature() {
# Hash tracked files that affect the release artifact. This includes
# sources packaged in the zip and build/config files that affect the output.
git ls-files -z -- \
assets \
i18n \
includes \
languages \
lib \
src \
templates \
client \
tasks/release.js \
webpack \
webpack.config.js \
babel.config.js \
package.json \
package-lock.json \
composer.json \
composer.lock \
woocommerce-payments.php \
changelog.txt \
readme.txt \
SECURITY.md \
2>/dev/null \
| xargs -0 shasum -a 256 2>/dev/null \
| shasum -a 256 \
| awk '{print $1}'

# Explicitly return 0 to avoid pipefail issues
return 0
}

BUILD_HASH_FILE="$WCP_ROOT/woocommerce-payments.zip.hash"

CURRENT_SIG="$(compute_build_signature)"

# If WCP_FORCE_BUILD is set, always rebuild
if [[ -n "${WCP_FORCE_BUILD:-}" ]]; then
echo "WCP_FORCE_BUILD set; forcing build of WooPayments plugin..."
npm run build:release
echo "$CURRENT_SIG" > "$BUILD_HASH_FILE"
elif [[ -f "woocommerce-payments.zip" && -f "$BUILD_HASH_FILE" ]]; then
LAST_SIG="$(cat "$BUILD_HASH_FILE" 2>/dev/null || true)"
if [[ "$CURRENT_SIG" == "$LAST_SIG" && -n "$CURRENT_SIG" ]]; then
echo "No relevant changes detected since last build; skipping build."
else
echo "Changes detected; rebuilding WooPayments plugin..."
npm run build:release
echo "$CURRENT_SIG" > "$BUILD_HASH_FILE"
fi
else
echo "Building WooPayments plugin..."
npm run build:release
echo "$CURRENT_SIG" > "$BUILD_HASH_FILE"
fi

# Change to QIT directory so qit.yml is automatically found
cd "$QIT_ROOT"

# Convert relative QIT_BINARY path to absolute for directory change compatibility
if [[ "$QIT_BINARY" = ./* ]]; then
QIT_CMD="$WCP_ROOT/$QIT_BINARY"
else
QIT_CMD="$QIT_BINARY"
fi

# Build environment arguments for local development
env_args=()

# Add Jetpack environment variables if available
if [[ -n "${E2E_JP_SITE_ID:-}" ]]; then
env_args+=( --env "E2E_JP_SITE_ID=${E2E_JP_SITE_ID}" )
fi
if [[ -n "${E2E_JP_BLOG_TOKEN:-}" ]]; then
env_args+=( --env "E2E_JP_BLOG_TOKEN=${E2E_JP_BLOG_TOKEN}" )
fi
if [[ -n "${E2E_JP_USER_TOKEN:-}" ]]; then
env_args+=( --env "E2E_JP_USER_TOKEN=${E2E_JP_USER_TOKEN}" )
fi

# Run QIT E2E tests (qit.yml automatically loaded from current directory)
echo "Running QIT E2E tests for local development..."

"$QIT_CMD" run:e2e woocommerce-payments ./e2e \
--source "$WCP_ROOT/woocommerce-payments.zip" \
"${env_args[@]}"

echo "QIT E2E foundation tests completed!"
26 changes: 26 additions & 0 deletions tests/qit/e2e/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
env: {
node: true,
},
globals: {
page: 'readonly',
browser: 'readonly',
context: 'readonly',
},
rules: {
// Disable Jest-specific rules that conflict with Playwright
'jest/no-done-callback': 'off',
'jest/expect-expect': 'off',
// Allow QIT-specific imports that ESLint can't resolve
'import/no-unresolved': [ 'error', { ignore: [ '/qitHelpers' ] } ],
},
overrides: [
{
files: [ '*.spec.js', '*.test.js' ],
rules: {
// Playwright test specific overrides
'jest/no-done-callback': 'off',
},
},
],
};
Loading
Loading