Skip to content

Latest commit

 

History

History
73 lines (52 loc) · 2.44 KB

File metadata and controls

73 lines (52 loc) · 2.44 KB

E2E Testing Project

This project provides end-to-end (E2E) testing for a WordPress environment using Cypress and wp-env.

Prerequisites

  • Node.js
  • Docker
  • npm
  • wp-env (automatically installed via @wordpress/env)

Available Scripts

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.

Start development and test environment

Run npm run env:start to start both environments.

Running Tests

Open Cypress UI

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.

Run Cypress Tests Headlessly

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.

Destroy all environments

To destroy all environments manually:

npm run env:destroy

Configuration

Modify .wp-env.json in the root of the project to point to custom themes or plugins for testing.