Overview
Django 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-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-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": {
"administrator": {
"username": "administrator",
"password": "dD.123123ddd",
"email": "administrator@example.com"
},
"editor": {
"username": "editor",
"password": "dD.123123ddd",
"email": "editor@example.com"
},
"viewer": {
"username": "viewer",
"password": "dD.123123ddd",
"email": "viewer@example.com"
}
}
}
}
Steps
- Given I am a logged in user with the "editor" user
- When I log in as "editor" with the login form
- When I log in with the user name "nobody" and the password "Wrong-password-1"
- Then the login should be refused with "Please enter the correct username and password for a staff account."
- Given I am not logged in
- When I log out
- Then I should be logged in as "editor"
- Then I should be logged in
- Then I should be on the admin login page
- Given I am on the admin index
- Then the admin index should list the app "Polls"
- Then the app "Polls" should list the model "Questions"
- Then I should be able to add "Questions"
- When I open the "Questions" list
- Then I should be on the "Questions" list
- Then my recent actions should list "Recent action question"
- Then the breadcrumbs should read "Home › Polls › Questions"
- When I follow "Polls" in the breadcrumbs
- When I filter the navigation sidebar with "quest"
- Then the navigation sidebar should show "Questions"
- When I open "Tags" from the navigation sidebar
- When I switch the admin theme to "dark"
- Then the admin theme should be "dark"
- Then I should not be allowed to open "/admin/auth/user/"
- When I search the list for "train"
- Then the search should find 2 results
- Then the list should show "Which river is the longest?"
- Then the list should have 10 rows
- Then the list should count 24 questions
- Then the list columns should be "Question text", "Date published", "Category", "Published recently?"
- Then the "Which river is the longest?" row should show "Science" in the "Category" column
- Then the first row of the list should be "What's up?"
- Then "What's up?" should come before "Which fruit do you eat most?" in the list
- When I sort the list by "Date published"
- Then the list should be sorted by "Date published" in ascending order
- When I choose "Science" in the "By category" filter
- Then the "By category" filter should be set to "Science"
- When I clear all filters
- When I show the filter counts
- Then the "By category" filter should count 5 for "Science"
- When I choose "2025" in the date drill-down
- Then the date drill-down should offer "2025"
- When I go to page 2 of the list
- Then the list should be on page 2
- Then the list should have 3 pages
- When I show all rows of the list
- When I select "Which river is the longest?" in the list
- When I select all rows on the page
- When I select everything in the list
- When I clear the selection
- Then the selection should read "2 of 10 selected"
- Then the list should offer the action "Delete selected questions"
- When I run the action "Delete selected questions"
- When I open the add form of "Questions"
- When I open "Which river is the longest?" from the list
- When I open "What's up?" in the "Questions" list
- When I set "Question text" to "Who is there?"
- When I set these fields:
- Then "Question text" should be set to "Who is there?"
- Then "Total votes" should be read-only
- Then the form should have the section "Classification"
- Then the section "Classification" should have the field "Category"
- When I open the section "Date information"
- Then the section "Date information" should be closed
- When I type "Sci" in the "Category" autocomplete
- Then the "Category" autocomplete should offer "Science"
- When I choose "Science" in the "Category" autocomplete
- When I choose "Fun" in the "Tags" selector
- When I choose all in the "Tags" selector
- When I filter the available "Tags" with "Fu"
- Then the "Tags" selector should have "Fun" chosen
- When I save the form
- Then the form should be saved
- Then I should see the success message "The question “What is new?” was added successfully."
- Then the field "Question text" should have the error "This field is required."
- Then the form should show the error "Please correct the errors below."
- Then the form should have no errors
- Then I should see the "Add question" form
- Then the form should be read-only
- Then the "Choices" inline should have 3 rows
- When I add a row to the "Choices" inline
- When I remove row 4 of the "Choices" inline
- Then row 2 of the "Choices" inline should be marked for deletion
- When I set "Choice text" to "Yes" in row 1 of the "Choices" inline
- When I fill in the "Choices" inline:
- Then row 1 of the "Choices" inline should have "Yes" in "Choice text"
- Then the "Choices" inline should list "Yes"
- Then the delete confirmation should list "Question: Delete test question"
- Then the delete confirmation should count "Questions: 1"
- When I confirm the deletion
- When I cancel the deletion
- Then the deletion should be refused
- When I delete "Delete test question" from the "Questions" list
- When I open the history
- Then the history should list "Added."
- Then the history should have 1 entry
- When I change my password to "Changed-pass-2026!"
- When I try to change my password with the old password "Not-the-password-1" and the new passwords "Changed-pass-2026!" and "Changed-pass-2026!"
- Then my password should be changed
- Then the password change should be refused with "Your old password was entered incorrectly. Please enter it again."
- Then the user "editor" should be staff
- Then the user "editor" should be in the "Editors" group
- Then the "Editors" group should have the "Polls | question | Can change question" permission
- Given there is no "Data step question" in the "Questions" list
- Given there is a "Data step question" in the "Questions" list with:
- Then there should be a "Data step question" in the "Questions" list
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-steps.