| 1 |
import { registry } from "@web/core/registry"; |
| 2 |
import { clickOnElement } from '@website/js/tours/tour_utils'; |
| 3 |
import * as tourUtils from "@website_sale/js/tours/tour_utils"; |
| 4 |
|
| 5 |
registry.category("web_tour.tours").add('product_comparison', { |
| 6 |
url: "/shop", |
| 7 |
steps: () => [ |
| 8 |
|
| 9 |
{ |
| 10 |
content: "add first product 'Color T-Shirt' in a comparison list", |
| 11 |
trigger: '.oe_product_cart:contains("Color T-Shirt")', |
| 12 |
run: "hover && click .oe_product_cart:contains(Color T-Shirt) .o_add_compare", |
| 13 |
}, |
| 14 |
{ |
| 15 |
content: "check compare button contains one product", |
| 16 |
trigger: '.o_wsale_comparison_bottom_bar .badge:contains(1)', |
| 17 |
}, |
| 18 |
{ |
| 19 |
content: "add second product 'Color Pants' in a comparison list", |
| 20 |
trigger: '.oe_product_cart:contains("Color Pants")', |
| 21 |
run: "hover && click .oe_product_cart:contains(Color Pants) .o_add_compare", |
| 22 |
}, |
| 23 |
{ |
| 24 |
content: "check that the compare button contains two products", |
| 25 |
trigger: '.o_wsale_comparison_bottom_bar .badge:contains(2)', |
| 26 |
}, |
| 27 |
{ |
| 28 |
content: "check products name are correct in the comparelist", |
| 29 |
trigger: '[name="product_comparison_bottom_bar_row"]:contains("Color T-Shirt")', |
| 30 |
}, |
| 31 |
{ |
| 32 |
content: "check products name are correct in the comparelist", |
| 33 |
trigger: '[name="product_comparison_bottom_bar_row"]:contains("Color Pants")', |
| 34 |
}, |
| 35 |
{ |
| 36 |
content: "remove product", |
| 37 |
trigger: '[name="product_comparison_bottom_bar_row"]:contains("Color T-Shirt") button:has(i.oi-close)', |
| 38 |
run: "click", |
| 39 |
}, |
| 40 |
{ |
| 41 |
content: "wait for 'Color T-Shirt' to be removed from the popover", |
| 42 |
trigger: '[name="product_comparison_bottom_bar_row"]:not(:contains("Color T-Shirt"))', |
| 43 |
}, |
| 44 |
{ |
| 45 |
content: "re-add 'Color T-Shirt' in comparison list", |
| 46 |
trigger: '.oe_product_cart:contains("Color T-Shirt")', |
| 47 |
run: "hover && click .oe_product_cart:contains(Color T-Shirt) .o_add_compare", |
| 48 |
}, |
| 49 |
|
| 50 |
{ |
| 51 |
content: "go to product page of Color Shoes (with variants)", |
| 52 |
trigger: '.oe_product_cart a:contains("Color Shoes")', |
| 53 |
run: "click", |
| 54 |
expectUnloadPage: true, |
| 55 |
}, |
| 56 |
{ |
| 57 |
content: "check compare button is still there and contains 2 products", |
| 58 |
trigger: '.o_wsale_comparison_bottom_bar .badge:contains(2)', |
| 59 |
}, |
| 60 |
{ |
| 61 |
content: "add first variant to comparelist", |
| 62 |
trigger: '.o_add_compare_dyn', |
| 63 |
run: "click", |
| 64 |
}, |
| 65 |
{ |
| 66 |
content: "check the comparelist is now open and contains 3rd product with correct variant", |
| 67 |
trigger: '[name="product_comparison_bottom_bar_row"]:contains("Color Shoes (Red)")', |
| 68 |
}, |
| 69 |
{ |
| 70 |
content: "select 2nd variant(Pink Color)", |
| 71 |
trigger: '.variant_attribute[data-attribute-name="Color"] input[data-value-name="Pink"]:not(:visible)', |
| 72 |
run: function (actions) { |
| 73 |
document.querySelector('img[class*="product_detail_img"]').setAttribute('data-image-to-change', 1); |
| 74 |
actions.click(); |
| 75 |
}, |
| 76 |
}, |
| 77 |
{ |
| 78 |
trigger: 'img[class*="product_detail_img"]:not([data-image-to-change])', |
| 79 |
}, |
| 80 |
{ |
| 81 |
content: "click on compare button to add in comparison list when variant changed", |
| 82 |
trigger: '.o_add_compare_dyn', |
| 83 |
run: "click", |
| 84 |
}, |
| 85 |
{ |
| 86 |
content: "comparelist contains 4th product with correct variant", |
| 87 |
trigger: '[name="product_comparison_bottom_bar_row"]:contains("Color Shoes (Red)")', |
| 88 |
}, |
| 89 |
{ |
| 90 |
content: "check limit is not reached", |
| 91 |
trigger: ':not(.o_notification:contains("You can compare up to 4 products at a time."))', |
| 92 |
}, |
| 93 |
{ |
| 94 |
content: "select 3nd variant(Custom)", |
| 95 |
trigger: '.variant_attribute[data-attribute-name="Color"] input[data-value-name="Blue"]:not(:visible)', |
| 96 |
run: "click", |
| 97 |
}, |
| 98 |
{ |
| 99 |
trigger: 'body:not(:has(.carousel-indicators))', |
| 100 |
}, |
| 101 |
{ |
| 102 |
content: "click on compare button to add in comparison list when variant changed", |
| 103 |
trigger: '.o_add_compare_dyn', |
| 104 |
run: "click", |
| 105 |
}, |
| 106 |
{ |
| 107 |
content: "check limit is reached", |
| 108 |
trigger: '.o_notification:contains("You can compare up to 4 products at a time.")', |
| 109 |
}, |
| 110 |
{ |
| 111 |
content: "click on compare button", |
| 112 |
trigger: 'a:contains("Compare")', |
| 113 |
run: "click", |
| 114 |
expectUnloadPage: true, |
| 115 |
}, |
| 116 |
|
| 117 |
{ |
| 118 |
content: "check 1st product contains correct variant", |
| 119 |
trigger: '.product_summary a:contains("Color Pants (Red)")', |
| 120 |
}, |
| 121 |
{ |
| 122 |
content: "check 2nd product contains correct variant", |
| 123 |
trigger: '.product_summary a:contains("Color Shoes (Pink)")', |
| 124 |
}, |
| 125 |
{ |
| 126 |
content: "check 3rd product is correctly added", |
| 127 |
trigger: '.product_summary a:contains("Color Shoes (Red)")', |
| 128 |
}, |
| 129 |
{ |
| 130 |
content: "check 4th product is correctly added", |
| 131 |
trigger: '.product_summary a:contains("Color T-Shirt")', |
| 132 |
}, |
| 133 |
{ |
| 134 |
content: "remove Color Shoes (Pink) from compare table", |
| 135 |
trigger: '#o_comparelist_table .o_comparelist_remove:eq(2)', |
| 136 |
run: "click", |
| 137 |
expectUnloadPage: true, |
| 138 |
}, |
| 139 |
{ |
| 140 |
content: "check color shoes with pink variant is removed", |
| 141 |
trigger: '#o_comparelist_table:not(:contains("Color Shoes (Pink)"))', |
| 142 |
}, |
| 143 |
{ |
| 144 |
content: "add product 'Color Pants' to cart", |
| 145 |
trigger: '.product_summary:contains("Color Pants") button:contains("Add to Cart")', |
| 146 |
run: "click", |
| 147 |
}, |
| 148 |
clickOnElement('Add to cart', 'button[name="website_sale_product_configurator_continue_button"]'), |
| 149 |
tourUtils.goToCart(), |
| 150 |
{ |
| 151 |
content: "check product correctly added to cart", |
| 152 |
trigger: '#cart_products:contains("Color Pants") .js_quantity[value="1"]', |
| 153 |
}, |
| 154 |
]}); |