Initial commit: Sale packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:49 +02:00
commit 14e3d26998
6469 changed files with 2479670 additions and 0 deletions

View file

@ -0,0 +1,85 @@
/** @odoo-module **/
import wsTourUtils from 'website_sale.tour_utils';
import wTourUtils from 'website.tour_utils';
function editAddToCartSnippet() {
return [
...wTourUtils.clickOnEditAndWaitEditMode(),
wTourUtils.clickOnSnippet({id: 's_add_to_cart'})
]
}
wTourUtils.registerWebsitePreviewTour('add_to_cart_snippet_tour', {
url: '/',
edition: true,
test: true,
},
[
wTourUtils.dragNDrop({name: 'Add to Cart Button'}),
// Basic product with no variants
wTourUtils.clickOnSnippet({id: 's_add_to_cart'}),
...wTourUtils.selectElementInWeSelectWidget('product_template_picker_opt', 'Product No Variant', true),
...wTourUtils.clickOnSave(),
wTourUtils.clickOnElement('add to cart button', 'iframe .s_add_to_cart_btn'),
{
trigger: "iframe nav li.o_wsale_my_cart sup:contains(1)",
run: () => null,
},
// Product with 2 variants with visitor choice (will open modal)
...editAddToCartSnippet(),
...wTourUtils.selectElementInWeSelectWidget('product_template_picker_opt', 'Product Yes Variant 1', true),
...wTourUtils.clickOnSave(),
wTourUtils.clickOnElement('add to cart button', 'iframe .s_add_to_cart_btn'),
wTourUtils.clickOnElement('continue shopping', 'iframe span:contains(Continue Shopping)'),
{
trigger: "body:not(:has(.modal))",
run: () => null,
},
{
trigger: "iframe nav li.o_wsale_my_cart sup:contains(2)",
run: () => null,
},
// Product with 2 variants with a variant selected
...editAddToCartSnippet(),
...wTourUtils.selectElementInWeSelectWidget('product_template_picker_opt', 'Product Yes Variant 2', true),
{
run: () => null,
trigger:
`we-select[data-name=product_variant_picker_opt] we-toggler:contains("Visitor's Choice")`,
},
...wTourUtils.selectElementInWeSelectWidget('product_variant_picker_opt', 'Product Yes Variant 2 (Pink)'),
...wTourUtils.clickOnSave(),
wTourUtils.clickOnElement('add to cart button', 'iframe .s_add_to_cart_btn'),
{
trigger: "iframe nav li.o_wsale_my_cart sup:contains(3)",
run: () => null,
},
// Basic product with no variants and action=buy now
...editAddToCartSnippet(),
...wTourUtils.selectElementInWeSelectWidget('product_template_picker_opt', 'Product No Variant', true),
{
run: () => null,
trigger:
`we-select[data-name=action_picker_opt] we-toggler:contains("Add to Cart")`,
},
...wTourUtils.selectElementInWeSelectWidget('action_picker_opt', 'Buy Now'),
...wTourUtils.clickOnSave(),
wTourUtils.clickOnElement('add to cart button', 'iframe .s_add_to_cart_btn'),
{
// wait for the page to load, as the next check was sometimes too fast
content: "Wait for the redirection to the payment page",
trigger: "div#oe_structure_website_sale_payment_1",
run: () => null,
},
wTourUtils.assertPathName('/shop/payment', 'button[name=o_payment_submit_button]'),
wsTourUtils.goToCart({quantity: 4, backend: false}),
wsTourUtils.assertCartContains({productName: 'Product No Variant'}),
wsTourUtils.assertCartContains({productName: 'Product Yes Variant 1 (Red)'}),
wsTourUtils.assertCartContains({productName: 'Product Yes Variant 2 (Pink)'}),
],
);

View file

@ -0,0 +1,96 @@
odoo.define('website_sale.tour', function (require) {
'use strict';
var tour = require("web_tour.tour");
const tourUtils = require('website_sale.tour_utils');
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"] #add_to_cart',
},
tourUtils.goToCart(),
{
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[name="o_payment_submit_button"]:visible:not(:disabled)',
},
{
content: "finish",
trigger: '.oe_website_sale:contains("Please use the following transfer details")',
// 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
},
]
);
});

View file

@ -0,0 +1,46 @@
/** @odoo-module **/
import tour from 'web_tour.tour';
import wTourUtils from 'website.tour_utils';
tour.register('website_sale_cart_popover_tour', {
test: true,
url: '/shop',
},
[
{
content: "Search for the product",
trigger: 'form input[name="search"]',
run: 'text website_sale_cart_popover_tour_product'
},
wTourUtils.clickOnElement('Search', 'form:has(input[name="search"]) .oe_search_button'),
wTourUtils.clickOnElement('website_sale_cart_popover_tour_product', 'a:contains(website_sale_cart_popover_tour_product)'),
wTourUtils.clickOnElement('Add to Cart', '#product_detail form[action^="/shop/cart/update"] #add_to_cart'),
{
content: "hover on cart popover",
trigger: '#top_menu a[href$="/shop/cart"]',
run: () => {
$('#top_menu a[href$="/shop/cart"]').mouseenter();
},
},
{
content: "check that popover is visible",
trigger: '.mycart-popover:visible',
run: () => {},
},
// Trigger mouseleave to close the popover
{
content: "hover on cart popover",
trigger: '#top_menu a[href$="/shop/cart"]',
run: () => {
$('#top_menu a[href$="/shop/cart"]').mouseleave();
},
},
// Check that popover is not visible
{
content: "check that popover is not visible",
trigger: ':not(.mycart-popover:visible)',
run: () => {},
},
]
);

