summaryrefslogtreecommitdiff
path: root/addons/website_sale/static/tests
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/website_sale/static/tests
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/website_sale/static/tests')
-rw-r--r--addons/website_sale/static/tests/tours/website_sale_buy.js94
-rw-r--r--addons/website_sale/static/tests/tours/website_sale_complete_flow.js389
-rw-r--r--addons/website_sale/static/tests/tours/website_sale_shop_cart_recovery.js86
-rw-r--r--addons/website_sale/static/tests/tours/website_sale_shop_custom_attribute_value.js28
-rw-r--r--addons/website_sale/static/tests/tours/website_sale_shop_customize.js145
-rw-r--r--addons/website_sale/static/tests/tours/website_sale_shop_deleted_archived_variants.js54
-rw-r--r--addons/website_sale/static/tests/tours/website_sale_shop_dynamic_variants.js35
-rw-r--r--addons/website_sale/static/tests/tours/website_sale_shop_list_view_b2c.js71
-rw-r--r--addons/website_sale/static/tests/tours/website_sale_shop_mail.js99
-rw-r--r--addons/website_sale/static/tests/tours/website_sale_shop_no_variant_attribute.js37
-rw-r--r--addons/website_sale/static/tests/tours/website_sale_shop_zoom.js48
11 files changed, 1086 insertions, 0 deletions
diff --git a/addons/website_sale/static/tests/tours/website_sale_buy.js b/addons/website_sale/static/tests/tours/website_sale_buy.js
new file mode 100644
index 00000000..ca1bbe2d
--- /dev/null
+++ b/addons/website_sale/static/tests/tours/website_sale_buy.js
@@ -0,0 +1,94 @@
+odoo.define('website_sale.tour', function (require) {
+'use strict';
+
+var tour = require("web_tour.tour");
+
+tour.register('shop_buy_product', {
+ 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: "add suggested",
+ extra_trigger: '#wrap:not(:has(#cart_products:contains("Storage Box")))',
+ trigger: '.oe_cart:has(tr:contains("Storage Box")) a:contains("Add to Cart")',
+ },
+ {
+ content: "add one more",
+ extra_trigger: '#cart_products tr:contains("Storage Box")',
+ trigger: '#cart_products tr:contains("Steel") a.js_add_cart_json:eq(1)',
+ },
+ {
+ content: "remove Storage Box",
+ extra_trigger: '#cart_products tr:contains("Steel") input.js_quantity:propValue(2)',
+ trigger: '#cart_products tr:contains("Storage Box") a.js_add_cart_json:first',
+ },
+ {
+ content: "set one",
+ extra_trigger: '#wrap:not(:has(#cart_products tr:contains("Storage Box")))',
+ trigger: '#cart_products input.js_quantity',
+ run: 'text 1',
+ },
+ {
+ content: "go to checkout",
+ extra_trigger: '#cart_products input.js_quantity:propValue(1)',
+ trigger: 'a[href*="/shop/checkout"]',
+ },
+ {
+ content: "select payment",
+ trigger: '#payment_method label:contains("Wire Transfer")',
+ },
+ {
+ content: "Pay Now",
+ //Either there are multiple payment methods, and one is checked, either there is only one, and therefore there are no radio inputs
+ extra_trigger: '#payment_method label:contains("Wire Transfer") input:checked,#payment_method:not(:has("input:radio:visible"))',
+ trigger: 'button[id="o_payment_form_pay"]:visible:not(:disabled)',
+ },
+ {
+ content: "finish",
+ trigger: '.oe_website_sale:contains("Please make a payment to:")',
+ // Leave /shop/confirmation to prevent RPC loop to /shop/payment/get_status.
+ // The RPC could be handled in python while the tour is killed (and the session), leading to crashes
+ run: function () {
+ window.location.href = '/contactus'; // Redirect in JS to avoid the RPC loop (20x1sec)
+ },
+ timeout: 30000,
+ },
+ {
+ content: "wait page loaded",
+ trigger: 'h1:contains("Contact us")',
+ run: function () {}, // it's a check
+ },
+ ]
+);
+
+});
diff --git a/addons/website_sale/static/tests/tours/website_sale_complete_flow.js b/addons/website_sale/static/tests/tours/website_sale_complete_flow.js
new file mode 100644
index 00000000..eb940b1a
--- /dev/null
+++ b/addons/website_sale/static/tests/tours/website_sale_complete_flow.js
@@ -0,0 +1,389 @@
+odoo.define('website_sale_tour.tour', function (require) {
+ 'use strict';
+
+ var tour = require("web_tour.tour");
+ var rpc = require("web.rpc");
+
+ tour.register('website_sale_tour', {
+ test: true,
+ url: '/shop?search=Storage Box Test',
+ }, [
+ // Testing b2c with Tax-Excluded Prices
+ {
+ content: "Open product page",
+ trigger: '.oe_product_cart a:contains("Storage Box Test")',
+ },
+ {
+ content: "Add one more storage box",
+ trigger: '.js_add_cart_json:eq(1)',
+ },
+ {
+ content: "Check b2b Tax-Excluded Prices",
+ trigger: '.product_price .oe_price .oe_currency_value:containsExact(79.00)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "Click on add to cart",
+ trigger: '#add_to_cart',
+ },
+ {
+ content: "Check for 2 products in cart and proceed to checkout",
+ extra_trigger: '#cart_products tr:contains("Storage Box Test") input.js_quantity:propValue(2)',
+ trigger: 'a[href*="/shop/checkout"]',
+ },
+ {
+ content: "Check Price b2b subtotal",
+ trigger: 'tr#order_total_untaxed .oe_currency_value:containsExact(158.00)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "Check Price b2b Sale Tax(15%)",
+ trigger: 'tr#order_total_taxes .oe_currency_value:containsExact(23.70)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "Check Price b2b Total amount",
+ trigger: 'tr#order_total .oe_currency_value:containsExact(181.70)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "Fulfill billing address form",
+ trigger: 'select[name="country_id"]',
+ run: function () {
+ $('input[name="name"]').val('abc');
+ $('input[name="phone"]').val('99999999');
+ $('input[name="email"]').val('abc@odoo.com');
+ $('input[name="street"]').val('SO1 Billing Street, 33');
+ $('input[name="city"]').val('SO1BillingCity');
+ $('input[name="zip"]').val('10000');
+ $('#country_id option:eq(1)').attr('selected', true);
+ },
+ },
+ {
+ content: "Shipping address is not same as billing address",
+ trigger: '#shipping_use_same',
+ },
+ {
+ content: "Click on next button",
+ trigger: '.oe_cart .btn:contains("Next")',
+ },
+ {
+ content: "Fulfill shipping address form",
+ trigger: 'select[name="country_id"]',
+ extra_trigger: 'h2:contains("Shipping Address")',
+ run: function () {
+ $('input[name="name"]').val('def');
+ $('input[name="phone"]').val('8888888888');
+ $('input[name="street"]').val('17, SO1 Shipping Road');
+ $('input[name="city"]').val('SO1ShippingCity');
+ $('input[name="zip"]').val('10000');
+ $('#country_id option:eq(1)').attr('selected', true);
+ },
+ },
+ {
+ content: "Click on next button",
+ trigger: '.oe_cart .btn:contains("Next")',
+ },
+ {
+ content: "Check selected billing address is same as typed in previous step",
+ trigger: '#shipping_and_billing:contains(SO1 Billing Street, 33):contains(SO1BillingCity):contains(Afghanistan)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "Check selected shipping address is same as typed in previous step",
+ trigger: '#shipping_and_billing:contains(17, SO1 Shipping Road):contains(SO1ShippingCity):contains(Afghanistan)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "Click for edit address",
+ trigger: 'a:contains("Edit") i',
+ },
+ {
+ content: "Click for edit billing address",
+ trigger: '.js_edit_address:first',
+ },
+ {
+ content: "Change billing address form",
+ trigger: 'select[name="country_id"]',
+ extra_trigger: 'h2:contains("Your Address")',
+ run: function () {
+ $('input[name="name"]').val('abcd');
+ $('input[name="phone"]').val('11111111');
+ $('input[name="street"]').val('SO1 Billing Street Edited, 33');
+ $('input[name="city"]').val('SO1BillingCityEdited');
+ },
+ },
+ {
+ content: "Click on next button",
+ trigger: '.oe_cart .btn:contains("Next")',
+ },
+ {
+ content: "Confirm Address",
+ trigger: 'a.btn:contains("Confirm")',
+ },
+ {
+ content: "Check selected billing address is same as typed in previous step",
+ trigger: '#shipping_and_billing:contains(SO1 Billing Street Edited, 33):contains(SO1BillingCityEdited):contains(Afghanistan)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "Select `Wire Transfer` payment method",
+ trigger: '#payment_method label:contains("Wire Transfer")',
+ },
+ {
+ content: "Pay Now",
+ extra_trigger: '#payment_method label:contains("Wire Transfer") input:checked,#payment_method:not(:has("input:radio:visible"))',
+ trigger: 'button[id="o_payment_form_pay"]:visible:not(:disabled)',
+ },
+ {
+ content: "Sign up",
+ trigger: '.oe_cart a:contains("Sign Up")',
+ },
+ {
+ content: "Submit login",
+ trigger: '.oe_signup_form',
+ run: function () {
+ $('.oe_signup_form input[name="password"]').val("1admin@admin");
+ $('.oe_signup_form input[name="confirm_password"]').val("1admin@admin");
+ $('.oe_signup_form').submit();
+ },
+ },
+ {
+ content: "See Quotations",
+ trigger: '.o_portal_docs a:contains("Quotations")',
+ },
+ // Sign in as admin change config auth_signup -> b2b, sale_show_tax -> total and Logout
+ {
+ content: "Open Dropdown for logout",
+ trigger: '#top_menu li.dropdown:visible a:contains("abcd")',
+ },
+ {
+ content: "Logout",
+ trigger: '#o_logout:contains("Logout")',
+ },
+ {
+ content: "Sign in as admin",
+ trigger: 'header a[href="/web/login"]',
+ },
+ {
+ content: "Submit login",
+ trigger: '.oe_login_form',
+ 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("/");
+ $('.oe_login_form').submit();
+ },
+ },
+ {
+ content: "Configuration Settings for 'Tax Included' and sign up 'On Invitation'",
+ extra_trigger: '.o_connected_user #wrapwrap',
+ trigger: '#wrapwrap',
+ run: function () {
+ var def1 = rpc.query({
+ model: 'res.config.settings',
+ method: 'create',
+ args: [{
+ 'auth_signup_uninvited': 'b2b',
+ 'show_line_subtotals_tax_selection': 'tax_included',
+ 'group_show_line_subtotals_tax_excluded': false,
+ 'group_show_line_subtotals_tax_included': true,
+ }],
+ });
+ var def2 = def1.then(function (resId) {
+ return rpc.query({
+ model: 'res.config.settings',
+ method: 'execute',
+ args: [[resId]],
+ });
+ });
+ def2.then(function () {
+ window.location.href = '/web/session/logout?redirect=/shop?search=Storage Box Test';
+ });
+ },
+ },
+ // Testing b2b with Tax-Included Prices
+ {
+ content: "Open product page",
+ trigger: '.oe_product_cart a:contains("Storage Box Test")',
+ },
+ {
+ content: "Add one more Storage Box Test",
+ trigger: '.js_add_cart_json:eq(1)',
+ },
+ {
+ content: "Check b2c Tax-Included Prices",
+ trigger: '.product_price .oe_price .oe_currency_value:containsExact(90.85)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "Click on add to cart",
+ trigger: '#add_to_cart',
+ },
+ {
+ content: "Check for 2 products in cart and proceed to checkout",
+ extra_trigger: '#cart_products tr:contains("Storage Box Test") input.js_quantity:propValue(2)',
+ trigger: 'a[href*="/shop/checkout"]',
+ },
+ {
+ content: "Check Price b2c total",
+ trigger: 'tr#order_total_untaxed .oe_currency_value:containsExact(158.00)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "Check Price b2c Sale Tax(15%)",
+ trigger: 'tr#order_total_taxes .oe_currency_value:containsExact(23.70)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "Check Price b2c Total amount",
+ trigger: 'tr#order_total .oe_currency_value:containsExact(181.70)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "Click on Login Button",
+ trigger: '.oe_cart a.btn:contains("Log In")',
+ },
+ {
+ content: "Submit login",
+ trigger: '.oe_login_form',
+ run: function () {
+ $('.oe_login_form input[name="login"]').val("abc@odoo.com");
+ $('.oe_login_form input[name="password"]').val("1admin@admin");
+ $('.oe_login_form').submit();
+ },
+ },
+ {
+ content: "Add new shipping address",
+ trigger: '.one_kanban form[action^="/shop/address"] .btn',
+ },
+ {
+ content: "Fulfill shipping address form",
+ trigger: 'select[name="country_id"]',
+ run: function () {
+ $('input[name="name"]').val('ghi');
+ $('input[name="phone"]').val('7777777777');
+ $('input[name="street"]').val('SO2New Shipping Street, 5');
+ $('input[name="city"]').val('SO2NewShipping');
+ $('input[name="zip"]').val('1200');
+ $('#country_id option:eq(1)').attr('selected', true);
+ },
+ },
+ {
+ content: "Click on next button",
+ trigger: '.oe_cart .btn:contains("Next")',
+ },
+ {
+ content: "Select `Wire Transfer` payment method",
+ trigger: '#payment_method label:contains("Wire Transfer")',
+ },
+ {
+ content: "Pay Now",
+ extra_trigger: '#payment_method label:contains("Wire Transfer") input:checked,#payment_method:not(:has("input:radio:visible"))',
+ trigger: 'button[id="o_payment_form_pay"]:visible:not(:disabled)',
+ },
+ {
+ content: "Open Dropdown for See quotation",
+ extra_trigger: '.oe_cart .oe_website_sale_tx_status',
+ trigger: '#top_menu li.dropdown:visible a:contains("abc")',
+ },
+ {
+ content: "My account",
+ extra_trigger: '#top_menu li.dropdown .js_usermenu.show',
+ trigger: '#top_menu .dropdown-menu a[href="/my/home"]:visible',
+ },
+ {
+ content: "See Quotations",
+ trigger: '.o_portal_docs a:contains("Quotations") .badge:containsExact(2)',
+ },
+
+ // enable extra step on website checkout and check extra step on checkout process
+ {
+ content: "Open Dropdown for logout",
+ trigger: '#top_menu li.dropdown:visible a:contains("abc")',
+ },
+ {
+ content: "Logout",
+ trigger: '#o_logout:contains("Logout")',
+ },
+ {
+ content: "Sign in as admin",
+ trigger: 'header a[href="/web/login"]',
+ },
+ {
+ content: "Submit login",
+ trigger: '.oe_login_form',
+ 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/cart");
+ $('.oe_login_form').submit();
+ },
+ },
+ {
+ content: "Open Customize menu",
+ trigger: '.o_menu_sections a:contains("Customize")',
+ },
+ {
+ content: "Enable Extra step",
+ trigger: 'a.dropdown-item label:contains("Extra Step Option")',
+ },
+ {
+ content: "Open Dropdown for logout",
+ extra_trigger: '.progress-wizard-step:contains("Extra Info")',
+ trigger: '#top_menu li.dropdown:visible a:contains("Mitchell Admin")',
+ },
+ {
+ content: "Logout",
+ trigger: '#o_logout:contains("Logout")',
+ },
+ {
+ content: "Sign in as abc",
+ trigger: 'header a[href="/web/login"]',
+ },
+ {
+ content: "Submit login",
+ trigger: '.oe_login_form',
+ run: function () {
+ $('.oe_login_form input[name="login"]').val("abc@odoo.com");
+ $('.oe_login_form input[name="password"]').val("1admin@admin");
+ $('.oe_login_form input[name="redirect"]').val("/shop?search=Storage Box Test");
+ $('.oe_login_form').submit();
+ },
+ },
+ {
+ content: "Open product page",
+ trigger: '.oe_product_cart a:contains("Storage Box Test")',
+ },
+ {
+ content: "Click on add to cart",
+ trigger: '#add_to_cart',
+ },
+ {
+ content: "Proceed to checkout",
+ trigger: 'a[href*="/shop/checkout"]',
+ },
+ {
+ content: "Click on next button",
+ trigger: '.oe_cart .btn:contains("Next")',
+ },
+ {
+ content: "Check selected billing address is same as typed in previous step",
+ trigger: '#shipping_and_billing:contains(SO1 Billing Street Edited, 33):contains(SO1BillingCityEdited):contains(Afghanistan)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "Check selected shipping address is same as typed in previous step",
+ trigger: '#shipping_and_billing:contains(SO2New Shipping Street, 5):contains(SO2NewShipping):contains(Afghanistan)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "Select `Wire Transfer` payment method",
+ trigger: '#payment_method label:contains("Wire Transfer")',
+ },
+ {
+ content: "Pay Now",
+ extra_trigger: '#payment_method label:contains("Wire Transfer") input:checked,#payment_method:not(:has("input:radio:visible"))',
+ trigger: 'button[id="o_payment_form_pay"]:visible',
+ }]);
+});
diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_cart_recovery.js b/addons/website_sale/static/tests/tours/website_sale_shop_cart_recovery.js
new file mode 100644
index 00000000..2cddfbc7
--- /dev/null
+++ b/addons/website_sale/static/tests/tours/website_sale_shop_cart_recovery.js
@@ -0,0 +1,86 @@
+odoo.define('website_sale.tour_shop_cart_recovery', function (require) {
+'use strict';
+
+var localStorage = require('web.local_storage');
+var rpc = require('web.rpc');
+var tour = require('web_tour.tour');
+require('web.dom_ready');
+
+var orderIdKey = 'website_sale.tour_shop_cart_recovery.orderId';
+var recoveryLinkKey = 'website_sale.tour_shop_cart_recovery.recoveryLink';
+
+tour.register('shop_cart_recovery', {
+ test: true,
+ url: '/shop?search=Acoustic Bloc Screens',
+},
+[
+ {
+ content: "select Acoustic Bloc Screens",
+ trigger: '.oe_product_cart a:containsExact("Acoustic Bloc Screens")',
+ },
+ {
+ content: "click add to cart",
+ trigger: '#product_details #add_to_cart',
+ },
+ {
+ content: "check product is in cart, get cart id, logout, go to login",
+ trigger: 'td.td-product_name:contains("Acoustic Bloc Screens")',
+ run: function () {
+ var orderId = $('.my_cart_quantity').data('order-id');
+ localStorage.setItem(orderIdKey, orderId);
+ window.location.href = "/web/session/logout?redirect=/web/login";
+ },
+ },
+ {
+ content: "login as admin and go to the SO (backend)",
+ trigger: '.oe_login_form',
+ run: function () {
+ var orderId = localStorage.getItem(orderIdKey);
+ var url = "/web#action=sale.action_orders&view_type=form&id=" + orderId;
+ var $loginForm = $('.oe_login_form');
+ $loginForm.find('input[name="login"]').val("admin");
+ $loginForm.find('input[name="password"]').val("admin");
+ $loginForm.find('input[name="redirect"]').val(url);
+ $loginForm.submit();
+ },
+ },
+ {
+ content: "click action",
+ trigger: '.o_dropdown_toggler_btn:contains("Action")',
+ },
+ {
+ content: "click Send a Cart Recovery Email",
+ trigger: 'a:containsExact("Send a Cart Recovery Email")',
+ },
+ {
+ content: "click Send email",
+ trigger: '.btn[name="action_send_mail"]',
+ },
+ {
+ content: "check the mail is sent, grab the recovery link, and logout",
+ trigger: '.o_Message_content a:containsExact("Resume order")',
+ run: function () {
+ var link = $('.o_Message_content a:containsExact("Resume order")').attr('href');
+ localStorage.setItem(recoveryLinkKey, link);
+ window.location.href = "/web/session/logout?redirect=/";
+ }
+ },
+ {
+ content: "go to the recovery link",
+ trigger: 'a[href="/web/login"]',
+ run: function () {
+ window.location.href = localStorage.getItem(recoveryLinkKey);
+ },
+ },
+ {
+ content: "check the page is working, click on restore",
+ extra_trigger: 'p:contains("This is your current cart")',
+ trigger: 'p:contains("restore") a:contains("Click here")',
+ },
+ {
+ content: "check product is in restored cart",
+ trigger: 'td.td-product_name:contains("Acoustic Bloc Screens")',
+ run: function () {},
+ },
+]);
+});
diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_custom_attribute_value.js b/addons/website_sale/static/tests/tours/website_sale_shop_custom_attribute_value.js
new file mode 100644
index 00000000..89f6be59
--- /dev/null
+++ b/addons/website_sale/static/tests/tours/website_sale_shop_custom_attribute_value.js
@@ -0,0 +1,28 @@
+odoo.define("website_sale.tour_shop_custom_attribute_value", function (require) {
+ "use strict";
+
+ var tour = require("web_tour.tour");
+
+ tour.register("shop_custom_attribute_value", {
+ url: "/shop?search=Customizable Desk",
+ test: true,
+ }, [{
+ content: "click on Customizable Desk",
+ trigger: '.oe_product_cart a:contains("Customizable Desk (TEST)")',
+ }, {
+ trigger: 'li.js_attribute_value span:contains(Custom TEST)',
+ extra_trigger: 'li.js_attribute_value',
+ run: 'click',
+ }, {
+ trigger: 'input.variant_custom_value',
+ run: 'text Wood',
+ }, {
+ id: 'add_cart_step',
+ trigger: 'a:contains(Add to Cart)',
+ run: 'click',
+ }, {
+ trigger: 'span:contains(Custom TEST: Wood)',
+ extra_trigger: '#cart_products',
+ run: function (){}, // check
+ }]);
+});
diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_customize.js b/addons/website_sale/static/tests/tours/website_sale_shop_customize.js
new file mode 100644
index 00000000..4a753443
--- /dev/null
+++ b/addons/website_sale/static/tests/tours/website_sale_shop_customize.js
@@ -0,0 +1,145 @@
+odoo.define('website_sale.tour_shop_customize', function (require) {
+ 'use strict';
+
+ var tour = require("web_tour.tour");
+
+ tour.register('shop_customize', {
+ test: true,
+ url: '/shop',
+ },
+ [
+ {
+ content: "open customize menu",
+ trigger: '#customize-menu > a',
+ },
+ {
+ content: "click on 'Product Attribute's Filters'",
+ trigger: "#customize-menu a:contains(Product Attribute's Filters)",
+ },
+ {
+ content: "select product attribute Steel",
+ extra_trigger: 'body:not(:has(#customize-menu:visible .dropdown-menu:visible))',
+ trigger: 'form.js_attributes label:contains(Steel - Test) input:not(:checked)',
+ },
+ {
+ content: "check the selection",
+ trigger: 'form.js_attributes label:contains(Steel - Test) input:checked',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "select product",
+ extra_trigger: 'body:not(:has(.oe_website_sale .oe_product_cart:eq(3)))',
+ trigger: '.oe_product_cart a:contains("Test Product")',
+ },
+ {
+ content: "open customize menu",
+ trigger: '#customize-menu > a',
+ extra_trigger: '#product_detail',
+ },
+ {
+ content: "check page loaded after enable variant group",
+ trigger: '#customize-menu a:contains(List View of Variants)',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "check list view of variants is disabled initially",
+ trigger: 'body:not(:has(.js_product_change))',
+ run: function () {},
+ },
+ {
+ content: "click on 'List View of Variants'",
+ trigger: "#customize-menu a:contains(List View of Variants)",
+ },
+ {
+ content: "check page loaded after list of variant customization enabled",
+ trigger: '.js_product_change',
+ run: function () {}, // it's a check
+ },
+ {
+ context: "check variant price",
+ trigger: '.custom-radio:contains("Aluminium") .badge:contains("+") .oe_currency_value:contains("50.4")',
+ run: function () {},
+ },
+ {
+ content: "check price is 750",
+ trigger: ".product_price .oe_price .oe_currency_value:containsExact(750.00)",
+ run: function () {},
+ },
+ {
+ content: "switch to another variant",
+ trigger: ".js_product label:contains('Aluminium')",
+ },
+ {
+ content: "verify that price has changed when changing variant",
+ trigger: ".product_price .oe_price .oe_currency_value:containsExact(800.40)",
+ run: function () {},
+ },
+ {
+ content: "open customize menu",
+ trigger: '#customize-menu > a',
+ },
+ {
+ content: "remove 'List View of Variants'",
+ trigger: "#customize-menu a:contains(List View of Variants):has(input:checked)",
+ },
+ {
+ content: "check page loaded after list of variant customization disabled",
+ trigger: ".js_product:not(:has(.js_product_change))",
+ run: function () {}, // it's a check
+ },
+ {
+ content: "check price is 750",
+ trigger: ".product_price .oe_price .oe_currency_value:containsExact(750.00)",
+ run: function () {},
+ },
+ {
+ content: "switch to Aluminium variant",
+ trigger: '.js_product input[data-value_name="Aluminium"]',
+ },
+ {
+ content: "verify that price has changed when changing variant",
+ trigger: ".product_price .oe_price .oe_currency_value:containsExact(800.40)",
+ run: function () {}, // it's a check
+ },
+ {
+ content: "switch back to Steel variant",
+ trigger: ".js_product label:contains('Steel - Test')",
+ },
+ {
+ content: "check price is 750",
+ trigger: ".product_price .oe_price .oe_currency_value:containsExact(750.00)",
+ run: function () {},
+ },
+ {
+ content: "click on 'Add to Cart' button",
+ trigger: "a:contains(Add to Cart)",
+ },
+ {
+ content: "check quantity",
+ trigger: '.my_cart_quantity:containsExact(1),.o_extra_menu_items .fa-plus',
+ run: function () {}, // it's a check
+ },
+ {
+ content: "click on shop",
+ trigger: "a:contains(Continue Shopping)",
+ extra_trigger: 'body:not(:has(#products_grid_before .js_attributes))',
+ },
+ {
+ content: "open customize menu bis",
+ extra_trigger: '#products_grid_before .js_attributes',
+ trigger: '#customize-menu > a',
+ },
+ {
+ content: "remove 'Product Attribute's Filters'",
+ trigger: "#customize-menu a:contains(Product Attribute's Filters):has(input:checked)",
+ },
+ {
+ content: "finish",
+ extra_trigger: 'body:not(:has(#products_grid_before .js_attributes))',
+ trigger: '#wrap:not(:has(li:has(.my_cart_quantity):visible))',
+ run: function () {}, // it's a check
+ },
+ ]
+ );
+
+ });
diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_deleted_archived_variants.js b/addons/website_sale/static/tests/tours/website_sale_shop_deleted_archived_variants.js
new file mode 100644
index 00000000..36adf9a9
--- /dev/null
+++ b/addons/website_sale/static/tests/tours/website_sale_shop_deleted_archived_variants.js
@@ -0,0 +1,54 @@
+odoo.define('website_sale.tour_shop_deleted_archived_variants', function (require) {
+'use strict';
+
+var tour = require('web_tour.tour');
+
+// This tour relies on a data created from the python test.
+tour.register('tour_shop_deleted_archived_variants', {
+ test: true,
+ url: '/shop?search=Test Product 2',
+},
+[
+ {
+ content: "check price on /shop (template price)",
+ trigger: '.oe_product_cart .oe_currency_value:contains("1.00")',
+ },
+ {
+ content: "select Test Product 2",
+ trigger: '.oe_product_cart a:containsExact("Test Product 2")',
+ },
+ {
+ content: "check price (3rd variant)",
+ trigger: '.oe_currency_value:contains("31.00")'
+ },
+ {
+ content: "click on the second variant",
+ trigger: 'input[data-attribute_name="My Attribute"][data-value_name="My Value 2"]',
+ },
+ {
+ content: "check combination is not possible",
+ trigger: '.js_main_product.css_not_available .css_not_available_msg:contains("This combination does not exist.")'
+ },
+ {
+ content: "click on the 3rd variant to reset the warning",
+ trigger: 'input[data-attribute_name="My Attribute"][data-value_name="My Value 3"]',
+ },
+ {
+ content: "check price (3rd variant)",
+ trigger: '.oe_currency_value:contains("31.00")'
+ },
+ {
+ content: "click on the first variant",
+ trigger: 'input[data-attribute_name="My Attribute"][data-value_name="My Value 1"]',
+ },
+ {
+ content: "check combination is not possible",
+ trigger: '.js_main_product.css_not_available .css_not_available_msg:contains("This combination does not exist.")'
+ },
+ {
+ content: "check add to cart not possible",
+ trigger: '#add_to_cart.disabled',
+ run: function () {},
+ }
+]);
+});
diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_dynamic_variants.js b/addons/website_sale/static/tests/tours/website_sale_shop_dynamic_variants.js
new file mode 100644
index 00000000..7ae32191
--- /dev/null
+++ b/addons/website_sale/static/tests/tours/website_sale_shop_dynamic_variants.js
@@ -0,0 +1,35 @@
+odoo.define('website_sale.tour_shop_dynamic_variants', function (require) {
+'use strict';
+
+var tour = require('web_tour.tour');
+
+// This tour relies on a data created from the python test.
+tour.register('tour_shop_dynamic_variants', {
+ test: true,
+ url: '/shop?search=Dynamic Product',
+},
+[
+ {
+ content: "select Dynamic Product",
+ trigger: '.oe_product_cart a:containsExact("Dynamic Product")',
+ },
+ {
+ content: "click on the second variant",
+ trigger: 'input[data-attribute_name="Dynamic Attribute"][data-value_name="Dynamic Value 2"]',
+ },
+ {
+ content: "wait for variant to be loaded",
+ trigger: '.oe_price .oe_currency_value:contains("0.00")',
+ run: function () {},
+ },
+ {
+ content: "click add to cart",
+ extra_trigger: 'body:has(input[type="hidden"][name="product_id"][value=0])',
+ trigger: '#add_to_cart',
+ },
+ {
+ content: "check the variant is in the cart",
+ trigger: 'td.td-product_name:contains(Dynamic Product (Dynamic Value 2))',
+ },
+]);
+});
diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_list_view_b2c.js b/addons/website_sale/static/tests/tours/website_sale_shop_list_view_b2c.js
new file mode 100644
index 00000000..2cd81b11
--- /dev/null
+++ b/addons/website_sale/static/tests/tours/website_sale_shop_list_view_b2c.js
@@ -0,0 +1,71 @@
+odoo.define('website_sale.tour_shop_list_view_b2c', function (require) {
+'use strict';
+
+var tour = require('web_tour.tour');
+
+tour.register('shop_list_view_b2c', {
+ test: true,
+ url: '/shop?search=Test Product',
+},
+ [
+ {
+ content: "check price on /shop",
+ trigger: '.oe_product_cart .oe_currency_value:contains("825.00")',
+ run: function () {},
+ },
+ {
+ content: "select product",
+ trigger: '.oe_product_cart a:contains("Test Product")',
+ },
+ {
+ content: "check list view of variants is disabled initially (when on /product page)",
+ trigger: 'body:not(:has(.js_product_change))',
+ extra_trigger: '#product_details',
+ run: function () {},
+ },
+ {
+ content: "open customize menu",
+ trigger: '#customize-menu > a',
+ extra_trigger: 'body:not(.notReady)',
+ },
+ {
+ content: "click on 'List View of Variants'",
+ trigger: '#customize-menu a:contains(List View of Variants)',
+ },
+ {
+ content: "check page loaded after list of variant customization enabled",
+ trigger: '.js_product_change',
+ run: function () {},
+ },
+ {
+ context: "check variant price",
+ trigger: '.custom-radio:contains("Aluminium") .badge:contains("+") .oe_currency_value:contains("55.44")',
+ run: function () {},
+ },
+ {
+ content: "check price is 825",
+ trigger: '.product_price .oe_price .oe_currency_value:containsExact("825.00")',
+ run: function () {},
+ },
+ {
+ content: "switch to another variant",
+ trigger: '.js_product label:contains("Aluminium")',
+ },
+ {
+ content: "verify that price has changed when changing variant",
+ trigger: '.product_price .oe_price .oe_currency_value:containsExact("880.44")',
+ run: function () {},
+ },
+ {
+ content: "click on 'Add to Cart' button",
+ trigger: 'a:contains(Add to Cart)',
+ },
+ {
+ content: "check price on /cart",
+ trigger: '#cart_products .oe_currency_value:containsExact("880.44")',
+ run: function () {},
+ },
+ ]
+);
+
+});
diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_mail.js b/addons/website_sale/static/tests/tours/website_sale_shop_mail.js
new file mode 100644
index 00000000..6d30c3ee
--- /dev/null
+++ b/addons/website_sale/static/tests/tours/website_sale_shop_mail.js
@@ -0,0 +1,99 @@
+odoo.define('website_sale.tour_shop_mail', function (require) {
+'use strict';
+
+var rpc = require('web.rpc');
+var tour = require('web_tour.tour');
+
+require('web.dom_ready');
+
+tour.register('shop_mail', {
+ test: true,
+ url: '/',
+},
+[
+ {
+ content: "Change the domain of the websites and go to shop",
+ trigger: 'body',
+ run: function () {
+ // We change the domain of the website to test that the email that
+ // will be sent uses the correct domain for its links.
+ var def1 = rpc.query({
+ 'model': 'website',
+ 'method': 'write',
+ 'args': [[1], {
+ 'domain': "my-test-domain.com",
+ }],
+ });
+ // We need to change the domain of all the websites otherwise the
+ // website selector will return the website 2 since the domain we
+ // set on website 1 doesn't actually match our test server.
+ var def2 = rpc.query({
+ 'model': 'website',
+ 'method': 'write',
+ 'args': [[2], {
+ 'domain': "https://domain-not-used.fr",
+ }],
+ });
+ Promise.all([def1, def2]).then(function (data) {
+ window.location.href = '/shop?search=Acoustic Bloc Screens';
+ });
+ },
+ },
+ {
+ content: "select Acoustic Bloc Screens",
+ trigger: '.oe_product_cart a:containsExact("Acoustic Bloc Screens")',
+ },
+ {
+ content: "click add to cart",
+ trigger: '#product_details #add_to_cart',
+ },
+ {
+ content: "check product is in cart, get cart id, go to backend",
+ trigger: 'td.td-product_name:contains("Acoustic Bloc Screens")',
+ run: function () {
+ var orderId = $('.my_cart_quantity').data('order-id');
+ window.location.href = "/web#action=sale.action_orders&view_type=form&id=" + orderId;
+ },
+ },
+ {
+ content: "click confirm",
+ trigger: '.btn[name="action_confirm"]',
+ },
+ {
+ content: "click send by email",
+ trigger: '.btn[name="action_quotation_send"]',
+ extra_trigger: '.o_statusbar_status .btn-primary:contains("Sales Order")',
+ },
+ {
+ content: "Open recipients dropdown",
+ trigger: '.o_field_many2one[name="partner_ids"] .ui-autocomplete-input',
+ run: 'click',
+ },
+ {
+ content: "Select azure interior",
+ trigger: '.ui-menu-item a:contains(Interior24)',
+ in_modal: false,
+ },
+ {
+ content: "click Send email",
+ trigger: '.btn[name="action_send_mail"]',
+ extra_trigger: '.o_badge_text:contains("Azure")',
+ },
+ {
+ content: "wait mail to be sent, and go see it",
+ trigger: '.o_Message_content:contains("Your"):contains("order")',
+ run: function () {
+ window.location.href = "/web#action=mail.action_view_mail_mail&view_type=list";
+ },
+ },
+ {
+ content: "click on the first email",
+ trigger: '.o_data_cell:contains("(Ref S")',
+ },
+ {
+ content: "check it's the correct email, and the URL is correct too",
+ trigger: 'div.oe_form_field_html[name="body_html"] p:contains("Your"):contains("order")',
+ extra_trigger: 'div.oe_form_field_html[name="body_html"] a[href^="http://my-test-domain.com"]',
+ },
+]);
+});
diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_no_variant_attribute.js b/addons/website_sale/static/tests/tours/website_sale_shop_no_variant_attribute.js
new file mode 100644
index 00000000..169819fe
--- /dev/null
+++ b/addons/website_sale/static/tests/tours/website_sale_shop_no_variant_attribute.js
@@ -0,0 +1,37 @@
+odoo.define('website_sale.tour_shop_no_variant_attribute', function (require) {
+'use strict';
+
+var tour = require('web_tour.tour');
+
+// This tour relies on a data created from the python test.
+tour.register('tour_shop_no_variant_attribute', {
+ test: true,
+ url: '/shop?search=Test Product 3',
+},
+[
+ {
+ content: "select Test Product 3",
+ trigger: '.oe_product_cart a:containsExact("Test Product 3")',
+ },
+ {
+ content: "check price",
+ trigger: '.oe_currency_value:contains("1.00")',
+ run: function () {},
+ },
+ {
+ content: "add to cart",
+ trigger: 'a:contains(Add to Cart)',
+ },
+ {
+ content: "check no_variant value is present",
+ trigger: '.td-product_name:contains(No Variant Attribute: No Variant Value)',
+ extra_trigger: '#cart_products',
+ run: function () {},
+ },
+ {
+ content: "check price is correct",
+ trigger: '.td-price:contains(11.0)',
+ run: function () {},
+ },
+]);
+});
diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_zoom.js b/addons/website_sale/static/tests/tours/website_sale_shop_zoom.js
new file mode 100644
index 00000000..3c57436f
--- /dev/null
+++ b/addons/website_sale/static/tests/tours/website_sale_shop_zoom.js
@@ -0,0 +1,48 @@
+odoo.define('website_sale.tour_shop_zoom', function (require) {
+'use strict';
+
+var tour = require('web_tour.tour');
+
+var imageSelector = '#o-carousel-product .carousel-item.active img';
+var imageName = "A Colorful Image";
+var nameGreen = "Forest Green";
+
+// This tour relies on a data created from the python test.
+tour.register('shop_zoom', {
+ test: true,
+ url: '/shop?search=' + imageName,
+},
+[
+ {
+ content: "select " + imageName,
+ trigger: '.oe_product_cart a:containsExact("' + imageName + '")',
+ },
+ {
+ content: "click on the image",
+ trigger: imageSelector,
+ run: 'clicknoleave',
+ },
+ {
+ content: "check there is no zoom on that small image",
+ trigger: 'body:not(:has(.zoomodoo-flyout img))',
+ },
+ {
+ content: "change variant",
+ trigger: 'input[data-attribute_name="Beautiful Color"][data-value_name="' + nameGreen + '"]',
+ run: 'click',
+ },
+ {
+ content: "wait for variant to be loaded",
+ trigger: '.oe_currency_value:contains("21.00")'
+ },
+ {
+ content: "click on the image",
+ trigger: imageSelector,
+ run: 'clicknoleave',
+ },
+ {
+ content: "check there is a zoom on that big image",
+ trigger: '.zoomodoo-flyout img',
+ },
+]);
+});