Skip to Content
Menu
This question has been flagged
1 Reply
2450 Views

Hey guys, i've been trying to run test tours, but they always end up as success, even when they failed. Took first part from odoo website_sale tours, and added function that checks if element is there for user.

Running tour from browser: `odoo.__DEBUG__.services['web_tour.tour'].run('shop_suggest_product_non_network', 1000);`
```

odoo.define('website_sale_suggestion.tour', function (require) {
'use strict';

const tour = require("web_tour.tour");

tour.register('shop_suggest_product_non_network', {
test: true,
url: '/shop',
},
[
{
content: "search conference chair",
trigger: 'form input[name="search"]',
run: "text conference chair",
},
{
content: "search conference chair",
trigger: 'form:has(input[name="search"]) .oe_search_button',
},
{
content: "select conference chair",
trigger: '.oe_product_cart:first a:contains("Conference Chair")',
},
{
content: "select Conference Chair Aluminium",
extra_trigger: '#product_detail',
trigger: 'label:contains(Aluminium) input',
},
{
content: "select Conference Chair Steel",
extra_trigger: '#product_detail',
trigger: 'label:contains(Steel) input',
},
{
id: 'add_cart_step',
content: "click on add to cart",
extra_trigger: 'label:contains(Steel) input:propChecked',
trigger: '#product_detail form[action^="/shop/cart/update"] .btn-primary',
},
{
content: "set two",
extra_trigger: '#wrap:not(:has(#cart_products tr:contains("Storage Box")))',
trigger: '#cart_products input.js_quantity',
run: 'text 2',
},
// My function goes here
{
content: "Check if there is 'create ordering suggestion' button",
trigger: '.oe_cart',
run: function() {
var element = document.getElementById("btn_create_ordering_suggestion");
console.log("------Element!")
console.log(element)
if (element === null) {
console.error('button should be here for non network partners');
return;
} else {
console.log('test successful');
}
},
},
]
);
});
```

Output during function:

```

Tour shop_suggest_product_non_network: step 'set two (trigger: #cart_products input.js_quantity)' succeeded

------Element!

null

Error: button should be here for non network partners

Tour shop_suggest_product_non_network: step 'Check if there is  'create ordering suggestion' button (trigger: .oe_cart)' succeeded

Tour shop_suggest_product_non_network succeeded

test successful

```

So basically whatever i do test will be successful. Any ideas what might be happening? Console tells me that test succeeded and i can't seemly to make it fail.

Avatar
Discard
Author Best Answer

Ok tests summary do not fail if we run them from browser, but if we run them from terminal we get our fail. Weird bug, oh well.

Avatar
Discard
Related Posts Replies Views Activity
0
Apr 20
2927
4
Aug 24
4229
1
Jul 24
378
0
Apr 24
358
0
Jan 24
254