[IMP] website_sale_wishlist: Adapt tests to work with/without demo data
This commit is contained in:
@@ -6,7 +6,7 @@ var tour = require("web_tour.tour");
|
||||
|
||||
tour.register('shop_wishlist', {
|
||||
test: true,
|
||||
url: '/shop',
|
||||
url: '/shop?search=Customizable Desk',
|
||||
},
|
||||
[
|
||||
{
|
||||
@@ -41,7 +41,7 @@ tour.register('shop_wishlist', {
|
||||
run: function (){
|
||||
$('.oe_login_form input[name="login"]').val("admin");
|
||||
$('.oe_login_form input[name="password"]').val("admin");
|
||||
$('.oe_login_form input[name="redirect"]').val("/shop");
|
||||
$('.oe_login_form input[name="redirect"]').val("/shop?search=Customizable Desk");
|
||||
$('.oe_login_form').submit();
|
||||
},
|
||||
},
|
||||
@@ -51,8 +51,8 @@ tour.register('shop_wishlist', {
|
||||
run: function () {},
|
||||
},
|
||||
{
|
||||
content: "click on Customizable Desk",
|
||||
trigger: '.oe_product_cart a:contains("Customizable Desk")',
|
||||
content: "click on Customizable Desk (TEST)",
|
||||
trigger: '.oe_product_cart a:contains("Customizable Desk (TEST)")',
|
||||
},
|
||||
{
|
||||
content: "check the first variant is already in wishlist",
|
||||
@@ -75,8 +75,8 @@ tour.register('shop_wishlist', {
|
||||
trigger: 'a[href="/shop/wishlist"]',
|
||||
},
|
||||
{
|
||||
content: "remove Customizable Desk",
|
||||
trigger: 'tr:contains("Customizable Desk") .o_wish_rm:first',
|
||||
content: "remove Customizable Desk (TEST)",
|
||||
trigger: 'tr:contains("Customizable Desk (TEST)") .o_wish_rm:first',
|
||||
},
|
||||
{
|
||||
content: "check that wishlist contains 1 item",
|
||||
|
||||
@@ -6,4 +6,58 @@ import odoo.tests
|
||||
@odoo.tests.tagged('-at_install', 'post_install')
|
||||
class TestUi(odoo.tests.HttpCase):
|
||||
def test_01_wishlist_tour(self):
|
||||
|
||||
self.env['product.template'].search([]).write({'website_published': False})
|
||||
# Setup attributes and attributes values
|
||||
self.product_attribute_1 = self.env['product.attribute'].create({
|
||||
'name': 'Legs',
|
||||
'sequence': 10,
|
||||
})
|
||||
product_attribute_value_1 = self.env['product.attribute.value'].create({
|
||||
'name': 'Steel',
|
||||
'attribute_id': self.product_attribute_1.id,
|
||||
'sequence': 1,
|
||||
})
|
||||
product_attribute_value_2 = self.env['product.attribute.value'].create({
|
||||
'name': 'Aluminium',
|
||||
'attribute_id': self.product_attribute_1.id,
|
||||
'sequence': 2,
|
||||
})
|
||||
product_attribute_2 = self.env['product.attribute'].create({
|
||||
'name': 'Color',
|
||||
'sequence': 20,
|
||||
})
|
||||
product_attribute_value_3 = self.env['product.attribute.value'].create({
|
||||
'name': 'White',
|
||||
'attribute_id': product_attribute_2.id,
|
||||
'sequence': 1,
|
||||
})
|
||||
product_attribute_value_4 = self.env['product.attribute.value'].create({
|
||||
'name': 'Black',
|
||||
'attribute_id': product_attribute_2.id,
|
||||
'sequence': 2,
|
||||
})
|
||||
|
||||
# Create product template
|
||||
self.product_product_4_product_template = self.env['product.template'].create({
|
||||
'name': 'Customizable Desk (TEST)',
|
||||
'standard_price': 500.0,
|
||||
'list_price': 750.0,
|
||||
'website_published': True,
|
||||
})
|
||||
|
||||
# Generate variants
|
||||
self.env['product.template.attribute.line'].create([{
|
||||
'product_tmpl_id': self.product_product_4_product_template.id,
|
||||
'attribute_id': self.product_attribute_1.id,
|
||||
'value_ids': [(4, product_attribute_value_1.id), (4, product_attribute_value_2.id)],
|
||||
}, {
|
||||
'product_tmpl_id': self.product_product_4_product_template.id,
|
||||
'attribute_id': product_attribute_2.id,
|
||||
'value_ids': [(4, product_attribute_value_3.id), (4, product_attribute_value_4.id)],
|
||||
|
||||
}])
|
||||
|
||||
self.env.ref('base.user_admin').name = 'Mitchell Admin'
|
||||
|
||||
self.start_tour("/", 'shop_wishlist')
|
||||
|
||||
Reference in New Issue
Block a user