View file

@ -0,0 +1,65 @@
/** @odoo-modules */
import tour from 'web_tour.tour';
import wTourUtils from 'website.tour_utils';
tour.register('category_page_and_products_snippet_edition', {
test: true,
url: wTourUtils.getClientActionUrl('/shop'),
}, [
{
content: "Navigate to category",
trigger: 'iframe .o_wsale_filmstip > li:contains("Test Category")',
},
wTourUtils.clickOnEdit(),
Object.assign(wTourUtils.dragNDrop({id: 's_dynamic_snippet_products', name: 'Products'}), {
content: "Drag and drop the product snippet inside the category area",
run: 'drag_and_drop iframe #category_header',
}),
{
content: "Click on the product snippet to show its options",
trigger: 'iframe #category_header .s_dynamic_snippet_products',
},
{
content: "Open category option dropdown",
trigger: 'we-select[data-attribute-name="productCategoryId"] we-toggler',
},
{
content: "Choose the option to use the current page's category",
trigger: 'we-button[data-select-data-attribute="current"]',
},
...wTourUtils.clickOnSave(),
]);
tour.register('category_page_and_products_snippet_use', {
test: true,
url: `/shop`,
}, [
{
content: "Navigate to category",
trigger: '.o_wsale_filmstip > li:contains("Test Category")',
},
{
content: "Check that the snippet displays the right products",
// Wait for at least one shown product
trigger: '#category_header .s_dynamic_snippet_products:has(.o_carousel_product_img_link)',
run: function () {
// Fetch the category's id from the url.
const productCategoryId = window.location.href.match('/shop/category/test-category-(\\d+)')[1]
const productGridEl = this.$anchor[0].closest('#products_grid');
const regex = new RegExp(`^/shop/[\\w-/]+-(\\d+)\\?category=${productCategoryId}$`);
const allPageProductIDs = [...productGridEl.querySelectorAll('.oe_product_image_link')]
.map(el => el.getAttribute('href').match(regex)[1]);
const $shownProductLinks = this.$anchor.find('.o_carousel_product_img_link');
const regex2 = new RegExp(`^/shop/[\\w-/]+-(\\d+)(?:#attr=\\d*)?$`);
for (const shownProductLinkEl of $shownProductLinks) {
const productID = shownProductLinkEl.getAttribute('href').match(regex2)[1];
if (!allPageProductIDs.includes(productID)) {
console.error(`The snippet displays a product (${productID}) which does not belong to the current category (${allPageProductIDs})`);
}
}
},
},
]);

View file

@ -0,0 +1,390 @@
odoo.define('website_sale_tour.tour', function (require) {
'use strict';
var tour = require("web_tour.tour");
var rpc = require("web.rpc");
const tourUtils = require('website_sale.tour_utils');
tour.register('website_sale_tour_1', {
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',
},
tourUtils.goToCart({quantity: 2}),
{
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[name="o_payment_submit_button"]: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_frontend_to_backend_nav', // Check if the user is connected
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',
},
tourUtils.goToCart({quantity: 2}),
{
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 Sign in Button",
trigger: '.oe_cart a:contains(" Sign 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[name="o_payment_submit_button"]: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();
},
}]);
tour.register('website_sale_tour_2', {
test: true,
url: '/shop/cart',
}, [
{
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',
},
tourUtils.goToCart(),
{
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[name="o_payment_submit_button"]:visible',
}]);
});

View file

@ -0,0 +1,21 @@
/** @odoo-module **/
import wTourUtils from 'website.tour_utils';
wTourUtils.registerWebsitePreviewTour('website_sale_tour_backend', {
test: true,
url: '/shop/cart',
edition: true,
}, [
{
content: "open customize tab",
trigger: '.o_we_customize_snippet_btn',
},
{
content: "Enable Extra step",
extra_trigger: '#oe_snippets .o_we_customize_panel',
trigger: '[data-customize-website-views="website_sale.extra_info_option"] we-checkbox',
},
...wTourUtils.clickOnSave(),
],
);

View file

@ -0,0 +1,37 @@
odoo.define('website_sale_tour.website_sale_fiscal_position_tour', function (require) {
'use strict';
var tour = require("web_tour.tour");
tour.register('website_sale_fiscal_position_portal_tour', {
test: true,
url: '/shop?search=Super%20Product'
}, [
{
content: "Check price",
trigger: ".oe_product:contains('Super product') .product_price:contains('80.00')",
run: function() {} // Check
},
]);
tour.register('website_sale_fiscal_position_public_tour', {
test: true,
url: '/shop?search=Super%20Product'
}, [
{
content: "Toggle Pricelist",
trigger: ".o_pricelist_dropdown > .dropdown-toggle",
run: 'click',
},
{
content: "Change Pricelist",
trigger: ".dropdown-item:contains('EUROPE EUR')",
run: 'click',
},
{
content: "Check price",
trigger: ".oe_product:contains('Super product') .product_price:contains('92.00')",
run: function() {} // Check
},
]);
});

