PHPackages                             kanopi/cypress-wordpress-support-commands - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. kanopi/cypress-wordpress-support-commands

ActiveCypress-support[Testing &amp; Quality](/categories/testing)

kanopi/cypress-wordpress-support-commands
=========================================

 A set of default support commands to get you jumpstarted configuring Cypress for WordPress.

0.2.5(2mo ago)1761↑275%[1 PRs](https://github.com/kanopi/cypress-wordpress-support-commands/pulls)GPL-2.0-or-laterJavaScript

Since Sep 29Pushed 2mo agoCompare

[ Source](https://github.com/kanopi/cypress-wordpress-support-commands)[ Packagist](https://packagist.org/packages/kanopi/cypress-wordpress-support-commands)[ Docs](https://github.com/kanopi/cypress-wordpress-support-command)[ RSS](/packages/kanopi-cypress-wordpress-support-commands/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (1)Versions (11)Used By (0)

Cypress Support Commands for WordPress
======================================

[](#cypress-support-commands-for-wordpress)

Common commands that can be used to create Cypress tests for WordPress

Installation
------------

[](#installation)

### Install/update composer installers.

[](#installupdate-composer-installers)

Add two entries in composer.json for an install-type and its path:

```
"installer-types": ["cypress-support"],
"installer-paths": {
 "tests/cypress/cypress/support/{$name}": [
   "type:cypress-support"
 ]
}

```

Make sure you also add that installed path to your `.gitignore` file. I.E. `tests/cypress/cypress/support/cypress-wordpress-support-commands`

### Tell Cypress where to import the tests

[](#tell-cypress-where-to-import-the-tests)

In the `support` folder for where your Cypress tests are located, edit `commands.js` and add the following:

```
// Import commands.js using ES2015 syntax:
import './cypress-wordpress-support-commands/commands'

```

Install the package using Composer:

```
composer require kanopi/cypress-wordpress-support-commands
```

Commands
--------

[](#commands)

### Authentication Commands

[](#authentication-commands)

#### login

[](#login)

Login to WordPress admin. Uses 'cypress' user with 'cypress' password by default.

```
cy.login(); // Login as default user
cy.login('username', 'password'); // Login as specific user
```

#### logout

[](#logout)

Logout from WordPress by clearing all cookies.

```
cy.logout();
```

### Content Creation Commands

[](#content-creation-commands)

#### setTitle

[](#settitle)

Sets the post/page title in the WordPress editor.

```
cy.setTitle('Test Title');
```

#### createComponentHeading

[](#createcomponentheading)

Adds a heading component and sets text content. Generates random text if no content provided.

```
cy.createComponentHeading('My Heading Text');
cy.createComponentHeading(); // Uses random text
```

#### createComponentParagraph

[](#createcomponentparagraph)

Adds a paragraph component and sets text content. Generates random text if no content provided.

```
cy.createComponentParagraph('My paragraph text');
cy.createComponentParagraph(); // Uses random text
```

#### createComponentImage

[](#createcomponentimage)

Adds an image component and uploads a file. Files should be stored in the 'fixtures' folder.

```
cy.createComponentImage('image-sample_01.png');
cy.createComponentImage('image-sample_01.png', true); // Use media library
```

### Component Management Commands

[](#component-management-commands)

#### selectComponent

[](#selectcomponent)

Opens the component inserter and selects a component by name.

```
cy.selectComponent('Heading');
cy.selectComponent('Paragraph');
cy.selectComponent('Image');
```

#### editorReset

[](#editorreset)

Clicks the page to deselect components and restore the "Add Component" button. Typically used after adding/editing components.

```
cy.editorReset();
```

### Publishing Commands

[](#publishing-commands)

#### publish

[](#publish)

Clicks the publish button and publishes the post/page. Compatible with WordPress 6.9+ which uses the REST API for publishing.

```
cy.publish(); // Publishes and views post
cy.publish(false); // Publishes without viewing
```

#### save

[](#save)

Saves the post/page as published content.

```
cy.save(); // Saves and views post
cy.save(false); // Saves without viewing
```

#### saveDraft

[](#savedraft)

Saves the post/page as a draft.

```
cy.saveDraft();
```

#### update

[](#update)

Updates an existing published post/page.

```
cy.update(); // Updates and views post
cy.update(false); // Updates without viewing
```

### Media Library Commands

[](#media-library-commands)

#### mediaLibraryAdd

[](#medialibraryadd)

Uploads a file directly to the media library. Files should be stored in 'cypress/fixtures/'.

```
cy.mediaLibraryAdd('sample.png');
```

#### mediaLibrarySelect

[](#medialibraryselect)

Opens media library modal and selects an existing media item by filename. Compatible with sites using the [WP Media Folder](https://www.joomunited.com/wordpress-products/wp-media-folder) plugin, which replaces the standard media grid with a folder-based view.

```
cy.mediaLibrarySelect('#field_media_assets-media-library-wrapper', 'sample.png');
```

#### mediaLibraryUpload

[](#medialibraryupload)

Uploads a file through the media library modal. Files should be stored in 'cypress/fixtures/'.

```
cy.mediaLibraryUpload('#selector', 'sample.png');
```

#### setFeaturedImage

[](#setfeaturedimage)

Sets the featured image for a post/page. Files should be stored in 'cypress/fixtures/'.

```
cy.setFeaturedImage('image-sample_01.png');
```

### Post Settings Commands

[](#post-settings-commands)

#### setVisibility

[](#setvisibility)

Sets the visibility option for a post/page. Options: public, private, password.

```
cy.setVisibility(); // Defaults to public
cy.setVisibility('public');
cy.setVisibility('private');
cy.setVisibility('password'); // Uses default password 'password'
cy.setVisibility('password', '123'); // Uses custom password
```

### Navigation Commands

[](#navigation-commands)

#### visitEditPage

[](#visiteditpage)

Visits a WordPress edit page and waits for common AJAX requests to complete.

```
cy.visitEditPage('/wp-admin/post-new.php');
cy.visitEditPage('/wp-admin/post.php?post=123&action=edit');
```

### Utility Commands

[](#utility-commands)

#### wp

[](#wp)

Executes WP-CLI commands through various environments (Docksal, Lando, DDEV, Pantheon, Tugboat).

```
cy.wp('cache flush');
cy.wp('user list');
```

#### anonUrl404

[](#anonurl404)

Tests that a URL returns a 404 response for anonymous users.

```
cy.anonUrl404('/private-post-url');
```

#### enterPostPassword

[](#enterpostpassword)

Enters password for password-protected posts/pages.

```
cy.enterPostPassword('mypassword');
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance85

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 93.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~21 days

Recently: every ~1 days

Total

8

Last Release

84d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bf9dca5c46910be861bb00920034637b5a36a1f6277413be6817a50a1ce6fc74?d=identicon)[kanopi\_studios](/maintainers/kanopi_studios)

---

Top Contributors

[![paulsheldrake](https://avatars.githubusercontent.com/u/1062456?v=4)](https://github.com/paulsheldrake "paulsheldrake (15 commits)")[![shirazd](https://avatars.githubusercontent.com/u/464638?v=4)](https://github.com/shirazd "shirazd (1 commits)")

---

Tags

cypresswordpresstestingwordpressautomatione2ecypresssupport-commandscypress.iointegration-test

### Embed Badge

![Health badge](/badges/kanopi-cypress-wordpress-support-commands/health.svg)

```
[![Health](https://phpackages.com/badges/kanopi-cypress-wordpress-support-commands/health.svg)](https://phpackages.com/packages/kanopi-cypress-wordpress-support-commands)
```

###  Alternatives

[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[yoast/wp-test-utils

PHPUnit cross-version compatibility layer for testing plugins and themes build for WordPress

632.3M52](/packages/yoast-wp-test-utils)[nearsoft/php-selenium-client

This library allows creating Selenium Server V2 tests in PHP. It communicates with the WebDriver API through the official JsonWireProtocol.

10854.9k](/packages/nearsoft-php-selenium-client)[noeldemartin/laravel-cypress

Laravel package used for running tests with Cypress.

14179.5k](/packages/noeldemartin-laravel-cypress)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
