Skip to content

Add a Docker-free runner for the Playwright specs using WordPress Playground - #189

Merged
dnnsjsk merged 1 commit into
inline0:mainfrom
Contributolo:test/e2e-playground
Oct 26, 2026
Merged

dnnsjsk merged 1 commit into
inline0:mainfrom
Contributolo:test/e2e-playground

Conversation

@Contributolo

Copy link
Copy Markdown
Collaborator

Contributors without Docker cannot run the Playwright specs locally, because they only run against wp-env. This adds an opt-in runner on WordPress Playground. wp-env stays the CI runtime and is untouched, as are the Playwright configs.

  • scripts/playground.ts: npm run test:e2e:playground -- <specs> starts a fresh Playground site, seeds it through the existing E2E endpoint, runs playwright.wp-env.config.ts and stops the server. npm run playground:start keeps a seeded site on :8888.
  • Port and wp-config constants are read from tests/wp-env/.wp-env.json. The Blueprint activates the plugin and the theme test theme and sets /%postname%/ permalinks. PHP 8.4 and latest WordPress by default (PLAYGROUND_PHP, PLAYGROUND_WP); the versions live in the Blueprint because Playground ignores --php and --wp once a Blueprint is passed. The site URL is http://localhost:8888, which the specs expect.
  • Missing Composer dependencies of the plugin (vendor/autoload.php) and of tests/theme (Timber) are installed on first run.
  • @wp-playground/cli is pinned to 3.1.60 as a devDependency (stable binary path, clean shutdown). The lockfile already had 3.0.46 through @wordpress/env; the diff is that subtree moving to 3.1.60.
  • A README section and a note in AGENTS.md; a small unit test covers the Blueprint.

Why not wp-env start --runtime=playground: it runs an unpinned npx @wp-playground/cli on PHP 8.2, does not activate the test theme, does not seed and does not set the site URL, so the specs cannot run on it as is.

Limits compared to wp-env: SQLite instead of MySQL, one site only (no PHPUnit, empty or implementation environments), no WP-CLI, so tests/e2e/cli.ts and tests/e2e/seo.ts still need wp-env. It is meant for focused specs; CI remains the source of truth. In our runs the first run right after a fresh npm run build sometimes failed in the first beforeAll and the next run passed with the same files.

Tests: repeater/minimized, repeater/confirmation, repeater/default-rows, types/text and types/textarea (49 tests), five times from a fresh site: four runs 49/49, one failure in the first test's beforeAll. Lint, format, audit:tooling, typecheck and the new unit test pass.

Runs the existing Playwright specs against Playground when Docker is unavailable. wp-env stays the CI runtime.
@dnnsjsk

dnnsjsk commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Released in Blockstudio 7.7.9 as optional contributor tooling, with explicit-spec and site-identity guards, SDK-managed shutdown, and a passing CI smoke check. The full CI suites still use wp-env. Thanks for the contribution.

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