View file

@ -0,0 +1,74 @@
odoo.define('website_sale.google_analytics', function (require) {
'use strict';
const tour = require("web_tour.tour");
const websiteSaleTracking = require('website_sale.tracking');
let itemId;
websiteSaleTracking.include({
// Purposely don't call super to avoid call to third party (GA) during tests
_onViewItem(event, data) {
$('body').attr('view-event-id', data.item_id);
},
_onAddToCart(event, data) {
$('body').attr('cart-event-id', data.item_id);
},
});
tour.register('google_analytics_view_item', {
test: true,
url: '/shop?search=Colored T-Shirt',
},
[
{
content: "select Colored T-Shirt",
trigger: '.oe_product_cart a:contains("Colored T-Shirt")',
},
{
content: "wait until `_getCombinationInfo()` rpc is done",
trigger: 'body[view-event-id]',
timeout: 25000,
run: () => {
const $body = $('body');
itemId = $body.attr('view-event-id');
$body.removeAttr('view-event-id');
}
},
{
content: 'select another variant',
extra_trigger: 'body:not([view-event-id])',
trigger: 'ul.js_add_cart_variants ul.list-inline li:has(label.active) + li:has(label) input',
},
{
content: 'wait until `_getCombinationInfo()` rpc is done (2)',
// a new view event should have been generated, for another variant
trigger: `body[view-event-id][view-event-id!=${itemId}]`,
timeout: 25000,
run: () => {}, // it's a check
},
]);
tour.register('google_analytics_add_to_cart', {
test: true,
url: '/shop?search=Basic Shirt',
},
[
{
content: "select Basic Shirt",
trigger: '.oe_product_cart a:contains("Basic Shirt")',
},
{
content: "click add to cart button on product page",
trigger: '#add_to_cart',
},
{
content: 'check add to cart event',
extra_trigger: 'body[cart-event-id]',
trigger: 'a:has(.my_cart_quantity:containsExact(1))',
timeout: 25000,
run: () => {}, // it's a check
},
]);
});

View file

@ -0,0 +1,69 @@
/** @odoo-module **/
import wTourUtils from "website.tour_utils";
const clickOnImgAndWaitForLoad = [
{
content: "Click on the product image",
trigger: "iframe #o-carousel-product img[alt='Test Remove Image']",
},
{
content: "Check that the snippet editor of the clicked image has been loaded",
trigger: "we-customizeblock-options:has(we-title:contains('Re-order'))",
run: () => null,
},
];
const enterEditModeOfTestProduct = [
{
content: "Click on the product anchor",
trigger: "iframe a:contains('Test Remove Image')",
},
...wTourUtils.clickOnEditAndWaitEditMode(),
];
const removeImg = [
{
content: "Click on Remove",
trigger: "we-customizeblock-options:has(we-title:contains('Image')) we-button[data-name='media_wsale_remove']",
},
// If the snippet editor is not visible, the remove process is considered as
// finished.
{
content: "Check that the snippet editor is not visible",
trigger: ".o_we_customize_panel:not(:has(we-customizeblock-options:has(we-title:contains('Re-order'))))",
run: () => null,
},
];
wTourUtils.registerWebsitePreviewTour("add_and_remove_main_product_image_no_variant", {
url: "/shop?search=Test Remove Image",
test: true,
}, [
...enterEditModeOfTestProduct,
{
content: "Double click on the product image",
trigger: "iframe #o-carousel-product img[alt='Test Remove Image']",
run: "dblclick",
},
{
content: "Click on the new image",
trigger: ".o_select_media_dialog img[title='s_default_image.jpg']",
},
{
content: "Check that the snippet editor of the clicked image has been loaded",
trigger: "we-customizeblock-options:has(we-title:contains('Re-order'))",
run: () => null,
},
...removeImg,
]);
wTourUtils.registerWebsitePreviewTour("remove_main_product_image_with_variant", {
url: "/shop?search=Test Remove Image",
test: true,
}, [
...enterEditModeOfTestProduct,
...clickOnImgAndWaitForLoad,
...wTourUtils.clickOnSave(),
...wTourUtils.clickOnEditAndWaitEditMode(),
...clickOnImgAndWaitForLoad,
...removeImg,
]);

View file

