.ai/skills/writing-tests/SKILL.md
Use when writing, running, or debugging tests. Use when asked to add test coverage, fix a failing test, or run a test suite.
npx skillsauth add mailpoet/mailpoet writing-testsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
MailPoet has six test types across two plugins (free mailpoet/ and premium mailpoet-premium/).
Running tests: Unit and JavaScript tests run on the host machine from the plugin directory (e.g. mailpoet/). Integration, acceptance, and performance tests require Docker and must be run from the monorepo root.
if, for, or while in tests — if you need a loop, you probably need separate test cases instead.$i->wantTo(...) instead of comments — wantTo output is visible in test results, comments are not.data-automation-id attributes, ARIA roles, or short stable selectors. If a 3rd party component doesn't expose good hooks, add a data-automation-id or wrapper in the production code.waitForElement, waitForText, or similar helpers — never assume the page is loaded. Think about what could make the test fail intermittently and guard against it.Fast, isolated tests. No WordPress, no database. Run directly on the host machine from mailpoet/. Free plugin only — premium has no unit tests.
mailpoet/tests/unit/*Test.phpMailPoetUnitTest./do test:unit./do test:unit --file tests/unit/WooCommerce/TransactionalEmails/FontFamilyValidatorTest.php./do test:debug-unit --file tests/unit/..../do test:failed-unitTests with WordPress and database, run inside Docker. Slower than unit tests. Run from the monorepo root.
mailpoet/tests/integration/ and mailpoet-premium/tests/integration/*Test.php\MailPoetTest (extends Codeception)./do test:integration --skip-deps./do test:integration --skip-deps --file tests/integration/Logging/LogHandlerTest.php./do test:debug-integration --file tests/integration/..../do test:failed-integration./do test:woo-integration — with WooCommerce loaded./do test:base-integration — without WooCommerce./do test:multisite-integration — WordPress multisiteUse --skip-deps to avoid rebuilding Docker containers every run.
Browser-based end-to-end tests using Selenium and Chrome in Docker. The slowest test type — only add these when testing a real browser flow that can't be covered by unit or integration tests. Run from the mailpoet/ plugin directory.
mailpoet/tests/acceptance/ and mailpoet-premium/tests/acceptance/*Cest.php./do test:acceptance --skip-deps./do test:acceptance --skip-deps --file tests/acceptance/Misc/WordPressSiteEditorCest.php./do test:acceptance-multisite --skip-deps --file ..../do delete:docker — if you get unexpected errors, delete the Docker runtime and start fresh$i->pause(); in your test to pause execution and inspect the browser statevnc://localhost:5900 (password: secret).Frontend tests using Mocha + Chai + Sinon. Free plugin only.
mailpoet/tests/javascript/*.spec.ts./do test:javascriptLegacy Mocha test suite for the newsletter editor. Do not write new tests here — only modify existing ones if necessary. Free plugin only.
mailpoet/tests/javascript-newsletter-editor/./do test:newsletter-editorLoad and performance testing with k6 and Playwright. Free plugin only.
mailpoet/tests/performance/./do test:performance-setup./do test:performance --url=... --us=... --pw=..../do test:performance-clean| Type | Command | Runs in | Plugin |
| ----------------- | ----------------------------------- | ------- | --------- |
| Unit | ./do test:unit | Local | Free only |
| Integration | ./do test:integration --skip-deps | Docker | Both |
| Acceptance | ./do test:acceptance --skip-deps | Docker | Both |
| JavaScript | ./do test:javascript | Local | Free only |
| Newsletter Editor | ./do test:newsletter-editor | Local | Free only |
| Performance | ./do test:performance | Docker | Free only |
testing
Use when adding a changelog entry for a branch. Use after completing work on a feature, fix, or improvement that is user-facing.
testing
ALWAYS use when creating a new branch, starting work on a task, or working on a Linear issue. Handles branch naming, Linear lookup, and branch creation. Do NOT run git switch -c or git checkout -b directly.
development
Use when reviewing pull requests or local code changes. Use when asked to review a PR, review code, test changes, verify implementation quality, or do a code review.
development
Linting and code quality workflows for MailPoet development (PHP, JS/TS, CSS/SCSS). Use when fixing code style or following the development workflow.