Overview
Roundcube 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/roundcube-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/roundcube-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": {
"alice": {
"username": "alice@example.com",
"password": "dD.123123ddd",
"email": "alice@example.com",
"name": "Alice Test"
},
"bob": {
"username": "bob@example.com",
"password": "dD.123123ddd",
"email": "bob@example.com",
"name": "Bob Test"
}
}
}
}
Steps
- Given I am logged in to the webmail as "alice"
- When I log in to the webmail with the address "alice@example.com" and the password "Not-the-password-1"
- Then the webmail should refuse the login with "Login failed."
- Then I should be logged in to the webmail as "alice@example.com"
- When I log out of the webmail
- Then the webmail should say "Message(s) moved to Trash successfully."
- When I open the folder "Sent"
- Then the folder "Inbox" should show 2 unread
- Then the message list should show "Webship weekly report"
- Then the message list should show "Lunch on Friday", "Webship weekly report" in this order
- Then the message "Webship weekly report" should be unread
- When I open the message "The test plan, attached"
- Then the message should be from "Bob Test"
- Then the message should list the attachment "test-plan.txt"
- When I mark the message "Webship weekly report" as flagged
- When I delete the message "Webship news: November"
- When I move the message "Webship weekly report" to the folder "Projects"
- When I search the mail for "report"
- When I start a new message
- When I reply to the message "Webship weekly report"
- When I write to "bob@example.com"
- When I set the subject to "Webship test hello"
- When I write the text "A test mail from the scenario."
- When I insert the response "Thanks"
- Then the message should go to "Bob Test"
- When I send the message
- When I save the message as a draft
- When I discard the message
- When I create the folder "Webship test folder"
- When I rename the folder "Projects" to "Webship test projects"
- When I delete the folder "Webship test folder"
- Then the folder list should show "Webship test folder"
- When I add the identity "Alice at work" with the address "alice@example.com"
- When I delete the identity "Webship test identity <alice@example.com>"
- Then the identities should list "Alice Test <alice@example.com>"
- When I add the response "Webship test response" with the text "I will answer tomorrow."
- When I delete the response "Webship test response"
- Then the responses should list "Thanks"
- When I set the preference "Time format" to "07:30 AM" in "User Interface"
- Then the preference "Time format" in "User Interface" should be "07:30 AM"
- When I add the contact "Webship Tester" with the address "tester@example.com"
- Then the contact list should show "Bob Test"
- When I open the contact "Bob Test"
- Then the contact should show "bob@example.com"
- When I delete the contact "Webship Tester"
- When I create the group "Webship test group"
- Then the address book should list the group "Webship team"
- When I add the contact "Carol Test" to the group "Webship team"
- Then the group "Webship team" should list "Bob Test"
- When I delete the group "Webship test group"
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/roundcube-steps.