@ -0,0 +1,68 @@
/** @odoo-module **/
import tour from 'web_tour.tour';
import wsTourUtils from 'website_sale.tour_utils';
import wTourUtils from 'website.tour_utils';
tour.register('website_sale_reorder_from_portal', {
test: true,
url: '/my/orders',
},
[
// Initial reorder, nothing in cart
{
content: 'Select first order',
trigger: '.o_portal_my_doc_table a:first',
},
wTourUtils.clickOnElement('Reorder Again', '.o_wsale_reorder_button'),
wTourUtils.clickOnElement('Confirm', '.o_wsale_reorder_confirm'),
wsTourUtils.assertCartContains({productName: 'Reorder Product 1'}),
wsTourUtils.assertCartContains({productName: 'Reorder Product 2'}),
{
content: "Check that quantity is 1",
trigger: ".js_quantity[value='1']",
},
// Second reorder, add reorder to cart
{
content: "Go back to my orders",
trigger: "body",
run: () => {
window.location = "/my/orders";
}
},
{
content: 'Select first order',
trigger: '.o_portal_my_doc_table a:first',
},
wTourUtils.clickOnElement('Reorder Again', '.o_wsale_reorder_button'),
wTourUtils.clickOnElement('Confirm', '.o_wsale_reorder_confirm'),
wTourUtils.clickOnElement('No', 'button:contains(No)'),
wsTourUtils.assertCartContains({productName: 'Reorder Product 1'}),
wsTourUtils.assertCartContains({productName: 'Reorder Product 2'}),
{
content: "Check that quantity is 2",
trigger: ".js_quantity[value='2']",
},
// Third reorder, clear cart and reorder
{
content: "Go back to my orders",
trigger: "body",
run: () => {
window.location = "/my/orders";
}
},
{
content: 'Select first order',
trigger: '.o_portal_my_doc_table a:first',
},
wTourUtils.clickOnElement('Reorder Again', '.o_wsale_reorder_button'),
wTourUtils.clickOnElement('Confirm', '.o_wsale_reorder_confirm'),
wTourUtils.clickOnElement('Yes', 'button:contains(Yes)'),
wsTourUtils.assertCartContains({productName: 'Reorder Product 1'}),
wsTourUtils.assertCartContains({productName: 'Reorder Product 2'}),
{
content: "Check that quantity is 1",
trigger: ".js_quantity[value='1']",
},
]
);

View file

@ -0,0 +1,43 @@
/** @odoo-modules */
import wTourUtils from 'website.tour_utils';
wTourUtils.registerWebsitePreviewTour('website_sale_restricted_editor_ui', {
test: true,
url: `/shop`,
}, [
{
content: "Open the site menu to check what is inside",
trigger: '[data-menu-xmlid="website.menu_site"]',
},
{
// Not very robust but still nice to have an extra check as this is the
// main purpose of this tour
content: "First check the user is not a designer",
trigger: '.dropdown-menu:has([data-menu-xmlid="website_sale.menu_product_pages"]):not(:has([data-menu-xmlid="website.menu_website_pages_list"]))',
},
{
content: "Ensure the publish and 'edit-in-backend' buttons are not shown",
trigger: '.o_menu_systray:not(:has(.o_switch_danger_success)):not(:has(.o_website_edit_in_backend))',
// Wait for the possibility to edit to appear
extra_trigger: '.o_menu_systray .o_edit_website_container a',
},
{
content: "Navigate to the first product",
trigger: 'iframe .oe_product_image_link',
},
{
content: "Click on publish/unpublish",
trigger: '.o_menu_systray_item .o_switch_danger_success:has(input:checked)',
},
{
content: "Click on edit-in-backend",
trigger: '.o_menu_systray .o_website_edit_in_backend a',
extra_trigger: '.o_menu_systray_item:not([data-processing]) .o_switch_danger_success:has(input:not(:checked))',
},
{
content: "Check that you landed on a form view and that the record was unpublished",
trigger: '.o_form_sheet [name="is_published"] .fa-globe.text-danger',
run: () => {},
},
]);

View file

@ -0,0 +1,98 @@
/** @odoo-module **/
import tour from 'web_tour.tour';
function fail(errorMessage) {
tour._consume_tour(tour.running_tour, errorMessage);
}
function assert(current, expected, info) {
if (current !== expected) {
fail(info + ': "' + current + '" instead of "' + expected + '".');
}
}
tour.register('tour_shop_archived_variant_multi', {
test: true,
url: '/shop?search=Test Product 2',
},
[
{
content: "select Test Product",
trigger: '.oe_product_cart a:containsExact("Test Product 2")',
},
{
content: 'click on the first variant',
trigger: 'input[data-attribute_name="Size"][data-value_name="Small"]',
},
{
content: "click on the second variant",
trigger: 'input[data-attribute_name="Color"][data-value_name="Black"]',
},
{
content: "Check that brand b is not available and select it",
trigger: '.css_not_available input[data-attribute_name="Brand"][data-value_name="Brand B"]',
},
{
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 () {},
},
{
content: "change second variant to remove warning",
trigger: 'input[data-attribute_name="Color"][data-value_name="White"]',
},
{
content: "Check that second variant is disabled",
trigger: '.css_not_available input[data-attribute_name="Color"][data-value_name="Black"]',
run: function () {},
},
]);
tour.register('test_09_pills_variant', {
test: true,
url: '/shop?search=Test Product 2',
},
[
{
content: "select Test Product",
trigger: '.oe_product_cart a:containsExact("Test Product 2")',
},
{
content: "check there are two radio boxes, both hidden",
trigger: '.js_main_product',
run: function() {
var buttons = $('input.js_variant_change');
function isVisuallyHidden(elem) {
const style = window.getComputedStyle(elem);
return style.display === "none" ||
style.visibility === "hidden" ||
style.opacity === "0" ||
(style.width === "0px" && style.height === "0px")
}
assert(buttons.length, 2, "there should be two radio inputs")
assert(isVisuallyHidden(buttons[0]), true, "first radio input is not hidden")
assert(isVisuallyHidden(buttons[1]), true, "second radio input is not hidden")
assert(buttons[0].checked, true, "first radio input should be checked")
},
},
{
content: "click on the second variant label",
trigger: 'label:contains("Small")',
},
{
content: 'check second variant is selected',
trigger: 'li.o_variant_pills.active:contains("Small")',
run: function () {
var button = $('input.js_variant_change[data-attribute_name="Size"][data-value_name="Small"]');
assert(button.length, 1, "there should be one radio input")
assert(button[0].checked, true, "the radio input should be checked")
}
},
]);

