cypress-drupal

Cypress Commands for Drupal


Keywords
JavaScript, Testing, Cypress.io, Drupal
License
GPL-2.0
Install
npm install cypress-drupal@1.1.0

Documentation

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.js
import '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']);