This project provides end-to-end (E2E) testing for a WordPress environment using Cypress and wp-env.
- Node.js
- Docker
- npm
- wp-env (automatically installed via @wordpress/env)
| Script | Description |
|---|---|
npm run env:start |
Starts the WordPress development and testing environment using wp-env. |
npm run env:clean |
Cleans the WordPress test environment. Useful for ensuring a clean slate. |
npm run env:stop |
Stops the running WordPress environment. |
npm run env:destroy |
Deletes all docker containers, images and volumes. |
npm run cy:open:dev |
Starts the dev environment, cleans it, and opens Cypress Test Runner UI. |
npm run cy:run:dev |
Starts the dev environment, cleans it, and runs Cypress tests in headless mode. |
npm run cy:open:test |
Starts the test environment, cleans it, and opens Cypress Test Runner UI. |
npm run cy:run:test |
Starts the test environment, cleans it, and runs Cypress tests in headless mode. |
npm run env:start:all |
Starts the test and dev environment, and start phpMyAdmin and Mailpit. |
npm run env:stop:all |
Stops the test and dev environment, and stops and deletes phpMyAdmin and Mailpit. |
Run npm run env:start to start both environments.
Development environment
npm run cy:open:dev
Testing environment
npm run cy:open:test
This will launch the Cypress Test Runner where you can run tests interactively.
Development environment
npm run cy:run:dev
Testing environment
npm run cy:run:test
Runs all Cypress tests in the CLI, useful for testing locally and CI/CD environments.
To destroy all environments manually:
npm run env:destroy
Modify .wp-env.json in the root of the project to point to custom themes or plugins for testing.