View file

@ -0,0 +1,87 @@
odoo.define('website_sale.tour_shop_cart_recovery', function (require) {
'use strict';
var localStorage = require('web.local_storage');
var tour = require('web_tour.tour');
const tourUtils = require('website_sale.tour_utils');
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',
},
tourUtils.goToCart(),
{
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: '.dropdown-toggle:contains("Action")',
},
{
content: "click Send a Cart Recovery Email",
trigger: 'span: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 () {},
},
]);
});

View file

@ -0,0 +1,47 @@
/** @odoo-module **/
import tour from 'web_tour.tour';
import tourUtils from 'website_sale.tour_utils';
tour.register('compare_list_price_price_list_display', {
test: true,
url: '/shop?search=test_product'
},
[
tourUtils.assertProductPrice("price_reduce", "1,000", "test_product_default"),
tourUtils.assertProductPrice("price_reduce", "2,000", "test_product_with_compare_list_price"),
tourUtils.assertProductPrice("base_price", "2,500", "test_product_with_compare_list_price"),
tourUtils.assertProductPrice("price_reduce", "2,000", "test_product_with_pricelist"),
tourUtils.assertProductPrice("price_reduce", "4,000", "test_product_with_pricelist_and_compare_list_price"),
tourUtils.assertProductPrice("base_price", "4,500", "test_product_with_pricelist_and_compare_list_price"),
...tourUtils.selectPriceList('pricelist_other_currency'),
tourUtils.assertProductPrice("price_reduce", "2,000", "test_product_default"),
tourUtils.assertProductPrice("price_reduce", "4,000", "test_product_with_compare_list_price"),
tourUtils.assertProductPrice("base_price", "5,000", "test_product_with_compare_list_price"),
tourUtils.assertProductPrice("price_reduce", "4,000", "test_product_with_pricelist"),
tourUtils.assertProductPrice("price_reduce", "8,000", "test_product_with_pricelist_and_compare_list_price"),
tourUtils.assertProductPrice("base_price", "9,000", "test_product_with_pricelist_and_compare_list_price"),
...tourUtils.selectPriceList('pricelist_with_discount'),
tourUtils.assertProductPrice("price_reduce", "1,000", "test_product_default"),
tourUtils.assertProductPrice("price_reduce", "2,000", "test_product_with_compare_list_price"),
tourUtils.assertProductPrice("base_price", "2,500", "test_product_with_compare_list_price"),
tourUtils.assertProductPrice("price_reduce", "1,500", "test_product_with_pricelist"),
tourUtils.assertProductPrice("price_reduce", "3,500", "test_product_with_pricelist_and_compare_list_price"),
tourUtils.assertProductPrice("base_price", "4,500", "test_product_with_pricelist_and_compare_list_price"),
...tourUtils.selectPriceList('pricelist_without_discount'),
tourUtils.assertProductPrice("price_reduce", "1,000", "test_product_default"),
tourUtils.assertProductPrice("price_reduce", "2,000", "test_product_with_compare_list_price"),
tourUtils.assertProductPrice("base_price", "2,500", "test_product_with_compare_list_price"),
tourUtils.assertProductPrice("price_reduce", "1,500", "test_product_with_pricelist"),
tourUtils.assertProductPrice("base_price", "2,000", "test_product_with_pricelist"),
tourUtils.assertProductPrice("price_reduce", "3,500", "test_product_with_pricelist_and_compare_list_price"),
tourUtils.assertProductPrice("base_price", "4,500", "test_product_with_pricelist_and_compare_list_price"),
]
);

View file

@ -0,0 +1,31 @@
odoo.define("website_sale.tour_shop_custom_attribute_value", function (require) {
"use strict";
var tour = require("web_tour.tour");
const tourUtils = require('website_sale.tour_utils');
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',
},
tourUtils.goToCart(),
{
trigger: 'span:contains(Custom TEST: Wood)',
extra_trigger: '#cart_products',
run: function (){}, // check
}]);
});

