Overview
django 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/django-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/django-cms-steps/tests/step-definitions/*.js',
'tests/step-definitions/**/*.js',
]
Test users
The steps that log in use accounts that already exist on the site, by the handle a feature names (Given I am a logged in user with the "admin" user). The site build creates them; a feature never creates or deletes an account. They are listed in cucumber.js under worldParameters. These are the test accounts of the pack's own test site: put the accounts of your site in your project, and keep real passwords in environment variables.
{
"worldParameters": {
"users": {
"admin": {
"username": "admin",
"password": "admin"
},
"editor": {
"username": "editor",
"password": "editor"
}
}
}
}
Steps
- Given I am a logged in user with the "admin" user
- When I log in as "admin" with password "wrong-password"
- Then I should see a login error
- Given I am on the login page
- Then I should see the login form
- Given I am not logged in
- When I log out
- Then I should be logged in
- Given I am on the users list
- Then I should see "editor" in the admin list
- When I open "editor" in the admin list
- Then the user "editor" should be staff
- Then the user "editor" should be in the "Editors" group
- Then the "Editors" group should have the "Can change page" permission
- Then the administration should offer "Page contents"
- When I open the create wizard
- Then the create wizard should offer "New page"
- When I create a page titled "News" with the wizard
- When I open the page for editing
- Then I should be in edit mode
- When I preview the page
- When I open the structure board
- Then I should see the structure board
- Then I should see the "Page Content" placeholder
- When I add a "Text" plugin to the "Page Content" placeholder
- When I add a text plugin with "Hello, world." to the "Page Content" placeholder
- When I fill in the text editor with "Hello, world."
- Then the text editor should contain "Hello, world."
- When I save the plugin
- When I edit the "Text" plugin in the "Page Content" placeholder
- When I delete the "Text" plugin in the "Page Content" placeholder
- Then the "Page Content" placeholder should have a "Text" plugin
- Then the "Page Content" placeholder should have 1 plugin
- When I publish the page
- When I unpublish the page
- Then the page version should be "Draft"
- Then the page should be at version 1
- Then the page should have editable plugins
- Given I am on the CMS page tree
- Then I should see the page tree
- Then I should see "Home" in the page tree
- Then the page "About" should be published in the page tree
- Then the page "Team" should be a sub page of "About" in the page tree
- Then the page "Home" should be the home page in the page tree
- When I open the page "Draft notes" from the page tree
- When I open the settings of the page "About" in the page tree
- When I publish the page "Draft notes" in the page tree
- When I delete the page "News" in the page tree
- When I move the page "Team" under the page "Contact" in the page tree
- Then I should be allowed to open "/admin/cms/pagecontent/"
- Then the navigation menu should list "About"
- When I click "About" in the navigation menu
- Then "About" should be the active navigation menu entry
- Then I should see the breadcrumb
- Then the breadcrumb should contain "About"
- When I switch the language to "Deutsch"
- Then the language chooser should offer "Deutsch"
- Then the active language should be "English"
- Then I should be on the page not found page
- Then I should see the CMS welcome screen
- Then the CMS version should start with "5"
- Then I should see the CMS toolbar
- When I click "Pages" in the CMS toolbar menu
- When I click "Page settings" in the "Page" toolbar menu
- Then the toolbar should have the "Page" menu
- Then the "site" toolbar menu should list "Pages"
- When I click the "Create" toolbar button
- Then the toolbar should have the "Publish" button
- Then I should see the CMS message "Version published"
- Then the CMS modal should be open
- Then the CMS modal title should be "Create"
- Then the CMS sideframe should be showing "/admin/cms/pagecontent/"
- Then I should see "Provide a title for the new page." in the CMS modal
- When I fill in "Title" with "News" in the CMS modal
- When I click "Next" in the CMS modal
- When I close the CMS modal
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/django-cms-steps.