Skip to content

Cypress Commands

Liam Defty edited this page May 20, 2020 · 7 revisions

To assist with writing tests, WP Cypress provides additional custom cypress commands:

Command Description Params Example
wp Execute the WP CLI Command [String] cy.wp('cli version')
seed Execute the WP CLI Seed Name [String] cy.seed('MySeeder')
installTheme Install a theme Theme Name [String] cy.installTheme('my-theme')
activateTheme Activate a theme Theme Name [String] cy.activateTheme('my-theme')
installPlugin Install a plugin Plugin Name [String] cy.installPlugin('my-plugin')
activatePlugin Activate a plugin Plugin Name [String] cy.activatePlugin('my-plugin')
deactivatePlugin De-activate a plugin Plugin Name [String] cy.deactivatePlugin('my-plugin')
visitAdmin Visit the WordPress admin panel None cy.visitAdmin()
editPost Visit the a post's edit page Post ID [Number] cy.editPost(1)
saveCurrentPost If on a post's edit page, save the post None cy.saveCurrentPost()
setSelection If a text input is active, set the selection. Text to Select [String] cy.get('.editable-element').click().setSelection('selection')