View file

@ -0,0 +1,150 @@
/** @odoo-module **/
import tourUtils from 'website_sale.tour_utils';
import wTourUtils from 'website.tour_utils';
wTourUtils.registerWebsitePreviewTour('shop_customize', {
url: '/shop',
edition: true,
test: true,
},
[
...wTourUtils.clickOnSave(),
{
content: "select product attribute Steel",
extra_trigger: "iframe body:not(.editor_enable)",
trigger: 'iframe form.js_attributes input:not(:checked) + label:contains(Steel - Test)',
},
{
content: "check the selection",
trigger: 'iframe form.js_attributes input:checked + label:contains(Steel - Test)',
run: function () {}, // it's a check
},
{
content: "select product",
extra_trigger: 'iframe body:not(:has(.oe_website_sale .oe_product_cart:eq(3)))',
trigger: 'iframe .oe_product_cart a:contains("Test Product")',
},
{
content: "check list view of variants is disabled initially",
extra_trigger: "iframe #product_detail",
trigger: 'iframe body:not(:has(.js_product_change))',
run: function () {},
},
...wTourUtils.clickOnEditAndWaitEditMode(),
{
content: "open customize tab",
trigger: '.o_we_customize_snippet_btn',
},
{
content: "open 'Variants' selector",
extra_trigger: '#oe_snippets .o_we_customize_panel',
trigger: '[data-name="variants_opt"] we-toggler',
},
{
content: "click on 'Products List' of the 'Variants' selector",
trigger: 'we-button[data-name="variants_products_list_opt"]',
},
...wTourUtils.clickOnSave(),
{
context: "check variant price",
extra_trigger: "iframe body:not(.editor_enable)",
trigger: 'iframe .form-check:contains("Aluminium") .badge:contains("+") .oe_currency_value:contains("50.4")',
run: function () {},
},
{
content: "check price is 750",
trigger: "iframe .product_price .oe_price .oe_currency_value:containsExact(750.00)",
run: function () {},
},
{
content: "switch to another variant",
trigger: "iframe .js_product label:contains('Aluminium')",
},
{
content: "verify that price has changed when changing variant",
trigger: "iframe .product_price .oe_price .oe_currency_value:containsExact(800.40)",
run: function () {},
},
...wTourUtils.clickOnEditAndWaitEditMode(),
{
content: "open customize tab",
trigger: '.o_we_customize_snippet_btn',
},
{
content: "open 'Variants' selector",
extra_trigger: '#oe_snippets .o_we_customize_panel',
trigger: '[data-name="variants_opt"] we-toggler',
},
{
content: "click on 'Options' of the 'Variants' selector",
trigger: 'we-button[data-name="variants_options_opt"]',
},
...wTourUtils.clickOnSave(),
{
content: "check page loaded after list of variant customization disabled",
extra_trigger: "iframe body:not(.editor_enable)",
trigger: "iframe .js_product:not(:has(.js_product_change))",
run: function () {}, // it's a check
},
{
content: "check price is 750",
trigger: "iframe .product_price .oe_price .oe_currency_value:containsExact(750.00)",
run: function () {},
},
{
content: "switch to Aluminium variant",
trigger: 'iframe .js_product input[data-value_name="Aluminium"]',
},
{
content: "verify that price has changed when changing variant",
trigger: "iframe .product_price .oe_price .oe_currency_value:containsExact(800.40)",
run: function () {}, // it's a check
},
{
content: "switch back to Steel variant",
trigger: "iframe .js_product label:contains('Steel - Test')",
},
{
content: "check price is 750",
trigger: "iframe .product_price .oe_price .oe_currency_value:containsExact(750.00)",
run: function () {},
},
{
content: "click on 'Add to Cart' button",
trigger: "iframe a:contains(ADD TO CART)",
},
{
content: "check quantity",
trigger: 'iframe .my_cart_quantity:containsExact(1),.o_extra_menu_items .fa-plus',
run: function () {}, // it's a check
},
tourUtils.goToCart({backend: true}),
{
content: "click on shop",
trigger: "iframe a:contains(Continue Shopping)",
extra_trigger: 'iframe body:not(:has(#products_grid_before .js_attributes))',
},
...wTourUtils.clickOnEditAndWaitEditMode(),
{
content: "open customize tab",
trigger: '.o_we_customize_snippet_btn',
},
{
content: "remove 'Attributes'",
extra_trigger: '#oe_snippets .o_we_customize_panel',
trigger: 'we-button[data-name="attributes_opt"]',
},
...wTourUtils.clickOnSave(),
{
content: "wait to exit edit mode",
trigger: '.o_website_preview:not(.editor_has_snippets)',
},
{
content: "finish",
extra_trigger: 'iframe body:not(:has(#products_grid_before .js_attributes))',
trigger: 'iframe #wrap:not(:has(li:has(.my_cart_quantity):visible))',
run: function () {}, // it's a check
},
],
);

View file

@ -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 () {},
}
]);
});

View file

