[E2E] [QIT] Add Jetpack connection support for QIT E2E tests #11049
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #WOOPMNT-5336
Changes proposed in this Pull Request
This is a stacked PR that builds on top of the basic QIT E2E testing functionality to address the key challenge of establishing a Jetpack connection for WooPayments in test environments.
The previous foundation established basic E2E testing infrastructure, but lacked the ability to connect WooPayments to a real test account via Jetpack. This PR solves that by providing automated Jetpack connection setup for already onboarded test accounts.
Key features:
WP-CLI QIT Development Commands: New
WP_CLI_QIT_Dev_Command
class providing:wp woopayments qit_setup
- Configures Jetpack connection for pre-onboarded test siteswp woopayments qit_status
- Shows connection status for debuggingEnhanced E2E Test Runner: Updated
e2e-runner.sh
with:Connection Validation Tests:
Configuration Management:
default.env
templateWhy This Approach:
The added WP-CLI commands are doing pretty much the same as the WCPay Dev Tools that we use for the current E2E tests. Initially I tried to use this dev plugin, but it turned out to be tricky to download and install it in the QIT environment. I came with this workaround inspired by the work @dmvrtx did in his draft #10811. But initializating a test drive account turned out to be tricky, so I went with the approach of using an already onboarded account. So, essentially, I'm following the same approach that we have in the current E2E tests, but adapted to the QIT needs. I'd love to hear any ideas for improving this part, but I guess the current approach could work for the time being. It's worth noting that the WP-CLI commands are only registered in development/local environments for security.
Testing instructions
Prerequisites:
composer install
)tests/qit/config/default.env
totests/qit/config/local.env
Running the tests:
npm run test:qit-e2e
npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge