cypress-drupal
A collection of useful Cypress commands for Drupal.
Setup
Install this package via NPM:
npm install --dev cypress-drupal
Include this package into your Cypress command file:
// cypress/support/commands.jsimport 'cypress-drupal';
Optional: Add the string for running drush commands to cypress.json:
{ ... "env": { "drupalDrushCmdLine": "/user/bin/drush %command" } }
Commands
Drupal Collection
drupalLogin( username , password )
Begins the user's authenticated session.
cy.drupalLogin('admin', 'admin')
drupalLogout()
Ends the user's authenticated session.
cy.drupalLogout()
drupalDrushCommand( command )
Issues a drush command.
The command can be passed as string or an array.
cy.drupalDrushCommand('status'); cy.drupalDrushCommand(['upwd', 'admin', 'admin']);