@ -0,0 +1,37 @@
odoo.define('website_sale.tour_shop_dynamic_variants', function (require) {
'use strict';
var tour = require('web_tour.tour');
const tourUtils = require('website_sale.tour_utils');
// 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',
},
tourUtils.goToCart(),
{
content: "check the variant is in the cart",
trigger: 'td.td-product_name:contains(Dynamic Product (Dynamic Value 2))',
},
]);
});

View file

@ -0,0 +1,41 @@
/** @odoo-module **/
import wTourUtils from "website.tour_utils";
wTourUtils.registerWebsitePreviewTour("shop_editor", {
test: true,
url: "/shop",
edition: true,
}, [{
content: "Click on pricelist dropdown",
trigger: "iframe div.o_pricelist_dropdown a[data-bs-toggle=dropdown]",
}, {
trigger: "iframe input[name=search]",
extra_trigger: "iframe div.o_pricelist_dropdown a[data-bs-toggle=dropdown][aria-expanded=true]",
content: "Click somewhere else in the shop.",
}, {
trigger: "iframe div.o_pricelist_dropdown a[data-bs-toggle=dropdown]",
extra_trigger: "iframe div.o_pricelist_dropdown a[data-bs-toggle=dropdown][aria-expanded=false]",
content: "Click on the pricelist again.",
}]);
wTourUtils.registerWebsitePreviewTour("shop_editor_set_product_ribbon", {
test: true,
url: "/shop",
edition: true,
}, [{
content: "Click on first product",
trigger: "iframe .oe_product:first",
}, {
content: "Open the ribbon selector",
trigger: ".o_wsale_ribbon_select we-toggler",
}, {
content: "Select a ribbon",
trigger: '.o_wsale_ribbon_select we-button:contains("Sale")',
},
...wTourUtils.clickOnSave(),
{
content: "Check that the ribbon was properly saved",
trigger: 'iframe .oe_product:first .o_ribbon:contains("Sale")',
run: () => null,
}]);

View file

@ -0,0 +1,76 @@
/** @odoo-module **/
import tourUtils from 'website_sale.tour_utils';
import wTourUtils from 'website.tour_utils';
wTourUtils.registerWebsitePreviewTour('shop_list_view_b2c', {
test: true,
url: '/shop?search=Test Product',
},
[
{
content: "check price on /shop",
trigger: 'iframe .oe_product_cart .oe_currency_value:contains("825.00")',
run: () => {}, // It's a check.
},
{
content: "select product",
trigger: 'iframe .oe_product_cart a:contains("Test Product")',
},
{
content: "check products list is disabled initially (when on /product page)",
trigger: 'iframe body:not(:has(.js_product_change))',
extra_trigger: 'iframe #product_details',
run: () => {}, // It's a check.
},
...wTourUtils.clickOnEditAndWaitEditMode(),
{
content: "open customize tab",
trigger: '.o_we_customize_snippet_btn',
},
{
content: "open 'Variants' selector",
extra_trigger: '#oe_snippets .o_we_customize_panel',
trigger: '[data-name="variants_opt"] we-toggler',
},
{
content: "click on 'Products List' of the 'Variants' selector",
trigger: 'we-button[data-name="variants_products_list_opt"]',
},
...wTourUtils.clickOnSave(),
{
content: "check page loaded after 'Products List' enabled",
trigger: 'iframe .js_product_change',
run: () => {}, // It's a check.
},
{
context: "check variant price",
trigger: 'iframe .form-check:contains("Aluminium") .badge:contains("+") .oe_currency_value:contains("55.44")',
run: () => {}, // It's a check.
},
{
content: "check price is 825",
trigger: 'iframe .product_price .oe_price .oe_currency_value:containsExact(825.00)',
run: () => {}, // It's a check.
},
{
content: "switch to another variant",
trigger: 'iframe .js_product label:contains("Aluminium")',
},
{
content: "verify that price has changed when changing variant",
trigger: 'iframe .product_price .oe_price .oe_currency_value:containsExact(880.44)',
run: () => {}, // It's a check.
},
{
content: "click on 'Add to Cart' button",
trigger: 'iframe a:contains(ADD TO CART)',
},
tourUtils.goToCart({backend: true}),
{
content: "check price on /cart",
trigger: 'iframe #cart_products .oe_currency_value:containsExact(880.44)',
run: () => {}, // It's a check.
},
],
);

View file

@ -0,0 +1,60 @@
odoo.define('website_sale.tour_shop_mail', function (require) {
'use strict';
var tour = require('web_tour.tour');
const tourUtils = require('website_sale.tour_utils');
require('web.dom_ready');
tour.register('shop_mail', {
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',
},
tourUtils.goToCart(),
{
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 .o_arrow_button_current:contains("Sales Order")',
},
{
content: "Open recipients dropdown",
trigger: '.o_field_many2many_tags_email[name=partner_ids] 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")',
},
]);
});

View file

@ -0,0 +1,39 @@
odoo.define('website_sale.tour_shop_no_variant_attribute', function (require) {
'use strict';
var tour = require('web_tour.tour');
const tourUtils = require('website_sale.tour_utils');
// 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)',
},
tourUtils.goToCart(),
{
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 () {},
},
]);
});

