Overview
Drupal CMS Steps adds step definitions to Webship-js 2.0.x for the markup the platform itself renders, regardless of theme or distribution, so scenarios read as plain sentences instead of CSS selectors. It is a plugin for Webship-js: it ships one file of step definitions you drop into an existing test project, and it composes with the built-in steps rather than duplicating them.
Install
npm install --save-dev @webship-js/drupal-cms-steps
Then add its step file to cucumber.js beside the Webship-js steps:
require: [
'node_modules/webship-js/tests/step-definitions/**/*.js',
'node_modules/@webship-js/drupal-cms-steps/tests/step-definitions/*.js',
'tests/step-definitions/**/*.js',
]
Steps
- Given a new Canvas page "Landing" at "/landing"
- When I create a Canvas page "Welcome" at "/welcome" with the "sdc.mercury.heading" component:
- When I create a Canvas page "Promo" at "/promo" with the "Hero CTA" component
- When I add the "Heading" component to the bottom of the "Landing" Canvas page and publish it:
- When I add the "Text" component to the bottom of the "Landing" Canvas page
- When I publish the Canvas page changes
- When I delete the "Landing" Canvas page
- When I visit the "Home" Canvas page
- Then the "Home" Canvas page should exist
- Then the Canvas component library should list the "Heading" component
- When I open the "Home" Canvas page in the editor
- Then I should see the Canvas editor
- When I open the "Components" tab in the Canvas Library
- Then the Canvas Library "Components" tab should list "Heading"
- When I insert the "Heading" component from the Canvas Library
- When I set the Canvas component option "Heading" to "Welcome"
- When I publish the Canvas page changes through the editor
- When I filter the Canvas Library by "Heading"
- Then the "Landing" Canvas page should have 1 component
- Then I should see the cookie consent dialog
- When I accept the cookie consent
- Given the cookie consent is not given yet
- When I log in with the email address of "content editor"
- Given I am on the dashboard
- Then I should see the dashboard
- Then I should see the "Recent content" dashboard section
- When I open the moderation sidebar
- Then the moderation sidebar should show "Draft"
- Given the site template is "drupal_cms_starter"
- Given the "drupal_cms_forms" recipe is applied
- Then the site template should be "drupal_cms_starter"
- Then the site should have at least 1 Canvas page
Every assertion step reads both polarities from one definition: should see and should not see are the same step. Source and issues: github.com/webship/drupal-cms-steps.