Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d801eeb
add test package
Nov 20, 2025
46c82d0
remove development files
Nov 20, 2025
53ac3d9
fix failing tests
Nov 21, 2025
79ec438
chore: update woocommerce/qit-cli to dev-trunk and add .gitignore for…
mgascam Dec 1, 2025
390bdd9
rename tests folder
mgascam Dec 1, 2025
946f6b4
Rename parent folder
mgascam Dec 1, 2025
3fd0e69
feat: add .nvmrc file and update setup script for WooPayments E2E tests
mgascam Dec 1, 2025
5d0cd5e
feat: update test configuration and add shopper subpackage for WooPay…
mgascam Dec 1, 2025
3dcb1de
fix: update home page test to verify visibility of site title
mgascam Dec 1, 2025
45bd62d
chore: remove outdated migration guide for QIT test packages
mgascam Dec 1, 2025
4cf2b28
fix: update QIT test package path and clean up environment configuration
mgascam Dec 1, 2025
770059f
fix: update plugin entries in QIT test package configuration
mgascam Dec 1, 2025
dc1e43b
feat: add QIT test package configuration and E2E test scripts
mgascam Dec 2, 2025
33d24e1
Move wc blocks tests
mgascam Dec 2, 2025
0aeaf4a
Remove QIT custom E2E configuration.
mgascam Dec 2, 2025
ac22d68
fix: improve reliability of save payment method interaction in WC Blo…
mgascam Dec 2, 2025
4b0080a
docs: update README for WooPayments QIT tests setup and execution ins…
mgascam Dec 2, 2025
8949a12
remove comment
mgascam Dec 2, 2025
2a3fa10
revert qit-cli to stable version for CI compatibility
mgascam Dec 2, 2025
3d53ccc
Remove comment
mgascam Dec 2, 2025
cef58d1
docs: add note about dev version of qit-cli requirement for E2E tests
mgascam Dec 2, 2025
aa42127
Fix internal dependencies comment
mgascam Dec 2, 2025
1637b12
Remove migration readme
mgascam Dec 2, 2025
c8e0f68
Amend test instructions
mgascam Dec 2, 2025
987bfec
refactor: simplify E2E test command and update README instructions
mgascam Dec 3, 2025
52eeeb6
fix: update test directory path for shopper project in Playwright config
mgascam Dec 3, 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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ vendor/*
release/*
tests/e2e/docker*
tests/e2e/deps*
tests/qit/test-package/*
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ wordpress-org-assets

tests/e2e/docker
tests/e2e/deps
tests/qit/test-package

docs/dependencies.md
docs/metadata.md
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +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",
"test:qit-e2e": "./vendor/bin/qit run:e2e woocommerce-payments --config tests/qit/qit.json --profile=default",
"watch": "webpack --watch",
"hmr": "webpack server",
"start": "npm run watch",
Expand Down
61 changes: 41 additions & 20 deletions tests/qit/README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,61 @@
## WooCommerce Payments QIT tests
## WooPayments QIT Tests

We use the [QIT toolkit](https://qit.woo.com/docs/) for automated testing including security, PHPStan, and E2E tests.

#### Setup
- Create `local.env` inside the `tests/qit/config/` directory by copying the variables from `default.env`.
- To get the actual values for local config, refer to this [secret store](https://mc.a8c.com/secret-store/?secret_id=11043) link.
- Use standard `KEY=VALUE` format (no `export` keyword needed).
- Once configured, the first time you run a test command, it will create a local auth file for subsequent runs.
### Setup

#### Running Tests
1. Create `local.env` inside the `tests/qit/config/` directory by copying the variables from `default.env`.
2. Use standard `KEY=VALUE` format (no `export` keyword needed).
3. Configure the required credentials:
- **QIT authentication**: Get credentials from the [secret store](https://mc.a8c.com/secret-store/?secret_id=11043). These authenticate you with the QIT service.
- **E2E Jetpack credentials** (`E2E_JP_SITE_ID`, `E2E_JP_BLOG_TOKEN`, `E2E_JP_USER_TOKEN`): Get these from a Jurassic Ninja site already onboarded in test mode.
4. Once configured, the first time you run a test command, it will create a local auth file for subsequent runs.

**Note:** E2E tests require the dev version of `qit-cli` (test packages are not yet in stable releases). Run `composer require woocommerce/qit-cli:dev-trunk --dev --ignore-platform-reqs` to install it locally.

### Running Tests

#### Security and PHPStan tests

**Security and PHPStan tests:**
```bash
npm run test:qit-security
npm run test:qit-phpstan
npm run test:qit-phpstan-local # Against local development build
```

**E2E tests:**
#### E2E Tests

E2E tests use the [QIT Test Packages](https://qit.woo.com/docs/test-packages/) approach. Tests are located in `tests/qit/test-package/`.

Before running E2E tests, build the plugin package:

```bash
# Run all E2E tests
npm run test:qit-e2e
npm run build:release
```

This creates `woocommerce-payments.zip` which is used by QIT. Then run the tests with the required environment variables:

```bash
# Run all E2E tests (prepend with env vars from local.env)
E2E_JP_SITE_ID='<value>' E2E_JP_BLOG_TOKEN='<value>' E2E_JP_USER_TOKEN='<value>' npm run test:qit-e2e

# Run specific test file
npm run test:qit-e2e tests/qit/e2e/specs/woopayments/shopper/shopper-checkout-purchase.spec.ts
# Run specific test file (passthrough to Playwright)
E2E_JP_SITE_ID='<value>' E2E_JP_BLOG_TOKEN='<value>' E2E_JP_USER_TOKEN='<value>' npm run test:qit-e2e -- -- shopper-checkout-purchase.spec.ts

# Run tests with specific tag
npm run test:qit-e2e -- --tag=@basic
# Run tests filtered by tag (e.g., @blocks, @shopper)
E2E_JP_SITE_ID='<value>' E2E_JP_BLOG_TOKEN='<value>' E2E_JP_USER_TOKEN='<value>' npm run test:qit-e2e -- -- --grep "@blocks"
```

**Note:** E2E tests require valid Jetpack credentials in `local.env` (`E2E_JP_SITE_ID`, `E2E_JP_BLOG_TOKEN`, `E2E_JP_USER_TOKEN`).
**Tip:** You can export the variables once per shell session instead of prepending each command:

- The commands use `build:release` to create `woocommerce-payments.zip` at the root of the directory which is then uploaded and used for the QIT tests.
```bash
set -a && source tests/qit/config/local.env && set +a
npm run test:qit-e2e
```

### Analyzing Results

#### Analysing results
- Once the test run is done, you'll see a result URL along with the test summary.
- Look at any errors that might have been surfaced and associate with PRs that has introduced the same by using `git blame`.
- Once the test run completes, you'll see a result URL along with the test summary.
- Look at any errors that might have been surfaced and associate with PRs that introduced them using `git blame`.
- Ping the author for fixing the error, or fix it yourself if it is straightforward enough.
- For failed tests, check the artifacts directory for screenshots and error context.
244 changes: 0 additions & 244 deletions tests/qit/e2e-runner.sh

This file was deleted.

26 changes: 0 additions & 26 deletions tests/qit/e2e/.eslintrc.js

This file was deleted.

Loading
Loading