5. Tutorials and Tests
tutorialstutorials : sequence of steps. Each step wait for the user
to do something, before moving to the next step.
teststests : same, but the js code simulates an user
·
·
6. Use Cases
guide your users with tutorials
test any kind of business flow (customer buying an event
ticket, ...)
test any odoo addon (application in backend) (not ready
yet)
·
·
·
8. Architecture
manage all tours (tests/tutorials)
standalone (doesn't use odoo framework)
save its state in local storage (survive a refresh/page
change)
simulates all DOM events
automatically adds tutorials in the help menu
tests will only be successful if all steps are completed
·
·
·
·
·
·
10. API
A tour is defined by some simple attributes:
id
name
path
mode
id:: 'shop_customize',,
name:: "Customize the page and search a product",,
path:: '/shop',,
mode:: 'test',,
and a more complex one: steps.
·
·
·
·
11. Steps definition
A step is defined with a selection of attributes:
title
element
waitFor
waitNot
some others
{{
title:: "open customize menu",,
element:: '#customize-menu-button',,
},},
{{
title:: "click on 'Product Attribute's Filters'",,
element:: "#customize-menu a:contains(Product Attribute's Filters)",,
},},
·
·
·
·
·
13. Tests: automated actions!
Actions are simulated on the 'element':
mouseenter, mousedown, mouse click, mouse up, mouse
leave
if attribute sampleText: idem, then keydown,
if input/select, value is set to sampleText
otherwise, html is set to sampleText
if snippet: simulates drag and drop with mousedown,
mousemove,mouseup
{{
title:: "set one iPod",,
waitNot:: '#cart_products tr:contains("Apple In-Ear Headphones")',,
element:: '#cart_products input.js_quantity',,
sampleText:: '1',,
},},
·
·
·
·
·
15. Create a product
website..Tour..register({({
id:: 'shop',,
name:: _t(("Create a product"),),
steps:: [[
{{
title:: _t(("Welcome to your shop"),),
content:: _t(("You successfully installed the e-commerce. This guide will help you to create your product a
popover:: {{ next:: _t(("Start Tutorial"),), end:: _t(("Skip It")) },},
},},
{{
element:: '#content-menu-button',,
placement:: 'left',,
title:: _t(("Create your first product"),),
content:: _t(("Click here to add a new product."),),
popover:: {{ fixed:: truetrue },},
},},
......
16. Create a product (2)
{{
element:: 'a[data-action=new_product]',,
placement:: 'left',,
title:: _t(("Create a new product"),),
content:: _t(("Select 'New Product' to create it and manage its properties to boost your sales."),),
popover:: {{ fixed:: truetrue },},
},}, {{
element:: '.modal #editor_new_product input[type=text]',,
sampleText:: 'New Product',,
placement:: 'right',,
title:: _t(("Choose name"),),
content:: _t(("Enter a name for your new product then click 'Continue'."),),
},}, {{
waitNot:: '.modal input[type=text]:not([value!=""])',,
element:: '.modal button.btn-primary',,
placement:: 'right',,
title:: _t(("Create Product"),),
content:: _t(("Click <em>Continue</em> to create the product."),),
},},
17. It's really easy!
Just follow the examples...
website.tour.events.js
website.tour.blog.js
...
·
·
·