Skip to content

feat(e2e): replace PHP server and DDEV with wp-env#15

Merged
apermo merged 14 commits into
mainfrom
feature/wp-env-e2e
Apr 6, 2026
Merged

feat(e2e): replace PHP server and DDEV with wp-env#15
apermo merged 14 commits into
mainfrom
feature/wp-env-e2e

Conversation

@apermo
Copy link
Copy Markdown
Owner

@apermo apermo commented Apr 6, 2026

Summary

  • Replaces both the PHP built-in server path and the DDEV path with a single @wordpress/env (wp-env) approach
  • Removes php-version, project-mode, and use-ddev inputs — wp-env handles PHP, DB, and project mounting via
    the caller's .wp-env.json
  • Supports WP version × multisite matrix testing with Docker (MariaDB included)

Closes #14

Breaking changes for consumers

Aspect Before After
Caller requirement None .wp-env.json in repo root
WP port 8080 8888
Admin password admin password
PHP version php-version input wp-env container default
Plugin/theme mode project-mode input .wp-env.json config
DDEV support use-ddev: true Removed

Test plan

  • Point a consumer repo at @feature/wp-env-e2e and verify wp-env starts
  • Verify matrix jobs (WP latest + pinned version × multisite) run correctly
  • Verify Playwright tests pass against wp-env at localhost:8888
  • Verify artifact upload works with new naming scheme

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request modernizes the end-to-end testing infrastructure by migrating from a custom PHP server/DDEV setup to the standardized @wordpress/env package. This change streamlines the testing environment, improves consistency across different WordPress versions and multisite configurations, and reduces the maintenance burden of the reusable workflow by offloading environment configuration to the consuming repositories.

Highlights

  • Infrastructure Migration: Replaced the PHP built-in server and DDEV with @wordpress/env (wp-env) for the E2E testing pipeline.
  • Workflow Simplification: Removed redundant inputs including php-version, project-mode, and use-ddev, shifting configuration responsibility to the consumer's .wp-env.json file.
  • Documentation Updates: Updated README and CLAUDE.md to reflect the new wp-env dependency and updated configuration requirements for consumers.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/reusable-wp-e2e.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.


The server was old and quite slow, / We needed a better way to go. / With wp-env now in the lead, / Our tests have the speed that we need.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the reusable-wp-e2e.yml workflow to use wp-env instead of the PHP built-in server or DDEV, resulting in the removal of several inputs including php-version and project-mode. Documentation across README.md, CLAUDE.md, and CHANGELOG.md has been updated to reflect this transition. The review feedback recommends explicitly documenting the new default environment port and credentials in the README to assist users with the breaking changes, and suggests adding examples for the wp-versions input to improve documentation consistency.

Comment thread README.md Outdated
Comment thread README.md Outdated
apermo added 4 commits April 6, 2026 09:05
The inline run value contained a colon inside JSON
which broke YAML parsing, causing startup_failure.
Starts Mailpit in Docker, connects it to the
wp-env network, and injects a mu-plugin that
routes wp_mail through SMTP. Tests receive
MAILPIT_API_URL env var when enabled.
@apermo
Copy link
Copy Markdown
Owner Author

apermo commented Apr 6, 2026

Testing from agency-pass PR #1 (run):

WSAL installs and activates fine. But Mailpit inbox is empty — wp_mail() isn't reaching Mailpit.

The mu-plugin is injected but emails are not arriving. Possible issues:

  • The mu-plugin path might not match what wp-env expects
  • The phpmailer_init hook might not fire (mu-plugin not loaded)
  • The Docker network connection between the WP container and Mailpit might not be working

The non-Mailpit tests (login form UI, admin notice, etc.) also have failures that need investigation —
no-audit-trail and user-profile tests use npx wp-env run cli wp for WP-CLI which might need
different syntax.

apermo added 5 commits April 6, 2026 09:58
Verifies SMTP port reachable from WordPress
container, sends a test email via wp_mail, and
checks Mailpit API received it.
Show mu-plugin path, load status, phpmailer_init
hook registration, and PHPMailer error info.
PHPMailer rejects wordpress@localhost in SMTP
mode. Replace localhost From with a valid domain.
Also set siteurl/home so WP derives a proper
default sender.
wp_mail() validates the From address via setFrom()
BEFORE phpmailer_init fires. If the address is
invalid (e.g. wordpress@localhost), wp_mail bails
out and phpmailer_init never runs. Use the
wp_mail_from filter instead, which runs before
setFrom validation.
@apermo apermo requested a review from Copilot April 6, 2026 19:42
@apermo
Copy link
Copy Markdown
Owner Author

