Skip to content

ci(e2e): Run e2e suite on WordPress Playground - #1386

Draft
utkarshcloudinary wants to merge 2 commits into
developfrom
ci/e2e-wp-playground
Draft

utkarshcloudinary wants to merge 2 commits into
developfrom
ci/e2e-wp-playground

Conversation

@utkarshcloudinary

@utkarshcloudinary utkarshcloudinary commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Draft. Runs the Playwright e2e suite on WordPress Playground (PHP compiled to WebAssembly, SQLite) instead of wp-env, so the job does not need Docker images, containers or MariaDB. A new CI job runs next to the current wp-env job, so we can compare the two before one replaces the other. This started as a stacked PR on #1377. #1377 was merged while this PR was in progress, so this PR now targets develop.

Approach

  • tests/e2e/playground/server.mjs boots the site with @wp-playground/cli runCLI(). It reads core, the PHP version and the constants from .wp-env.ci.json, mounts the plugin and .wp-env/mu-plugins, and listens on port 8889, like the wp-env tests site.
  • Playground has no container for docker exec. The server also serves a small WP-CLI bridge on 127.0.0.1:8890. When WP_E2E_RUNTIME=playground is set, wpCli() and wpEvalFile() in tests/e2e/utils/wizard.js send commands to the bridge. The calls stay synchronous, so no spec call sites change. Shell-quoted arguments are split the same way a shell would split them, and PHP warnings go to stderr, like with the CLI SAPI.
  • tests/e2e/playground/run-e2e.sh (npm run test:e2e:playground) runs three passes. Each pass gets a fresh site: the parallel pass and the other @serial specs on 6 PHP workers, and the storage-modes spec on 1 PHP worker. With more than one worker, @wp-playground/cli 3.1.61 can let one worker see a file that another worker deleted: file_exists() is true and filesize() fails. I also tried disabling WP-Cron and blocking the plugin's loopback requests. Neither change fixed it. With 1 worker, the block editor saves too slowly on CI for the other specs, so only the storage-modes spec uses 1 worker.
  • The Playground server log does not include WP-CLI arguments or output, because they can contain the connection string and CI uploads that log as an artifact.
  • The new e2e-playground CI job caches ~/.wordpress-playground.
  • Fixed a race in the gallery spec: it now waits for the block to load in the editor before it reads the block store. This failure showed up on Playground.
  • @wp-playground/cli is now a direct devDependency (3.1.61, the version @wordpress/env already installs).

Results so far

  • Local (macOS): full suite passed, 55 passed and 1 skipped (the skip already exists). Each site boots in about 9s. The run took about 9.7 minutes in total.
  • Last wp-env CI run on the base branch: about 1m40s to start wp-env and build, and about 4.5 minutes for the tests.
  • Known gaps: SQLite instead of MariaDB. PHPUnit still uses wp-env. The storage-modes spec runs on a separate 1-worker site until the Playground filesystem cache issue is fixed upstream.

QA notes

  • Stop wp-env if it is running (it also uses port 8889). Then run npm run test:e2e:playground with CLOUDINARY_E2E_URL set. Both passes should pass.
  • Run a single spec: npm run test:e2e:playground -- tests/e2e/plugin.spec.js.
  • In CI, compare how long E2E (Playwright, Playground) takes against E2E (Playwright).

Add a Docker-free way to run the Playwright suite. A Node script
boots the site in WordPress Playground (PHP on WebAssembly, SQLite)
with core, PHP version and constants from .wp-env.ci.json, and
serves a small WP-CLI bridge so the spec helpers keep working
without docker exec.

Add a CI job that runs the suite this way next to the wp-env job,
so the two can be compared before one replaces the other.

Also wait for the gallery block to load in the editor before the
spec reads it from the block store.
@utkarshcloudinary
utkarshcloudinary changed the base branch from chore/wp-7-2-compatibility to develop November 23, 2026 14:58
Run only the storage-modes spec on a 1-worker Playground site. The
other serial specs time out there on CI, because the block editor
saves too slowly with one PHP worker.

Stop logging WP-CLI arguments and stderr in the Playground server
log. They can contain the Cloudinary connection string, and CI
uploads that log as an artifact.
@utkarshcloudinary
utkarshcloudinary changed the base branch from develop to chore/wp-7-2-compatibility November 23, 2026 15:26
@utkarshcloudinary
utkarshcloudinary changed the base branch from chore/wp-7-2-compatibility to develop November 23, 2026 15:27

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants