Skip to content

Commit 987bfec

Browse files
committed
refactor: simplify E2E test command and update README instructions
1 parent c8e0f68 commit 987bfec

File tree

2 files changed

+17
-33
lines changed

2 files changed

+17
-33
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
"test:qit-phpstan": "npm run build:release && ./tests/qit/phpstan.sh",
4949
"test:qit-phpstan-local": "npm run build:release && ./tests/qit/phpstan.sh --local",
5050
"test:qit-malware": "npm run build:release && ./tests/qit/malware.sh --local",
51-
"test:qit-e2e": "./vendor/bin/qit run:e2e woocommerce-payments --config tests/qit/qit.json --profile=default --env_file ${QIT_ENV_FILE:-tests/qit/config/local.env}",
52-
"test:qit-e2e:args": "./vendor/bin/qit run:e2e woocommerce-payments --config tests/qit/qit.json --profile=default --env_file ${QIT_ENV_FILE:-tests/qit/config/local.env} --",
51+
"test:qit-e2e": "./vendor/bin/qit run:e2e woocommerce-payments --config tests/qit/qit.json --profile=default",
5352
"watch": "webpack --watch",
5453
"hmr": "webpack server",
5554
"start": "npm run watch",

tests/qit/README.md

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ We use the [QIT toolkit](https://qit.woo.com/docs/) for automated testing includ
55
### Setup
66

77
1. Create `local.env` inside the `tests/qit/config/` directory by copying the variables from `default.env`.
8-
2. To get the actual values for local config, refer to this [secret store](https://mc.a8c.com/secret-store/?secret_id=11043) link.
9-
3. Use standard `KEY=VALUE` format (no `export` keyword needed).
8+
2. Use standard `KEY=VALUE` format (no `export` keyword needed).
9+
3. Configure the required credentials:
10+
- **QIT authentication**: Get credentials from the [secret store](https://mc.a8c.com/secret-store/?secret_id=11043). These authenticate you with the QIT service.
11+
- **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.
1012
4. Once configured, the first time you run a test command, it will create a local auth file for subsequent runs.
1113

12-
**Note:** E2E tests require the dev version of `qit-cli`. Run `composer require woocommerce/qit-cli:dev-trunk --dev` to install it locally.
14+
**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.
1315

1416
### Running Tests
1517

@@ -31,43 +33,26 @@ Before running E2E tests, build the plugin package:
3133
npm run build:release
3234
```
3335

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

3638
```bash
37-
# Run all E2E tests
38-
npm run test:qit-e2e
39+
# Run all E2E tests (prepend with env vars from local.env)
40+
E2E_JP_SITE_ID='<value>' E2E_JP_BLOG_TOKEN='<value>' E2E_JP_USER_TOKEN='<value>' npm run test:qit-e2e
41+
42+
# Run specific test file (passthrough to Playwright)
43+
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
3944

40-
# Run tests matching a pattern (e.g., @shopper tag, test name, or file path)
41-
npm run test:qit-e2e:args -- --grep "@shopper"
42-
npm run test:qit-e2e:args -- --grep "shopper-checkout-purchase"
45+
# Run tests filtered by tag (e.g., @blocks, @shopper)
46+
E2E_JP_SITE_ID='<value>' E2E_JP_BLOG_TOKEN='<value>' E2E_JP_USER_TOKEN='<value>' npm run test:qit-e2e -- -- --grep "@blocks"
4347
```
4448

45-
You can also run QIT directly for more control:
49+
**Tip:** You can export the variables once per shell session instead of prepending each command:
4650

4751
```bash
48-
# Run all tests
49-
./vendor/bin/qit run:e2e woocommerce-payments \
50-
--config tests/qit/qit.json \
51-
--profile=default \
52-
--env_file tests/qit/config/local.env
53-
54-
# Run specific test file via Playwright options
55-
./vendor/bin/qit run:e2e woocommerce-payments \
56-
--config tests/qit/qit.json \
57-
--profile=default \
58-
--env_file tests/qit/config/local.env \
59-
--pw_options "woopayments/shopper/shopper-checkout-purchase.spec.ts"
60-
61-
# Run tests with specific tag
62-
./vendor/bin/qit run:e2e woocommerce-payments \
63-
--config tests/qit/qit.json \
64-
--profile=default \
65-
--env_file tests/qit/config/local.env \
66-
--pw_test_tag="@critical"
52+
set -a && source tests/qit/config/local.env && set +a
53+
npm run test:qit-e2e
6754
```
6855

69-
**Note:** E2E tests require valid Jetpack credentials in `local.env` (`E2E_JP_SITE_ID`, `E2E_JP_BLOG_TOKEN`, `E2E_JP_USER_TOKEN`).
70-
7156
### Analyzing Results
7257

7358
- Once the test run completes, you'll see a result URL along with the test summary.

0 commit comments

Comments
 (0)