Overview
Plane 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/plane-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/plane-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": {
"owner": {
"username": "owner@example.com",
"password": "dD.123123ddd",
"name": "owner"
},
"member": {
"username": "member@example.com",
"password": "dD.123123ddd",
"name": "member"
},
"reader": {
"username": "reader@example.com",
"password": "dD.123123ddd",
"name": "reader"
},
"stranger": {
"username": "stranger@example.com",
"password": "dD.123123ddd",
"name": "stranger"
}
}
}
}
Steps
- Given I am a logged in user with the "member" user
- When I log in with the "member" user
- When I log in as "member@example.com" with the password "not-the-right-password"
- Given I am not logged in
- When I log out
- Then I should be logged in as "member"
- Then I should not be logged in
- Then the login should be refused with "Authentication failed"
- When I open the project "WEB"
- Then I should be refused the project "WEB"
- Given there is a work item "Webship test work" in the project "WEB"
- Given there is no work item "Webship test new" in the project "WEB"
- Then the work item list should show "The greeting script says Helo instead of Hello"
- When I create a work item "Webship test new" in the project "WEB"
- When I open the work item "Webship test work"
- When I set the state of the work item to "In Progress"
- Then the state of the work item should be "In Progress"
- When I add the comment "Checked on the test site" to the work item
- Then the work item should show the comment "Checked on the test site"
- When I assign the work item to "owner"
- Then the work item should be assigned to "member"
- Then the work item should be last edited by "owner"
- Then I should not be able to change the state of the work item
- Then I should not be able to create a work item in the project "WEB"
- Then I should be refused the work item "WEB-1"
- When I open the cycle "Sprint 1" of the project "WEB"
- Then the cycle should list the work item "The greeting script says Helo instead of Hello"
- When I open the cycles of the project "WEB"
- Then the cycles should list "Sprint 1"
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/plane-steps.