Overview
Craft 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/craft-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/craft-cms-steps/tests/step-definitions/*.js',
'tests/step-definitions/**/*.js',
]
Steps
- When I upload the file "tests/fixtures/pixel.png" to the assets index
- Then "Harbour" should show a thumbnail in the index
- Then I should see the file conflict question
- When I answer the file conflict with "Keep both"
- When I go to the control panel page "entries"
- When I click "Entries" in the control panel navigation
- Then I should see "Entries" in the control panel navigation
- Then the control panel navigation item "Entries" should be selected
- When I click "Tokens" under "GraphQL" in the control panel navigation
- When I choose "Notes" from the menu of the "Blog" crumb
- Then the control panel breadcrumb should be "Entries > Blog > Launch day"
- When I click "Blog" in the control panel breadcrumb
- Then the control panel heading should be "Entries"
- Then I should see the notification "Entry saved."
- Then I should not see an error notification
- Then I should see the unauthorized screen
- Then I should be allowed to open the control panel page "entries"
- When I open the "Passkeys" screen of the section navigation
- Then the control panel system name should be "Webship Test Site"
- When I start a new entry in the "Blog" section
- When I save the edit form
- Then the save button of the edit form should read "Create entry"
- When I choose "Save and continue editing" from the save menu of the edit form
- When I choose "Delete entry" from the actions menu of the edit form
- Then the actions menu of the edit form should offer "Delete entry"
- Then the edit form should have the "Summary" field
- When I open the "Details" tab of the edit form
- When I wait for the edit form to store my changes
- Then I should see the unsaved changes notice
- When I discard the unsaved changes
- When I create a draft from the edit form
- When I apply the draft
- Then the edit form should show the "Draft 1" version
- When I switch the edit form to the "Current" version
- Then the version menu of the edit form should list "Revision 2"
- Then the edit form should show the status "Live"
- When I open "Launch day" in a slide-out editor
- Then I should see a slide-out editor
- When I close the slide-out editor
- When I open the preview of the edit form
- Then the preview should show "Launch day"
- When I close the preview
- When I view the page of the edit form on the site
- When I fill in the "Summary" field with "A short summary."
- Then the "Summary" field should have the value "A short summary."
- When I fill in the rich text field "Body" with "The full story."
- Then the rich text field "Body" should contain "The full story."
- When I switch the "Featured" switch on
- Then the "Featured" switch should be on
- When I choose "Guide" in the "Kind" dropdown
- Then the "Kind" dropdown should show "Guide"
- When I set the "Event date" date to "3/15/2026"
- Then the "Event date" date should be "3/15/2026"
- When I add "Harbour" to the "Hero image" field
- When I remove "Harbour" from the "Hero image" field
- Then the "Hero image" field should hold "Harbour"
- When I upload the file "tests/fixtures/pixel.png" to the "Hero image" field
- When I add the tag "howto" to the "Keywords" field
- When I add a "Text block" block to the "Blocks" field
- When I fill in "Text" with "A first paragraph." in block 1 of the "Blocks" field
- When I delete block 2 of the "Blocks" field
- Then the "Blocks" field should have 2 blocks
- Then block 1 of the "Blocks" field should be a "Text block" block
- Then the "Summary" field should have the error "cannot be blank"
- Then the error summary of the edit form should count 3 errors
- Then the error summary of the edit form should name "Summary"
- Then the "Summary" field should be marked as required
- Then the "Summary" field should have 160 characters left
- When I open the "Blog" source of the index
- Then I should see the "Blog" source in the index
- Then the "Blog" source of the index should be selected
- When I search the index for "launch"
- When I clear the search of the index
- When I filter the index by the "Disabled" status
- When I sort the index by "Title" in "ascending" order
- When I switch the index to the "cards" view
- Then I should see "Launch day" in the index
- Then the index should hold 14 items
- Then the index should show items 1 to 100 of 120
- When I go to the next page of the index
- Then "Launch day" should have the status "Live" in the index
- Then "Harbour" should show "harbour.png" in the "Filename" column of the index
- Then "Launch day" should come before "Writing good scenarios" in the index
- When I select "Launch day" in the index
- When I select all items in the index
- Then 2 items should be selected in the index
- When I set the status of the selected items to "Disabled"
- When I choose "Delete" for the selected items of the index
- When I click the "Entry" column heading of the index
- Then the index should be sorted by "Post Date" in "descending" order
- When I show the "Slug" column of the index
- Then "Team" should be at level 2 in the index
- When I move "Contact" above "About" in the index
- Then the selected items should offer the action "Delete"
- When I open "Launch day" from the index
- Given there is no entry titled "Draft idea"
- Given I am logged in to the control panel as "admin"
- When I log in to the control panel with the username "admin" and the password "wrong-password"
- When I log out of the control panel
- Then I should be logged in to the control panel
- Then I should be logged in to the control panel as "admin"
- Then I should see the control panel login form
- Then I should see the login error "Invalid username or password."
- When I ask for a password reset for "admin"
- Then I should see the password reset confirmation
- When I open the password reset link sent to "admin@example.com"
- When I choose the new password "Admin123456789!"
- Then I should see the new password error "should contain at least 6 characters"
- Then "blog/launch-day" should be published on the site
- Then the site should be powered by "Craft CMS"
- When I go to page 2 of the "blog" listing
- Then I should be on page 2 of the listing
- When I visit the page of "Launch day" from the index
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/craft-cms-steps.