apermo commented Apr 6, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the reusable-wp-e2e.yml workflow to use wp-env instead of the PHP built-in server and DDEV. Key changes include the removal of the php-version, project-mode, and use-ddev inputs, and the addition of a mailpit input for mail catching. Documentation and the changelog have been updated to reflect these breaking changes. Feedback suggests adding a copy-pasteable .wp-env.json example to the README to assist users with the migration.

Comment thread README.md Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the reusable WordPress E2E GitHub Actions workflow to run Playwright against a Dockerized @wordpress/env (wp-env) environment instead of the prior PHP built-in server / DDEV paths, and updates repository documentation/changelog accordingly.

Changes:

  • Replaced E2E environment provisioning with wp-env and adjusted the matrix to support WP version × multisite runs.
  • Added optional Mailpit support via a new mailpit workflow input and related SMTP configuration.
  • Updated README/CLAUDE/CHANGELOG to reflect the new E2E approach and breaking changes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
README.md Updates E2E workflow documentation for wp-env, port/credentials, matrix guidance, and Mailpit input.
CLAUDE.md Updates workflow inventory description for the E2E workflow to reference wp-env.
CHANGELOG.md Adds 0.3.0 entry documenting the wp-env migration and input changes.
.github/workflows/reusable-wp-e2e.yml Reworks the E2E job to start wp-env, supports multisite conversion, adds Mailpit option, and changes artifact naming.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/reusable-wp-e2e.yml
Comment thread .github/workflows/reusable-wp-e2e.yml
Comment thread .github/workflows/reusable-wp-e2e.yml
Comment thread .github/workflows/reusable-wp-e2e.yml
Comment thread .github/workflows/reusable-wp-e2e.yml Outdated
Comment thread .github/workflows/reusable-wp-e2e.yml Outdated
Comment thread README.md Outdated
- Validate .wp-env.json exists before wp-env start
- Pin Mailpit image to v1 major tag
- Use docker-compose label for container detection
- Add .wp-env.json example to README
- Remove undocumented beta from wp-versions docs
@apermo
Copy link
Copy Markdown
Owner Author

apermo commented Apr 6, 2026

wp-env starts fine but the Mailpit step fails to find the WordPress container:

WP_CONTAINER=$(docker ps -q --filter "label=com.docker.compose.service=wordpress" --no-trunc | head -1)

wp-env containers don't use the com.docker.compose.service=wordpress label. They use a different naming convention. Try filtering by container name pattern instead:

docker ps -q --filter "name=wordpress-develop" --no-trunc | head -1

Or use docker ps --format '{{.Names}}' | grep -m1 'wordpress' to find it dynamically.

Also: consider adding "testsEnvironment": false to the .wp-env.json validation/docs — the deprecation warning suggests this will be required in a future wp-env version.

wp-env containers don't carry docker-compose
labels. Revert to name-based filter.
@apermo
Copy link
Copy Markdown
Owner Author

apermo commented Apr 6, 2026

Good catch — the com.docker.compose.service label was a bad Copilot suggestion. Reverted to name-based filter (--filter "name=wordpress") with the guard check in 3c3c3c8.

Re testsEnvironment: false — that's a caller-side .wp-env.json concern, not something the reusable workflow should enforce. Could add a note to the README though.

@apermo
Copy link
Copy Markdown
Owner Author

apermo commented Apr 6, 2026

The Mailpit image tag `v1` doesn't exist:

docker: Error response from daemon: manifest for axllent/mailpit:v1 not found

Mailpit doesn't publish major-version tags. Use `axllent/mailpit:latest` or a specific version like `axllent/mailpit:v1.24`.

@apermo apermo merged commit 0947370 into main Apr 6, 2026
6 checks passed
@apermo apermo deleted the feature/wp-env-e2e branch April 6, 2026 21:15
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 6, 2026

Released as v0.3.0

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.

fix(e2e): DDEV fails with docker-compose v5.0.2 not found

2 participants