Add full-stack E2E test infrastructure for Boost Cloud pipeline#47961
Add full-stack E2E test infrastructure for Boost Cloud pipeline#47961LiamSarsfield wants to merge 11 commits intotrunkfrom
Conversation
Create Playwright fixtures, setup project, and smoke test that exercise the complete cloud pipeline (WordPress → Shield → Redis → Hydra → callback) against the local dev Docker environment. - Add FullStackUtils class with Docker-aware helpers (executeDevWpCommand, flushRedis, waitForCssGeneration, captureDockerLogs) - Create full-stack-test.ts fixture extending base-test from e2e-commons - Create full-stack-global-setup.ts with 9 health-check/auth gates - Add Critical CSS smoke test validating generation through Shield+Hydra - Add cloud_css to CLI module allowlist in class-cli.php - Fire jetpack_boost_module_status_updated action in CLI set_module_status() so CLI activation triggers the same hooks as the DataSync REST path
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Boost plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 1 file.
Full summary · PHP report · JS report Coverage check overridden by
Coverage tests to be added later
|
- Add missing changelog entry for plugins/boost - Fix wp eval command in Gate 7: use array form to prevent whitespace splitting of PHP code argument - Deduplicate utility functions: import getDevDomain and executeDevWpCommand from full-stack-utils.ts in global setup - Guard do_action in CLI set_module_status() on actual status change, matching the DataSync path behavior - Move activateBoostModuleDev/deactivateBoostModuleDev onto FullStackUtils class as activateModule/deactivateModule methods
- Fix missing `join` import in full-stack-global-setup.ts (blocker: ReferenceError at module load prevented all full-stack tests) - Add .state/ to Boost e2e .gitignore (auth storage state files) - Remove unused STORAGE_STATE_PATH export, add cross-reference comments between global setup and playwright.config.ts - Trim getDevDomain() regex result to handle \r\n line endings - Remove unused getShieldHealth() method (YAGNI, no retry logic) - Fix @param type: string → bool for $status in class-cli.php docblock - Add cross-reference comment for intentionally duplicated getDevDomain()
- Strip quotes from DEV_DOMAIN .env value in both getDevDomain() copies - Extract execDocker() and flushRedis() as standalone exported functions from full-stack-utils.ts; import in global setup (removes duplication) - Remove private execDocker class method (class delegates to standalone)
- Replace non-null assertion on BOOST_CLOUD_DIR with explicit guard and descriptive error message (blocker: opaque TypeError otherwise) - Parse last line of execDocker output in Gate 5 to handle Docker Compose stderr warnings before stdout - Log swallowed mock plugin deactivation errors for debugging - Update changelog to mention CLI do_action bug fix - Add comment explaining pageerror listener in full-stack fixture
- Fix Gate 5 HTTP status parsing: use regex to extract 3-digit code from mixed stdout+stderr (important: Docker Compose warnings broke pop()) - Fix changelog: use proper entry (Type: fixed) instead of Comment field so the CLI behavioral fix appears in release notes - Add warning message when CLI module activation is a no-op - Add comment explaining localhost:1982 vs boost-shield:1982 in Gate 3
There was a problem hiding this comment.
Pull request overview
This PR adds Playwright-based full-stack E2E coverage for Jetpack Boost’s “Boost Cloud” Critical CSS pipeline (dev WordPress → boost-cloud services → callback), and aligns WP-CLI module activation with the module-status update hooks used by the DataSync REST path.
Changes:
- Added full-stack Playwright projects (conditional on
BOOST_CLOUD_DIR), plus fixtures/utilities for Docker/WP-CLI/Redis operations and environment gating. - Added a Critical CSS smoke test that validates cloud generation end-to-end and checks frontend output.
- Updated Boost WP-CLI module activation to trigger
jetpack_boost_module_status_updatedand allowlisted thecloud_cssmodule for the CLI command.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/plugins/boost/tests/e2e/specs/full-stack/critical-css.test.ts | Adds a full-stack Critical CSS generation + frontend presence smoke test. |
| projects/plugins/boost/tests/e2e/playwright.config.ts | Conditionally registers full-stack Playwright projects and ignores full-stack specs in existing project. |
| projects/plugins/boost/tests/e2e/lib/utils/full-stack-utils.ts | Introduces Docker-aware helpers (dev WP-CLI exec, Redis flush, CSS polling, log capture). |
| projects/plugins/boost/tests/e2e/lib/full-stack-global-setup.ts | Adds a setup project that gates environment readiness and saves auth storage state for dev WP. |
| projects/plugins/boost/tests/e2e/lib/fixtures/full-stack-test.ts | Adds a dedicated fixture for full-stack tests and attaches Docker logs on failure. |
| projects/plugins/boost/tests/e2e/.gitignore | Ignores .state/ used for full-stack storage state. |
| projects/plugins/boost/changelog/add-boost-full-stack-e2e-infrastructure | Adds a changelog fragment describing the CLI hook fix + E2E infra. |
| projects/plugins/boost/app/lib/class-cli.php | Allowlists cloud_css and fires jetpack_boost_module_status_updated when CLI changes module state. |
projects/plugins/boost/tests/e2e/lib/fixtures/full-stack-test.ts
Outdated
Show resolved
Hide resolved
- Force workers: 1 on full-stack project to prevent race conditions on shared dev WordPress and Redis state - Use fileURLToPath for STORAGE_STATE_PATH (cross-platform correctness) - Verify authentication after login POST by requesting admin profile page and asserting no redirect to wp-login.php - Remove duplicate pageerror handler (already inherited from base-test) - Use path.join for .env path in config getDevDomain
fetch() had no timeout — if Shield accepts the connection but stalls, the gate hangs indefinitely. Use AbortSignal.timeout(5s) so each attempt fails fast and the retry loop behaves predictably.
- Add explicit assertion when HTTP status regex fails to match, showing raw Docker output instead of opaque "HTTP NaN" message - Document that full-stack specs must use test.describe.serial due to shared Docker environment
Fixes AIE-95
Proposed changes
FullStackUtilsclass with Docker-aware helpers:executeDevWpCommand(targets dev container with--urlflag),flushRedis,waitForCssGeneration(WP-CLI polling),captureDockerLogs(attached to Playwright report on failure)full-stack-test.tsfixture extendingbase-testfrom e2e-commonsfull-stack-global-setup.tssetup project with 9 gates: config validation, WordPress/Shield/Redis/Hydra health checks, boost-developer verification, debug mu-plugin guard, Redis flush, and dev WordPress authenticationplaywright.config.ts: addtestIgnorefor full-stack specs on existing project, conditionally registerfull-stack setupandfull-stackprojects whenBOOST_CLOUD_DIRis set, per-projectbaseURLread from boost-cloud.envspecs/full-stack/critical-css.test.ts) that validates CSS generation through Shield+Hydra and checks frontend outputcloud_cssto CLI module allowlist inclass-cli.phpjetpack_boost_module_status_updatedaction in CLIset_module_status()so CLI module activation triggers the same hooks as the DataSync REST path (e.g.,Cloud_CSS::activate()→Regenerate::start())Other information
jetpack_dev_defaultDocker network — the e2e container is on a separate network whereboost-shield:1982DNS does not resolve--url=http://${DEV_DOMAIN}because inside Docker$_SERVER["HTTP_HOST"]is empty andwp-config.phpdefaultsWP_HOMEtohttp://localhost, which Hydra containers cannot reachdo_actionaddition inclass-cli.phpis a behavioral change: previously CLImodule activateonly wrote the option, now it also fires the module status hook. This aligns CLI behavior with the DataSync REST path and is required for Cloud CSS generation to trigger via CLIRelated product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Prerequisites
All three local environments must be running:
pnpm jetpack docker up -d(from monorepo root)docker compose up -d(from boost-cloud repo)setup-boost-local)Run full-stack tests
cd projects/plugins/boost/tests/e2eBOOST_CLOUD_DIR=/path/to/boost-cloud npx playwright test --project=full-stackfull-stack setupproject: all 9 gates pass (health checks + auth)full-stackproject: both Critical CSS tests pass (generation + frontend check)Verify existing tests are unaffected
npx playwright test --project="jetpack boost e2e"(withoutBOOST_CLOUD_DIR)testIgnoreprevents them from picking upspecs/full-stack/Verify CLI
do_actionchangepnpm jetpack docker wp -- jetpack-boost module activate cloud_css --url=http://jetpack-boost.test(with boost-developercss_mode: cloud)wp option get jetpack_boost_ds_critical_css_state --format=jsonshowspending→generated)