Overview
Odoo 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/odoo-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/odoo-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": {
"admin": {
"username": "admin",
"password": "admin"
},
"salesperson": {
"username": "salesperson",
"password": "salesperson"
},
"accountant": {
"username": "accountant",
"password": "accountant"
},
"employee": {
"username": "employee",
"password": "employee"
},
"portal": {
"username": "portal",
"password": "portal"
}
}
}
}
Steps
- Given I am a logged in user with the "admin" user
- When I log in as "admin" with password "secret"
- Given I am on the login page
- Then I should see the login form
- Given I am not logged in
- Then I should see an login error
- When I log out
- Then I should be logged in
- Then I should be logged in as "admin"
- When I create a new record
- When I save the record
- When I try to save the record
- When I discard the changes
- Then the record should have unsaved changes
- When I set the "Customer" field to "Azure Interior"
- When I set the fields:
- When I check the "Can be Sold" field
- When I remove "Product" from the "Tags" field
- Then the "Customer" field should be "Azure Interior"
- Then the "Can be Sold" field should be checked
- Then I should see the "Customer" field
- Then the "Customer" field should be required
- When I click the "Confirm" button in the form
- Then I should see the "Confirm" button in the form
- Then the status should be "Sales Order"
- When I set the stage to "Proposition"
- When I open the "Order Lines" tab
- Then I should see the "Order Lines" tab
- When I add a line with "Add a product":
- Then I should see the line "Office Chair"
- Then I should see a dialog
- Then I should see "Are you sure" in the dialog
- When I click the "Ok" button in the dialog
- When I confirm the dialog
- Then I should see an access error
- Then I should see the notification "Invalid fields"
- When I close the notifications
- Then I should see the chatter
- When I log the note "Called the customer, waiting for the order"
- When I send the message "Your order is confirmed"
- Then I should see "Called the customer" in the chatter
- Then I should be in the web client
- Then I should be in the portal
- When I open the user menu
- Then I should see "My Profile" in the user menu
- When I choose "My Profile" in the user menu
- Then I should be on a website page
- Then I should see the top menu
- Then I should see the footer
- Then I should be on the blog page
- Then I should be on an blog post page
- Then I should see the blog post titled "Customer Reviews"
- Then I should be on the shop page
- Then I should be on an product page
- When I open the first product in the shop
- When I search the shop for "mug"
- Then I should see shop search results for "desk"
- Then I should see the "Customizable Desk" product in the shop
- When I add the product to the cart
- Then I should see "1" item in the cart
- Then I should be on the events page
- Then I should be on the jobs page
- Then I should see job openings
- Given I am on the contact us page
- Then I should see the contact us form
- When I fill in the contact form with:
- When I submit the contact form
- Then I should see the contact form confirmation
- Then I should see a contact form error
- Then I should be able to edit the website
- When I open the website editor
- Then I should see the website editor
- Then I should see the "Text" building block
- When I save the website editor
- Then I should be on the 404 page
- When I open the "CRM" app
- Then I should see the "CRM" app
- Then I should be in the "CRM" app
- When I open the "Orders > Quotations" menu
- Then I should see the "Orders" menu
- When I open the "sale.action_quotations_with_onboarding" action
- Then I should see "Quotations" in the breadcrumb
- Then the breadcrumb title should be "Quotations"
- When I go back to "Quotations" in the breadcrumb
- When I switch to the list view
- Then I should see the list view
- When I search the records for "chair"
- When I filter the records by "Won"
- When I group the records by "Salesperson"
- Then I should see the "My Pipeline" search facet
- When I remove the "My Pipeline" search facet
- When I clear the search
- Then I should see the "Azure Interior" record
- When I open the "Azure Interior" record
- Then I should see 3 records
- Then I should see no records
- When I select the "S00007" record
- When I select all records
- Then I should see 1 selected record
- When I choose "Delete" in the Actions menu
- Then I should see the "Mitchell Admin" group
- When I open the "Mitchell Admin" group
- Then the pager should read "1-15 / 15"
- When I go to the next page of records
- Then I should see the "New" column
- Then I should see the "Quote for 600 Chairs" card in the "Qualified" column
- Then the "New" column should have 2 cards
- When I drag the "Quote for 600 Chairs" card to the "Proposition" column
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/odoo-steps.