https://github.com/10up/cypress-wp-utils
Utilities library for WordPress E2E testing in the Cypress environment
https://github.com/10up/cypress-wp-utils
Last synced: 2 months ago
JSON representation
Utilities library for WordPress E2E testing in the Cypress environment
- Host: GitHub
- URL: https://github.com/10up/cypress-wp-utils
- Owner: 10up
- License: mit
- Created: 2022-02-25T10:42:18.000Z (over 3 years ago)
- Default Branch: develop
- Last Pushed: 2025-03-20T13:43:47.000Z (3 months ago)
- Last Synced: 2025-04-02T12:39:39.199Z (2 months ago)
- Language: TypeScript
- Homepage: https://10up.github.io/cypress-wp-utils/
- Size: 1.31 MB
- Stars: 23
- Watchers: 44
- Forks: 8
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Cypress Utilities for WordPress
> Utilities library for WordPress E2E testing in the Cypress environment.
[](#support-level)  [](https://github.com/10up/cypress-wp-utils/releases/latest)    [](https://github.com/10up/cypress-wp-utils/blob/develop/LICENSE.md)
## Prerequisites
This library requires Cypress. Use [@10up/cypress-wp-setup](https://github.com/10up/cypress-wp-setup) to set up Cypress automatically, including this library. If running tests against WordPress 6.3, you'll probably need to set `chromeWebSecurity: false` in your Cypress config file. This allows Cypress to properly interact with the iframed Block Editor.
## Installation
```sh
npm install @10up/cypress-wp-utils --save-dev
```## Usage
Import the libary in `support/index.js` file:
```js
// tests/cypress/support/index.js
import '@10up/cypress-wp-utils';
```Documentation for commands can be found at [https://10up.github.io/cypress-wp-utils/](https://10up.github.io/cypress-wp-utils/).
### IntelliSense and code completion for Cypress commands
Add a `tsconfig.json` file into the cypress folder to enable code completion for both Cypress built-in commands and commands from this library:
```js
{
"compilerOptions": {
"allowJs": true,
"types": ["cypress"]
},
"include": ["**/*.*"]
}
```### Adding a new command
This project uses `hygen` to scaffold new commands to reduce the effort of manually importing and registering new commands:
```sh
$ npx hygen cypress-command new customCommandLoaded templates: _templates
added: src/commands/custom-command.ts
inject: src/index.ts
inject: src/index.ts
inject: src/index.ts
```### Install the library locally
```sh
npm i -D path/to/the/library
```### Test against every WordPress major release
Every incoming pull request will automatically run tests against:
- our current minimum supported WordPress version, 5.7
- WordPress [latest release](https://github.com/WordPress/WordPress/tags)
- current WordPress [future release](https://github.com/WordPress/WordPress/tree/master)To run tests locally against every WordPress major release since minimum support (5.7) to the latest nightly build (e.g., 6.4-alpha) use this script:
```sh
./run-all-cores.sh
```It has optional parameter `-s` to specify only one test suite to run:
```sh
./run-all-cores.sh -s tests/cypress/intergation/login.test.js
```## Contributing
Please read [CODE_OF_CONDUCT.md](https://github.com/10up/cypress-wp-utils/blob/trunk/CODE_OF_CONDUCT.md) for details on our code of conduct, [CONTRIBUTING.md](https://github.com/10up/cypress-wp-utils/blob/trunk/CONTRIBUTING.md) for details on the process for submitting pull requests to us, and [CREDITS.md](https://github.com/10up/cypress-wp-utils/blob/trunk/CREDITS.md) for a list of maintainers, contributors, and libraries used in this repository.
## Support Level
**Beta:** This project is quite new and we're not sure what our ongoing support level for this will be. Bug reports, feature requests, questions, and pull requests are welcome. If you like this project please let us know, but be cautious using this in a Production environment!
## Like what you see?
[](http://10up.com/contact/)