dox Executable Documentation

Send mail

Not admin

Given the order 'Test Order'
Given I open the page for order 'Test Order'
Given I have entered the subject 'Hello'
Given I have entered the body 'What up?'
When I send the mail
Then I should be redirected to 'list.html'

Send mail

Given I am logged in as admin
Given the order 'Test Order'
Given I open the page for order 'Test Order'
Given I have entered the subject 'Hello'
Given I have entered the body 'What up?'
Given the user 'Homer'
Given the user 'Marge'
When I send the mail
Then 2 emails should be sent
Then a mail should be sent to 'Homer' with the subject 'Hello' and the body 'What up?'
Then a mail should be sent to 'Marge' with the subject 'Hello' and the body 'What up?'
Then the success message should be 'Email was sent to users'
Then there should be no error message

Only send to users without selection

Given I am logged in as admin
Given an order 'Test Order' with 1 menus each 1 dishes
Given dish 1 of menu 1 of this order is 'A'
Given the user 'Marge Simpson'
Given the user 'Homer Simpson'
Given the user 'Lisa'
Given 'Homer Simpson' selected dish 'A' for menu 1 of order 'Test Order'
Given I open the page for order 'Test Order'
Given I have entered the subject 'Hello {name}'
Given I have entered the body 'Order now: {url}'
Given I have selected to send the email only to users without selection
When I send the mail
Then the success message should be 'Email was sent to users without selections'
Then 2 emails should be sent
Then a mail should be sent to 'Marge Simpson' with the subject 'Hello Marge' and the body 'Order now: http://lacarte/order/select.html?order=1&key=key_Marge_Simpson'
Then a mail should be sent to 'Lisa' with the subject 'Hello Lisa' and the body 'Order now: http://lacarte/order/select.html?order=1&key=key_Lisa'

Empty field

Given I am logged in as admin
Given the order 'Test Order'
Given I open the page for order 'Test Order'
Given I have entered the subject 'Hello'
Given I have entered the body ''
Given I have selected to send the email only to users without selection
Given the user 'Homer'
When I send the mail
Then 0 emails should be sent
Then there should be no success message
Then the error message should be 'Please fill out subject and body to send an email'
Then the subject field should contain 'Hello'
Then the checkbox to send only to users without selection should be checked

Error while sending

Given I am logged in as admin
Given the order 'Test Order'
Given I open the page for order 'Test Order'
Given I have entered the subject 'Hello'
Given I have entered the body 'What up?'
Given the user 'Homer'
Given the user 'Marge'
Given an error 'Some bad thing' occurs while sending the mail
When I send the mail
Then the error message should be 'Some bad thing'
Then the subject field should contain 'Hello'
Then the body field should contain 'What up?'
Then the checkbox to send only to users without selection should not be checked