View file

@ -0,0 +1,35 @@
odoo.define('website_sale_tour.website_sale_shop_pricelist_tour', function (require) {
'use strict';
var tour = require("web_tour.tour");
tour.register('website_sale_shop_pricelist_tour', {
test: true,
url: '/shop'
}, [
{
content: "Check pricelist",
trigger: ".o_pricelist_dropdown:contains('Public Pricelist 1')",
run: function() {} // Check
},
{
content: "Go to login page",
trigger: ".nav-link:contains('Sign in')"
},
{
content: "Submit login",
trigger: '.oe_login_form',
run: function () {
$('.oe_login_form input[name="login"]').val("toto");
$('.oe_login_form input[name="password"]').val("long_enough_password");
$('.oe_login_form input[name="redirect"]').val("/shop");
$('.oe_login_form').submit();
}
},
{
content: "Check pricelist",
trigger: ".o_pricelist_dropdown:contains('User Pricelist')",
run: function() {} // Check
},
]);
});

View file

@ -0,0 +1,54 @@
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?debug=1&search=' + imageName,
},
[
{
content: "select " + imageName,
trigger: '.oe_product_cart a:containsExact("' + imageName + '")',
},
{
content: "click on the image",
trigger: imageSelector,
run: 'clicknoleave',
},
{
content: "check that the image viewer opened",
trigger: '.o_wsale_image_viewer',
run: () => {},
},
{
content: "close the image viewer",
trigger: '.o_wsale_image_viewer_header span.fa-times',
},
{
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: '.o_wsale_image_viewer',
run: () => {},
},
]);
});

View file

@ -0,0 +1,84 @@
/** @odoo-module */
import wTourUtils from 'website.tour_utils';
import wSaleTourUtils from 'website_sale.tour_utils';
const optionBlock = 'dynamic_snippet_products';
const productsSnippet = {id: 's_dynamic_snippet_products', name: 'Products'};
const templates = [
"dynamic_filter_template_product_product_add_to_cart",
"dynamic_filter_template_product_product_view_detail",
"dynamic_filter_template_product_product_mini_image",
"dynamic_filter_template_product_product_mini_price",
"dynamic_filter_template_product_product_mini_name",
"dynamic_filter_template_product_product_centered",
"dynamic_filter_template_product_product_borderless_1",
"dynamic_filter_template_product_product_borderless_2",
"dynamic_filter_template_product_product_banner",
"dynamic_filter_template_product_product_horizontal_card",
"dynamic_filter_template_product_product_horizontal_card_2",
"dynamic_filter_template_product_product_card_group",
];
function changeTemplate(templateKey) {
const templateClass = templateKey.replace(/dynamic_filter_template_/, "s_");
return [
wTourUtils.changeOption(optionBlock, 'we-select[data-name="template_opt"] we-toggler', 'template'),
wTourUtils.changeOption(optionBlock, `we-button[data-select-data-attribute="website_sale.${templateKey}"]`),
{
content: 'Check the template is applied',
trigger: `iframe .s_dynamic_snippet_products.${templateClass} .carousel`,
run: () => null, // It's a check
},
];
}
let templatesSteps = [];
for (const templateKey of templates) {
templatesSteps = templatesSteps.concat(changeTemplate(templateKey));
}
wTourUtils.registerWebsitePreviewTour('website_sale.snippet_products', {
test: true,
url: '/',
edition: true,
},
[
wTourUtils.dragNDrop(productsSnippet),
wTourUtils.clickOnSnippet(productsSnippet),
...templatesSteps,
...changeTemplate('dynamic_filter_template_product_product_add_to_cart'),
...wTourUtils.clickOnSave(),
{
trigger: "iframe .s_dynamic_snippet_products .o_carousel_product_card_body .js_add_cart",
run: 'click',
},
wSaleTourUtils.goToCart({backend: true}),
]);
wTourUtils.registerWebsitePreviewTour('website_sale.products_snippet_recently_viewed', {
test: true,
url: '/',
edition: true,
},
[
wTourUtils.dragNDrop(productsSnippet),
wTourUtils.clickOnSnippet(productsSnippet),
...changeTemplate('dynamic_filter_template_product_product_add_to_cart'),
wTourUtils.changeOption(optionBlock, 'we-select[data-name="filter_opt"] we-toggler', 'filter'),
wTourUtils.changeOption(optionBlock, 'we-select[data-name="filter_opt"] we-button:contains("Recently Viewed")', 'filter'),
...wTourUtils.clickOnSave(),
{
content: 'make delete icon appear',
trigger: 'iframe .s_dynamic_snippet_products .o_carousel_product_card',
run: function () {
const $iframe = $('.o_iframe').contents();
const $productCard = $iframe.find('.o_carousel_product_card:has(a img[alt="Storage Box"])');
console.log($productCard);
$productCard.find('.js_remove').attr('style', 'display: block;');
}
},
{
trigger: 'iframe .s_dynamic_snippet_products .o_carousel_product_card .js_remove',
run: 'click',
},
]);