Overview
Ghost 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/ghost-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/ghost-steps/tests/step-definitions/*.js',
'tests/step-definitions/**/*.js',
]
Steps
- Then I should see the post "Welcome to the test site" in the list
- Then the post "Welcome to the test site" should have the status "Published" in the list
- Then the list should have 3 posts
- Then the first row of the list should be "Welcome to the test site"
- When I filter the list by "Tag" with "News"
- When I clear the list filters
- When I sort the list by "Oldest first"
- When I open the tag "Guides" from the list
- When I set the tag name to "A tag from the suite"
- Then the tag name should be "Guides"
- When I save the tag
- When I delete the tag
- Then the tag "Guides" should have 2 posts
- Given there is no tag named "A tag from the suite"
- When I search the members for "Vera"
- When I set the member name to "Suite Member"
- When I add the label "Reader" to the member
- Then the member should have the label "Reader"
- Then the member should be ready to save
- When I save the member
- When I delete the member
- Given there is no member with the email "suite.member@example.com"
- Then I should see the staff user "Arthur Author" with the role "Author"
- When I open the staff user "Arthur Author"
- Then the staff user email should be "author@example.com"
- When I close the staff user
- Then the staff invitation should offer the role "Contributor"
- When I go to the settings section "Title & description"
- Then the settings section "Title & description" should show "Test site"
- When I press "Edit" in the settings section "Title & description"
- When I set "Site title" to "" in the settings section "Title & description"
- When I open the navigation settings
- When I add the navigation link "Docs" with the address "/docs/"
- When I remove the navigation link "Docs"
- Then the navigation settings should list the link "Home"
- When I save the navigation settings
- Given the navigation has no link "Docs"
- When I announce "A sale from the suite" to "Public visitors"
- When I clear the announcement
- Given there is no announcement
- When I start a new post
- When I open the editor of the post "Welcome to the test site"
- When I leave the editor
- When I set the editor title to "A post from the suite"
- When I write "The first paragraph." in the editor
- When I add a "Divider" card to the editor
- When I add an image card to the editor from the file "tests/fixtures/feature.png"
- Then the editor should have 1 "Divider" card
- Then the editor title should be "Welcome to the test site"
- Then the editor should contain "This is the welcome post."
- When I wait for the editor to save
- Then the editor status should be "Draft"
- Then the editor should offer "Publish"
- When I open the post settings
- Then the post settings should offer "Tags"
- When I set the post URL to "a-post-from-the-suite"
- Then the post URL should be "welcome-to-the-test-site"
- When I add the tag "News" to the post
- When I remove the tag "News" from the post
- Then the post should have the tag "News"
- When I set the post access to "Members only"
- Then the post access should be "Public"
- When I set the excerpt to "A short summary."
- Then the excerpt should be "The first post of the test site."
- When I feature the post
- Then the post should be featured
- When I set the feature image to the file "tests/fixtures/feature.png"
- When I remove the feature image
- Then the post should have a feature image
- When I preview the post
- Then the preview should show "A post from the suite"
- When I close the preview
- When I open the publish dialog
- Then the publish dialog should say "Ready, set, publish."
- When I close the publish dialog
- When I publish the post
- Then the publish confirmation should say "It’s out there"
- When I close the publish confirmation
- When I schedule the post for "2031-05-01" at "09:30"
- When I unpublish the post
- When I update the post
- When I delete the post from the editor
- Given there is no post titled "A post from the suite"
- Then the page generator should start with "Ghost"
- Then the page should be the home page
- Then the page should be the tag archive of "guides"
- Then the archive should be on page 1
- Then the archive should have a next page
- When I go to the next page of the archive
- Then I should see the post "Welcome to the test site" in the post feed
- Then the post feed should have 2 posts
- Then I should see "Home" in the site navigation
- Then I should see the announcement "A sale from the suite"
- When I open the site search
- When I search the site for "Travel diary 3"
- Then I should see the site search result "Travel diary 3"
- When I open the site search result "Travel diary 3"
- When I close the site search
- When I open the membership sign in form
- When I fill in "Email" with "member@example.com" in the membership form
- When I submit the membership form
- Then the membership form should show "Sign in"
- When I close the membership form
- Then I should see a subscribe button
- Then the post should be restricted to members
- Then I should be signed in as a member
- When I sign out as a member
- Given the mailbox is empty
- Then an e-mail with the subject "Sign in to Test site" should have been sent to "member@example.com"
- When I follow the link e-mailed to "member@example.com"
- When I enter the code e-mailed to "member@example.com" in the membership form
- Then the membership notification should say "You've successfully subscribed to"
- Given I am logged in to the admin as "owner"
- When I try to log in to the admin with the email "owner@example.com" and the password "wrong"
- Then I should see the sign in error "Your password is incorrect."
- When I log out of the admin
- Then I should be logged in to the admin
- When I go to the admin screen "Posts"
- Then I should be on the admin screen "Posts"
- Then the admin screen "Settings" should not be available
- Then I should see "Tags" in the admin menu
- When I click "Posts" in the admin menu
- Then the user menu should show "owner@example.com"
- Then I should see the notification "Post updated"
- When I dismiss the notifications
- Then I should see the field error "You must specify a name for the tag."
- Then I should see the dialog "Are you sure you want to delete this post?"
- When I answer the dialog with "Delete"
- When I choose "Delete member" from the "Actions" menu
- When I search the admin for "Travel diary 3"
- Then I should see the admin search result "Travel diary 3"
- When I open the admin search result "Travel diary 3"
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/ghost-steps.