test: cover sending mail through smtp end to end with playwright - #7
Merged
Merged
Conversation
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
vitormattos
approved these changes
Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #5.
The plugin's job only shows when mail leaves WordPress and reaches an SMTP server, which the PHPUnit suites cannot see: there, PHPMailer is replaced by a mock. This adds a Playwright suite that sends real mail through the plugin.
Stack
tests/E2E/docker-compose.ymlstarts WordPress 7.1 (PHP 8.3) on:8889, MariaDB and Mailpit. Mailpit only accepts SMTP clients that log in asmailerwith the passwordpa'ss, so a password that gets altered on the way breaks delivery instead of going unnoticed.tests/E2E/support/setup.shinstalls WordPress, activates the plugin and saves the SMTP settings through WP-CLI. The tests read the delivered mail from the Mailpit API on:8026.npm run env:start,npm run test:e2eandnpm run env:stop, as in the README.Flows covered
tests/E2E/WpSimpleSmtp.spec.ts:Simple SMTP <noreply@example.org>.pa'ssand the test email still authenticates and arrives.Checked that the suite fails when it should: with the plugin deactivated all three fail; with a wrong password in
smtp_passall three fail, which confirms Mailpit enforces the login; without thewp_unslash()on save only the quote test fails.CI
playwright.ymlruns the suite in Chromium on every pull request, reports through thegithubreporter and uploads the HTML report as an artifact kept for 7 days. The plugin has no runtime dependencies, so the job needs neither PHP nor Composer.