19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:32:12 +01:00
parent 79f83631d5
commit 73afc09215
6267 changed files with 1534193 additions and 1130106 deletions

View file

@ -0,0 +1,58 @@
import { registry } from '@web/core/registry';
import { patch } from '@web/core/utils/patch';
import '@website/../tests/tours/configurator_translation';
/*
* @override of website tour to include eCommerce configuration steps
*/
patch(registry.category('web_tour.tours').get('configurator_translation'), {
steps() {
const originalSteps = super.steps();
const websiteBuildStepIndex = originalSteps.findIndex(
(step) => step.id === 'build_website'
);
originalSteps.splice(
websiteBuildStepIndex + 1,
0,
{
content: "Choose a shop page style",
trigger: '.o_configurator_screen:contains(online catalog) .button_area',
run: 'click',
},
{
content: "Choose a product page style",
trigger: '.o_configurator_screen:contains(product page) .button_area',
run: 'click',
},
);
return originalSteps;
},
});
/*
* @override of website tour to include eCommerce configuration steps
*/
patch(registry.category("web_tour.tours").get("configurator_page_creation"), {
steps() {
const originalSteps = super.steps();
const websiteBuildStepIndex = originalSteps.findIndex(
(step) => step.id === "build_website"
);
originalSteps.splice(
websiteBuildStepIndex + 1,
0,
{
content: "Choose a shop page style",
trigger: ".o_configurator_screen:contains('online catalog') .button_area",
run: "click",
},
{
content: "Choose a product page style",
trigger: ".o_configurator_screen:contains('product page') .button_area",
run: "click",
}
);
return originalSteps;
},
});

View file

@ -0,0 +1,40 @@
import { registry } from "@web/core/registry";
import * as tourUtils from "@website_sale/js/tours/tour_utils";
registry.category("web_tour.tours").add("check_free_delivery", {
url: "/shop",
steps: () => [
// Part 1: Check free delivery
...tourUtils.addToCart({ productName: "Office Chair Black TEST", expectUnloadPage: true }),
tourUtils.goToCart({ quantity: 1 }),
tourUtils.goToCheckout(),
{
trigger: "#o_delivery_methods label:text(Delivery Now Free Over 10)",
},
{
content: "Check Free Delivery value to be zero",
trigger: "#o_delivery_methods span:contains('0.0')",
run: "click",
},
// Part 2: check multiple delivery & price loaded asynchronously
{
trigger: '#o_delivery_methods input[name="o_delivery_radio"]:checked',
},
{
content: "Ensure price was loaded asynchronously",
trigger:
'#o_delivery_methods [name="o_delivery_method"]:contains("20.0"):contains("The Poste")',
},
tourUtils.confirmOrder(),
{
content: "Select `Wire Transfer` payment method",
trigger: 'input[name="o_payment_radio"][data-payment-method-code="wire_transfer"]',
run: "click",
},
...tourUtils.pay({ expectUnloadPage: true, waitFinalizeYourPayment: true }),
{
content: "Confirmation page should be shown",
trigger: "#oe_structure_website_sale_confirmation_1:not(:visible)",
},
],
});

View file

@ -1,85 +1,100 @@
/** @odoo-module **/
import {
clickOnEditAndWaitEditMode,
clickOnElement,
clickOnSave,
clickOnSnippet,
insertSnippet,
registerWebsitePreviewTour,
changeOptionInPopover,
} from "@website/js/tours/tour_utils";
import { assertCartContains } from '@website_sale/js/tours/tour_utils';
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'})
...clickOnEditAndWaitEditMode(),
...clickOnSnippet({id: 's_add_to_cart'})
]
}
wTourUtils.registerWebsitePreviewTour('add_to_cart_snippet_tour', {
function checkQuanityInCart(quantity) {
return {
content: `Check if the cart quantity is ${quantity}`,
trigger: `:iframe .my_cart_quantity:contains(${quantity})`,
};
}
registerWebsitePreviewTour('add_to_cart_snippet_tour', {
url: '/',
edition: true,
test: true,
},
[
wTourUtils.dragNDrop({name: 'Add to Cart Button'}),
() => [
...insertSnippet({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,
},
...clickOnSnippet({id: 's_add_to_cart'}),
...changeOptionInPopover("Add to Cart Button", "Product", "Product No Variant"),
...clickOnSave(),
clickOnElement("add to cart button", ":iframe .s_add_to_cart_btn"),
checkQuanityInCart("1"),
// 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,
},
...changeOptionInPopover("Add to Cart Button", "Product", "Product Yes Variant 1"),
...clickOnSave(),
clickOnElement("add to cart button", ":iframe .s_add_to_cart_btn"),
clickOnElement("add to cart", ":iframe .modal button:contains(Add to Cart)"),
checkQuanityInCart("2"),
// Product with 2 variants with a variant selected
...editAddToCartSnippet(),
...wTourUtils.selectElementInWeSelectWidget('product_template_picker_opt', 'Product Yes Variant 2', true),
...changeOptionInPopover("Add to Cart Button", "Product", "Product Yes Variant 2"),
{
run: () => null,
trigger:
`we-select[data-name=product_variant_picker_opt] we-toggler:contains("Visitor's Choice")`,
content: "Check if variant option is visible",
trigger: "[data-container-title='Add to Cart Button'] [data-label='Variant']"
},
...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'),
...changeOptionInPopover("Add to Cart Button", "Variant", "Product Yes Variant 2 (Pink)"),
...clickOnSave(),
clickOnElement("add to cart button", ":iframe .s_add_to_cart_btn"),
// Since 18.2, even if a specific variant is selected, the product configuration modal is displayed
// The variant set on the modal used the default variants attributes (so will not correspond to the selected variant)
// TODO: fix this misbahvior by setting the variant attributes based on the chosen variant
// https://github.com/odoo/odoo/pull/201217#issuecomment-2721871718
{
trigger: "iframe nav li.o_wsale_my_cart sup:contains(3)",
run: () => null,
content: "Check if the red variant is selected",
trigger: ":iframe .modal li:contains(Red) input:checked",
},
{
content: "Click the pink variant",
trigger: ":iframe .modal li:contains(Pink) input",
run: "click",
},
{
content: "Check if the pink variant is selected",
trigger: ":iframe .modal li:contains(Pink) input:checked",
},
clickOnElement('add to cart', ':iframe .modal button:contains(Add to Cart)'),
checkQuanityInCart("3"),
// Basic product with no variants and action=buy now
...editAddToCartSnippet(),
...wTourUtils.selectElementInWeSelectWidget('product_template_picker_opt', 'Product No Variant', true),
...changeOptionInPopover("Add to Cart Button", "Product", "Product No Variant"),
{
run: () => null,
trigger:
`we-select[data-name=action_picker_opt] we-toggler:contains("Add to Cart")`,
content: "Check if action option is visible",
trigger: "[data-container-title='Add to Cart Button'] [data-label='Action']"
},
...wTourUtils.selectElementInWeSelectWidget('action_picker_opt', 'Buy Now'),
...wTourUtils.clickOnSave(),
wTourUtils.clickOnElement('add to cart button', 'iframe .s_add_to_cart_btn'),
...changeOptionInPopover("Add to Cart Button", "Action", "Buy Now"),
// At this point the "Add to cart" button was changed to a "Buy Now" button
...clickOnSave(),
clickOnElement('"Buy Now" button', ':iframe .s_add_to_cart_btn'),
checkQuanityInCart("4"),
{
// 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,
content: "Wait for the redirection to the cart page",
trigger: ":iframe h4:contains(order summary)",
},
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)'}),
...assertCartContains({productName: 'Product No Variant', backend: true}),
...assertCartContains({productName: 'Product Yes Variant 1', combinationName: 'Red', backend: true}),
...assertCartContains({productName: 'Product Yes Variant 2', combinationName: 'Pink', backend: true}),
],
);

View file

@ -1,96 +1,35 @@
odoo.define('website_sale.tour', function (require) {
'use strict';
import { registry } from "@web/core/registry";
import * as tourUtils from "@website_sale/js/tours/tour_utils";
var tour = require("web_tour.tour");
const tourUtils = require('website_sale.tour_utils');
tour.register('shop_buy_product', {
test: true,
registry.category("web_tour.tours").add('shop_buy_product', {
url: '/shop',
},
[
steps: () => [
...tourUtils.searchProduct("Storage Box", { select: true }),
{
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
trigger: '#product_detail form #add_to_cart',
run: "click",
},
tourUtils.goToCart(),
tourUtils.goToCheckout(),
tourUtils.confirmOrder(),
...tourUtils.payWithTransfer({
redirect: true,
expectUnloadPage: true,
waitFinalizeYourPayment: true,
}),
]
});
registry.category("web_tour.tours").add('shop_repair_product', {
url: '/shop',
steps: () => [
...tourUtils.searchProduct("Test Repair Service", { select: true }),
{
content: "click on add to cart",
trigger: '#product_detail form #add_to_cart',
run: "click",
},
tourUtils.goToCart(),
]
);
});

View file

@ -0,0 +1,177 @@
import { registry } from "@web/core/registry";
import * as tourUtils from "@website_sale/js/tours/tour_utils";
registry.category("web_tour.tours").add("website_sale_cart_notification_tax_included", {
url: "/shop",
steps: () => [
...tourUtils.addToCart({
productName: "website_sale_cart_notification_product_1",
expectUnloadPage: true,
}),
{
content: "check that 1 website_sale_cart_notification_product_1 was added",
trigger: '.toast-body span:contains("website_sale_cart_notification_product_1")',
},
{
content: "check that 1 website_sale_cart_notification_product_1 was added",
trigger: '.toast-body span:contains("1")',
},
{
content: "check the price of 1 website_sale_cart_notification_product_1",
trigger: '.toast-body div:contains("$ 1,150.00")',
},
...tourUtils.searchProduct("website_sale_cart_notification_product_2", { select: true }),
{
trigger: "#product_detail",
},
{
content: "change quantity",
trigger: '#product_detail form input[name=add_qty]',
run: "edit 3",
},
{
content: "click on add to cart",
trigger: '#product_detail form #add_to_cart',
run: "click",
},
{
content: "check that 3 website_sale_cart_notification_product_2 was added",
trigger: '.toast-body span:contains("website_sale_cart_notification_product_2")',
},
{
content: "check that 3 website_sale_cart_notification_product_2 was added",
trigger: '.toast-body span:contains("3")',
},
{
content: "check that the novariants/custom attributes are displayed.",
trigger: '.toast-body span.text-muted.small:contains("Size: S")',
},
{
content: "check the price of 3 website_sale_cart_notification_product_2",
trigger: '.toast-body div:contains("$ 17,250.00")',
},
{
content: "Go To Cart",
trigger: '.toast-body a:contains("View cart")',
run: "click",
expectUnloadPage: true,
},
...tourUtils.assertCartContains({
productName: "website_sale_cart_notification_product_1",
backend: false,
}),
...tourUtils.assertCartContains({
productName: "website_sale_cart_notification_product_2",
backend: false,
}),
],
});
registry.category("web_tour.tours").add("website_sale_cart_notification_tax_excluded", {
url: "/shop",
steps: () => [
...tourUtils.addToCart({
productName: "website_sale_cart_notification_product_1",
expectUnloadPage: true,
}),
{
content: "check that 1 website_sale_cart_notification_product_1 was added",
trigger: '.toast-body span:contains("website_sale_cart_notification_product_1")',
},
{
content: "check that 1 website_sale_cart_notification_product_1 was added",
trigger: '.toast-body span:contains("1")',
},
{
content: "check the price of 1 website_sale_cart_notification_product_1",
trigger: '.toast-body div:contains("$ 1,000.00")',
},
...tourUtils.searchProduct("website_sale_cart_notification_product_2", { select: true }),
{
trigger: "#product_detail",
},
{
content: "change quantity",
trigger: '#product_detail form input[name=add_qty]',
run: "edit 3",
},
{
content: "click on add to cart",
trigger: '#product_detail form #add_to_cart',
run: "click",
},
{
content: "check that 3 website_sale_cart_notification_product_2 was added",
trigger: '.toast-body span:contains("website_sale_cart_notification_product_2")',
},
{
content: "check that 3 website_sale_cart_notification_product_2 was added",
trigger: '.toast-body span:contains("3")',
},
{
content: "check that the novariants/custom attributes are displayed.",
trigger: '.toast-body span.text-muted.small:contains("Size: S")',
},
{
content: "check the price of 3 website_sale_cart_notification_product_2",
trigger: '.toast-body div:contains("$ 15,000.00")',
},
{
content: "Go To Cart",
trigger: '.toast-body a:contains("View cart")',
run: "click",
expectUnloadPage: true,
},
...tourUtils.assertCartContains({
productName: "website_sale_cart_notification_product_1",
backend: false,
}),
...tourUtils.assertCartContains({
productName: "website_sale_cart_notification_product_2",
backend: false,
}),
],
});
registry.category("web_tour.tours").add("website_sale_cart_notification_qty_and_total", {
url: "/shop",
steps: () => [
...tourUtils.addToCart({
productName: "website_sale_cart_notification_product_1",
expectUnloadPage: true,
}),
{
content: "check that 1 website_sale_cart_notification_product_1 was added",
trigger: '.toast-body span:contains("website_sale_cart_notification_product_1")',
},
{
content: "check that 1 website_sale_cart_notification_product_1 was added",
trigger: '.toast-body span:contains("1")',
},
{
content: "check the price of 1 website_sale_cart_notification_product_1",
trigger: '.toast-body div:contains("$ 1,000.00")',
},
// Again add same product
{
content: "change quantity",
trigger: '#product_detail form input[name=add_qty]',
run: "edit 3",
},
{
content: "click on add to cart",
trigger: '#product_detail form #add_to_cart',
run: "click",
},
{
content: "check that only newly added qty showing in the notification",
trigger: '.toast-body span:contains("3")',
},
{
content: "check that price total only showing total of newly added quantity",
trigger: '.toast-body div:contains("$ 3,000.00")',
},
],
});

View file

@ -1,46 +0,0 @@
/** @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

@ -1,59 +1,77 @@
/** @odoo-modules */
import tour from 'web_tour.tour';
import wTourUtils from 'website.tour_utils';
import { registry } from "@web/core/registry";
import { clickOnSave, clickOnEditAndWaitEditMode, registerWebsitePreviewTour } from '@website/js/tours/tour_utils';
tour.register('category_page_and_products_snippet_edition', {
test: true,
url: wTourUtils.getClientActionUrl('/shop'),
}, [
registerWebsitePreviewTour('category_page_and_products_snippet_edition', {
url: '/shop',
}, () => [
{
content: "Navigate to category",
trigger: 'iframe .o_wsale_filmstip > li:contains("Test Category")',
trigger: ':iframe .o_wsale_filmstrip > li:contains("Test Category") > a',
run: "click",
},
{
content: "Wait for page to load",
trigger: ":iframe h1:contains('Test Category'):not(:visible)",
},
...clickOnEditAndWaitEditMode(),
{
trigger: ".o-website-builder_sidebar .o_snippets_container .o_snippet",
},
{
content: "Drag and drop the Products snippet group inside the category area.",
trigger: ".o_block_tab:not(.o_we_ongoing_insertion) .o_snippet[name='Catalog'] .o_snippet_thumbnail",
run: "drag_and_drop :iframe #category_header",
},
{
content: "Click on the s_dynamic_snippet_products snippet.",
trigger: ':iframe .o_snippet_preview_wrap[data-snippet-id="s_dynamic_snippet_products"]',
run: "click",
},
{
trigger: ":iframe:not(:has(.o_loading_screen))",
},
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',
trigger: ':iframe #category_header .s_dynamic_snippet_products',
run: "click",
},
{
content: "Open category option dropdown",
trigger: 'we-select[data-attribute-name="productCategoryId"] we-toggler',
trigger: "button[id='product_category_opt']",
run: "click",
},
{
content: "Choose the option to use the current page's category",
trigger: 'we-button[data-select-data-attribute="current"]',
trigger: "div.o-dropdown-item:contains('Current Category or All')",
run: "click",
},
...wTourUtils.clickOnSave(),
...clickOnSave(),
]);
tour.register('category_page_and_products_snippet_use', {
test: true,
url: `/shop`,
}, [
registry.category("web_tour.tours").add('category_page_and_products_snippet_use', {
url: '/shop',
steps: () => [
{
content: "Navigate to category",
trigger: '.o_wsale_filmstip > li:contains("Test Category")',
trigger: '.o_wsale_filmstrip > li:contains("Test Category") > a',
run: "click",
expectUnloadPage: true,
},
{
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 () {
trigger: '#category_header .s_dynamic_snippet_products:has(.oe_product_image_link)',
run() {
// 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 productCategoryId = window.location.href.match('/shop/category/test-category-(\\d+)')[1];
const productGridEl = document.getElementById('o_wsale_products_grid');
const regex = new RegExp(`^/shop/test-category-${productCategoryId}/[\\w-/]+-(\\d+)$`);
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*)?$`);
const $shownProductLinks = this.anchor.querySelectorAll(".s_dynamic_snippet_products .oe_product_image_link");
const regex2 = new RegExp(`^/shop/[\\w-/]+-(\\d+)(?:#attribute_values=\\d*)?$`);
for (const shownProductLinkEl of $shownProductLinks) {
const productID = shownProductLinkEl.getAttribute('href').match(regex2)[1];
if (!allPageProductIDs.includes(productID)) {
@ -62,4 +80,4 @@ tour.register('category_page_and_products_snippet_use', {
}
},
},
]);
]});

View file

@ -0,0 +1,65 @@
import { registry } from '@web/core/registry';
import comboConfiguratorTourUtils from '@sale/js/tours/combo_configurator_tour_utils';
import productConfiguratorTourUtils from '@sale/js/tours/product_configurator_tour_utils';
import * as wsTourUtils from '@website_sale/js/tours/tour_utils';
registry
.category('web_tour.tours')
.add('website_sale_combo_configurator', {
url: '/shop?search=Combo product',
steps: () => [
...wsTourUtils.addToCart({ productName: "Combo product", search: false , expectUnloadPage: true}),
// Assert that the combo configurator behaves as expected.
comboConfiguratorTourUtils.assertFooterButtonsDisabled(),
comboConfiguratorTourUtils.setQuantity(3),
comboConfiguratorTourUtils.selectComboItem("Product A1"),
...productConfiguratorTourUtils.selectAndSetCustomAttribute(
"Product A1", "No variant attribute", "B", "Some custom value"
),
...productConfiguratorTourUtils.saveConfigurator(),
comboConfiguratorTourUtils.selectComboItem("Product B2"),
comboConfiguratorTourUtils.assertFooterButtonsEnabled(),
{
content: "Check that the tax disclaimer gets displayed",
trigger: '.js_main_product small:contains(Final price may vary based on selection)',
},
// Assert that the cart's content is correct.
{
content: "Proceed to checkout",
trigger: 'button:contains(Go to Checkout)',
run: 'click',
expectUnloadPage: true,
},
...wsTourUtils.assertCartContains({ productName: "Combo product" }),
...wsTourUtils.assertCartContains({ productName: "3 x Product A1" }),
...wsTourUtils.assertCartContains({ productName: "3 x Product B2" }),
{
content: "Verify the first combo item's attributes",
trigger: 'div.o_cart_product:contains("No variant attribute: B: Some custom value")',
},
{
content: "Verify the combo product's quantity",
trigger: 'div[name="website_sale_cart_line_quantity"] input.quantity:value(3)',
},
{
content: "Verify the combo product's price (tax included)",
trigger: 'h6[name=website_sale_cart_line_price]:contains(106.95)',
},
{
content: "Verify the order's total price",
trigger: 'tr[name="o_order_total_untaxed"]:contains(93.00)',
},
// Assert that the combo quantity can be updated in the cart.
{
content: "Edit the combo quantity",
trigger: 'div[name="website_sale_cart_line_quantity"] input.quantity',
run: "edit 2 && click body",
},
...wsTourUtils.assertCartContains({ productName: "2 x Product A1" }),
...wsTourUtils.assertCartContains({ productName: "2 x Product B2" }),
{
content: "Verify the combo product's price",
trigger: 'h6[name=website_sale_cart_line_price]:contains(71.31)',
},
],
});

View file

@ -0,0 +1,15 @@
import { registry } from '@web/core/registry';
import * as wsTourUtils from '@website_sale/js/tours/tour_utils';
registry
.category('web_tour.tours')
.add('website_sale_combo_configurator_single_configurable_item', {
url: '/shop?search=Combo product',
steps: () => [
...wsTourUtils.addToCart({ productName: "Combo product", search: false, expectUnloadPage: true }),
{
content: "Assert that the combo configurator is shown",
trigger: '.sale-combo-configurator-dialog',
},
],
});

View file

@ -0,0 +1,15 @@
import { registry } from '@web/core/registry';
import * as wsTourUtils from '@website_sale/js/tours/tour_utils';
registry
.category('web_tour.tours')
.add('website_sale_combo_configurator_single_configuration', {
url: '/shop?search=Combo product',
steps: () => [
...wsTourUtils.addToCart({ productName: "Combo product", search: false, expectUnloadPage: true }),
wsTourUtils.goToCart(),
// Assert that the combo configurator wasn't shown.
...wsTourUtils.assertCartContains({ productName: "Combo product" }),
...wsTourUtils.assertCartContains({ productName: "1 x Test product" }),
],
});

View file

@ -1,390 +1,518 @@
odoo.define('website_sale_tour.tour', function (require) {
'use strict';
import { rpc } from "@web/core/network/rpc";
import { registry } from "@web/core/registry";
import * as tourUtils from "@website_sale/js/tours/tour_utils";
import { pay } from "@website_sale/js/tours/tour_utils";
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,
registry.category("web_tour.tours").add('website_sale_tour_1', {
url: '/shop?search=Storage Box Test',
}, [
steps: () => [
// Testing b2c with Tax-Excluded Prices
{
content: "Open product page",
trigger: '.oe_product_cart a:contains("Storage Box Test")',
run: "click",
expectUnloadPage: true,
},
{
content: "Add one more storage box",
trigger: '.js_add_cart_json:eq(1)',
run: "click",
},
{
content: "Check b2b Tax-Excluded Prices",
trigger: '.product_price .oe_price .oe_currency_value:containsExact(79.00)',
run: function () {}, // it's a check
trigger: ".product_price .oe_price .oe_currency_value:text(79.00)",
},
{
content: "Click on add to cart",
trigger: '#add_to_cart',
run: "click",
},
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 for 2 products in cart",
trigger:
'#cart_products div:has(a>h6:contains("Storage Box Test")) input.js_quantity:value(2)',
},
...tourUtils.assertCartAmounts({
taxes: '23.70',
untaxed: '158.00',
total: '181.70',
}),
tourUtils.goToCheckout(),
{
content: "Fulfill delivery address form",
trigger: 'select[name="country_id"]',
run: "selectByLabel Afghanistan",
},
{
content: "Check Price b2b subtotal",
trigger: 'tr#order_total_untaxed .oe_currency_value:containsExact(158.00)',
run: function () {}, // it's a check
trigger: `input[name="name"]`,
run: "edit abcd",
},
{
content: "Check Price b2b Sale Tax(15%)",
trigger: 'tr#order_total_taxes .oe_currency_value:containsExact(23.70)',
run: function () {}, // it's a check
trigger: `input[name="phone"]`,
run: "edit 99999999",
},
{
content: "Check Price b2b Total amount",
trigger: 'tr#order_total .oe_currency_value:containsExact(181.70)',
run: function () {}, // it's a check
trigger: `input[name="email"]`,
run: "edit abc@odoo.com",
},
{
trigger: `input[name="street"]`,
run: "edit SO1 Delivery Street, 33",
},
{
trigger: `input[name="city"]`,
run: "edit SO1DeliveryCity",
},
{
trigger: `input[name="zip"]`,
run: "edit 10000",
},
{
content: "Click on Confirm button",
trigger: 'a[name="website_sale_main_button"]',
run: "click",
expectUnloadPage: true,
},
tourUtils.waitForInteractionToLoad(),
{
content: "Billing address is not same as delivery address",
trigger: '#use_delivery_as_billing',
run: "click",
},
{
content: "Add a billing address",
trigger: '#billing_address_list a[href^="/shop/address?address_type=billing"]:contains("Add address")',
run: "click",
expectUnloadPage: true,
},
{
trigger: 'h4:contains("New address")',
},
{
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);
},
run: "selectByLabel Afghanistan",
},
{
content: "Shipping address is not same as billing address",
trigger: '#shipping_use_same',
trigger: `input[name="name"]`,
run: "edit def",
},
{
content: "Click on next button",
trigger: '.oe_cart .btn:contains("Next")',
trigger: `input[name="phone"]`,
run: "edit 8888888888",
},
{
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);
},
trigger: `input[name="email"]`,
run: "edit abc@odoo.com",
},
{
content: "Click on next button",
trigger: '.oe_cart .btn:contains("Next")',
trigger: `input[name="street"]`,
run: "edit 17, SO1 Billing Road",
},
{
trigger: `input[name="city"]`,
run: "edit SO1BillingCity",
},
{
trigger: `input[name="zip"]`,
run: "edit 10000",
},
{
content: "Click on Confirm button to save the address",
trigger: 'a[name="website_sale_main_button"]',
run: "click",
expectUnloadPage: true,
},
{
content: "Check selected delivery address is same as typed in previous step",
trigger: '#delivery_address_list:contains(SO1 Delivery Street, 33):contains(SO1DeliveryCity):contains(Afghanistan)',
},
{
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',
trigger: '#billing_address_list:contains(17, SO1 Billing Road):contains(SO1BillingCity):contains(Afghanistan)',
},
{
content: "Click for edit billing address",
trigger: '.js_edit_address:first',
trigger: '#billing_address_list a[href^="/shop/address?address_type=billing"].js_edit_address:first',
run: "click",
expectUnloadPage: true,
},
{
trigger: 'h4:contains("Edit address")',
},
{
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")',
trigger: `input[name="name"]`,
run: "edit abcd",
},
{
content: "Confirm Address",
trigger: 'a.btn:contains("Confirm")',
trigger: `input[name="phone"]`,
run: "edit 11111111",
},
{
trigger: `input[name="street"]`,
run: "edit SO1 Billing Street Edited, 33",
},
{
trigger: `input[name="city"]`,
run: "edit SO1BillingCityEdited",
},
{
content: "Click on Confirm button to save the address",
trigger: 'a[name="website_sale_main_button"]',
run: "click",
expectUnloadPage: true,
},
tourUtils.confirmOrder(),
{
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)',
trigger: '#delivery_and_billing :contains(Billing):contains(SO1 Billing Street Edited, 33):contains(SO1BillingCityEdited):contains(Afghanistan)',
},
...tourUtils.payWithTransfer({
redirect: false,
expectUnloadPage: true,
waitFinalizeYourPayment: true,
}),
{
content: "Sign up",
trigger: '.oe_cart a:contains("Sign Up")',
run: "click",
expectUnloadPage: true,
},
{
trigger: `.oe_signup_form input[name="password"]`,
run: "edit 1admin@admin",
},
{
trigger: `.oe_signup_form input[name="confirm_password"]`,
run: "edit 1admin@admin",
},
{
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();
},
trigger: `.oe_signup_form button[type="submit"]`,
run: "click",
expectUnloadPage: true,
},
{
content: "See Quotations",
trigger: '.o_portal_docs a:contains("Quotations")',
trigger: '.o_portal_docs a:contains("Quotations to review")',
run: "click",
expectUnloadPage: true,
},
// Sign in as admin change config auth_signup -> b2b, sale_show_tax -> total and Logout
{
trigger: ".o_header_standard:not(.o_transitioning)",
},
{
content: "Open Dropdown for logout",
trigger: '#top_menu li.dropdown:visible a:contains("abcd")',
trigger: 'header#top li.dropdown:visible a:contains("abcd")',
run: "click",
},
{
content: "Logout",
trigger: '#o_logout:contains("Logout")',
run: "click",
expectUnloadPage: true,
},
{
content: "Sign in as admin",
trigger: 'header a[href="/web/login"]',
run: "click",
expectUnloadPage: true,
},
{
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();
trigger: `.oe_login_form input[name="login"]`,
run: "edit admin",
},
{
trigger: `.oe_login_form input[name="password"]`,
run: "edit admin",
},
{
trigger: `.oe_login_form input[name="redirect"]:not(:visible)`,
run(helpers) {
this.anchor.value = "/";
},
},
{
content: "Submit login",
trigger: `.oe_login_form button[type="submit"]`,
run: "click",
expectUnloadPage: true,
},
{
trigger: ".o_frontend_to_backend_nav", // Check if the user is connected
},
{
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',
var def1 = rpc(`/web/dataset/call_kw/res.config.settings/create`, {
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,
}],
kwargs: {},
});
var def2 = def1.then(function (resId) {
return rpc.query({
model: 'res.config.settings',
method: 'execute',
return rpc(`/web/dataset/call_kw/res.config.settings/execute`, {
model: "res.config.settings",
method: "execute",
args: [[resId]],
kwargs: {},
});
});
def2.then(function () {
window.location.href = '/web/session/logout?redirect=/shop?search=Storage Box Test';
});
},
expectUnloadPage: true,
},
// Testing b2b with Tax-Included Prices
{
content: "Open product page",
trigger: '.oe_product_cart a:contains("Storage Box Test")',
run: "click",
expectUnloadPage: true,
},
{
content: "Add one more Storage Box Test",
trigger: '.js_add_cart_json:eq(1)',
run: "click",
},
{
content: "Check b2c Tax-Included Prices",
trigger: '.product_price .oe_price .oe_currency_value:containsExact(90.85)',
run: function () {}, // it's a check
trigger: ".product_price .oe_price .oe_currency_value:text(90.85)",
},
{
content: "Click on add to cart",
trigger: '#add_to_cart',
run: "click",
},
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: "Check for 2 products in cart",
trigger:
'#cart_products div:has(a>h6:contains("Storage Box Test")) input.js_quantity:value(2)',
},
...tourUtils.assertCartAmounts({
taxes: "23.70",
untaxed: "158.00",
total: "181.70",
}),
{
content: "Proceed to checkout",
trigger: 'a[href*="/shop/checkout"]',
run: "click",
expectUnloadPage: true,
},
{
content: "Click on Sign in Button",
trigger: '.oe_cart a:contains(" Sign in")',
trigger: `.oe_cart a:contains(Sign in)`,
run: "click",
expectUnloadPage: true,
},
{
trigger: `.oe_login_form input[name="login"]`,
run: "edit abc@odoo.com",
},
{
trigger: `.oe_login_form input[name="password"]`,
run: "edit 1admin@admin",
},
{
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();
},
trigger: `.oe_login_form button[type="submit"]`,
run: "click",
expectUnloadPage: true,
},
{
content: "Add new shipping address",
trigger: '.one_kanban form[action^="/shop/address"] .btn',
content: "Add new delivery address",
trigger: '#delivery_address_list a[href^="/shop/address"]:contains("Add address")',
run: "click",
expectUnloadPage: true,
},
{
content: "Fulfill shipping address form",
content: "Fulfill delivery 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);
},
run: "selectByLabel Afghanistan",
},
{
content: "Click on next button",
trigger: '.oe_cart .btn:contains("Next")',
trigger: `input[name="name"]`,
run: "edit ghi",
},
{
trigger: `input[name="phone"]`,
run: "edit 7777777777",
},
{
trigger: `input[name="street"]`,
run: "edit SO2New Delivery Street, 5",
},
{
trigger: `input[name="city"]`,
run: "edit SO2NewDelivery",
},
{
trigger: `input[name="zip"]`,
run: "edit 1200",
},
{
trigger: `input[name="email"]`,
run: "edit ghi@odoo.com",
},
{
content: "Click on Confirm button to save the address",
trigger: 'a[name="website_sale_main_button"]',
run: "click",
expectUnloadPage: true,
},
tourUtils.confirmOrder(),
{
content: "Select `Wire Transfer` payment method",
trigger: '#payment_method label:contains("Wire Transfer")',
trigger: 'input[name="o_payment_radio"][data-payment-method-code="wire_transfer"]',
run: "click",
},
{
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)',
trigger: 'input[name="o_payment_radio"][data-payment-method-code="wire_transfer"]:checked',
},
...pay({ expectUnloadPage: true, waitFinalizeYourPayment: true }),
{
trigger: '.oe_cart [name="order_confirmation"]',
},
{
content: "Open Dropdown for See quotation",
extra_trigger: '.oe_cart .oe_website_sale_tx_status',
trigger: '#top_menu li.dropdown:visible a:contains("abc")',
trigger: 'header#top li.dropdown:visible a:contains("abc")',
run: "click",
},
{
trigger: "header#top li.dropdown .js_usermenu.show",
},
{
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)',
trigger: 'header#top .dropdown-menu a[href="/my/home"]:visible',
run: "click",
expectUnloadPage: true,
},
// enable extra step on website checkout and check extra step on checkout process
{
trigger: ".o_header_standard:not(.o_transitioning)",
},
{
content: "Open Dropdown for logout",
trigger: '#top_menu li.dropdown:visible a:contains("abc")',
trigger: 'header#top li.dropdown:visible a:contains("abc")',
run: "click",
},
{
content: "Logout",
trigger: '#o_logout:contains("Logout")',
run: "click",
expectUnloadPage: true,
},
{
content: "Sign in as admin",
trigger: 'header a[href="/web/login"]',
run: "click",
expectUnloadPage: true,
},
{
trigger: `.oe_login_form input[name="login"]`,
run: "edit admin",
},
{
trigger: `.oe_login_form input[name="password"]`,
run: "edit admin",
},
{
trigger: `.oe_login_form input[name="redirect"]:not(:visible)`,
run(helpers) {
this.anchor.value = "/shop/cart";
},
},
{
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();
},
}]);
trigger: `.oe_login_form button[type="submit"]`,
run: "click",
expectUnloadPage: true,
}]});
tour.register('website_sale_tour_2', {
test: true,
registry.category("web_tour.tours").add('website_sale_tour_2', {
url: '/shop/cart',
}, [
steps: () => [
{
trigger: '.o_wizard:contains("Extra Info")',
},
{
content: "Open Dropdown for logout",
extra_trigger: '.progress-wizard-step:contains("Extra Info")',
trigger: '#top_menu li.dropdown:visible a:contains("Mitchell Admin")',
trigger: 'header#top li.dropdown:visible a:contains("Mitchell Admin")',
run: "click",
},
{
content: "Logout",
trigger: '#o_logout:contains("Logout")',
run: "click",
expectUnloadPage: true,
},
{
content: "Sign in as abc",
trigger: 'header a[href="/web/login"]',
run: "click",
expectUnloadPage: true,
},
{
trigger: `.oe_login_form input[name="login"]`,
run: "edit abc@odoo.com",
},
{
trigger: `.oe_login_form input[name="password"]`,
run: "edit 1admin@admin",
},
{
trigger: `.oe_login_form input[name="redirect"]:not(:visible)`,
run(helpers) {
this.anchor.value = "/shop?search=Storage Box Test";
},
},
{
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();
},
trigger: `.oe_login_form button[type="submit"]`,
run: "click",
expectUnloadPage: true,
},
{
content: "Open product page",
trigger: '.oe_product_cart a:contains("Storage Box Test")',
run: "click",
expectUnloadPage: true,
},
{
content: "Click on add to cart",
trigger: '#add_to_cart',
run: "click",
},
tourUtils.goToCart(),
tourUtils.goToCheckout(),
{
content: "Proceed to checkout",
trigger: 'a[href*="/shop/checkout"]',
content: "Click on 'Confirm' button (redirect to the 'extra info' form)",
trigger: 'a[href^="/shop/extra_info"]',
run: "click",
expectUnloadPage: true,
},
{
content: "Click on next button",
trigger: '.oe_cart .btn:contains("Next")',
content: "Click on Confirm button to save the Extra Info form",
trigger: 'a[name="website_sale_main_button"]',
run: "click",
expectUnloadPage: true,
},
...tourUtils.payWithTransfer({ expectUnloadPage: true, waitFinalizeYourPayment: true }),
{
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',
}]);
});
content: "Check payment status confirmation window",
trigger: '[name="order_confirmation"][data-order-tracking-info]',
}]});

View file

@ -1,21 +1,22 @@
/** @odoo-module **/
import { clickOnSave, registerWebsitePreviewTour } from '@website/js/tours/tour_utils';
import wTourUtils from 'website.tour_utils';
wTourUtils.registerWebsitePreviewTour('website_sale_tour_backend', {
test: true,
registerWebsitePreviewTour('website_sale_tour_backend', {
url: '/shop/cart',
edition: true,
}, [
}, () => [
{
content: "open customize tab",
trigger: '.o_we_customize_snippet_btn',
trigger: "[data-name='customize']",
run: "click",
},
{
trigger: ".o_builder_sidebar_open .o_customize_tab",
},
{
content: "Enable Extra step",
extra_trigger: '#oe_snippets .o_we_customize_panel',
trigger: '[data-customize-website-views="website_sale.extra_info_option"] we-checkbox',
trigger: "[data-action-param='{\"views\":[\"website_sale.extra_info\"]}'] input[type='checkbox']",
run: "click",
},
...wTourUtils.clickOnSave(),
...clickOnSave(),
],
);

View file

@ -1,37 +1,30 @@
odoo.define('website_sale_tour.website_sale_fiscal_position_tour', function (require) {
'use strict';
import { registry } from "@web/core/registry";
var tour = require("web_tour.tour");
registry.category("web_tour.tours").add('website_sale_fiscal_position_portal_tour', {
url: '/shop?search=Super%20Product',
steps: () => [
{
content: "Check price",
trigger: ".oe_product:contains('Super product') .product_price:contains('80.00')",
},
]});
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
},
]);
});
registry.category("web_tour.tours").add('website_sale_fiscal_position_public_tour', {
url: '/shop?search=Super%20Product',
steps: () => [
{
content: "Toggle Pricelist",
trigger: ".o_pricelist_dropdown > .dropdown-toggle",
run: 'click',
},
{
content: "Change Pricelist",
trigger: ".dropdown-item:contains('EUROPE EUR')",
run: 'click',
expectUnloadPage: true,
},
{
content: "Check price",
trigger: ".oe_product:contains('Super product') .product_price:contains('92.00')",
},
]});

View file

@ -0,0 +1,38 @@
import { registry } from '@web/core/registry';
function check_price(price, currency) {
return [
{
content: 'Check price',
trigger: `span.oe_price:contains("${price}")`
},
{
content: 'Check currency',
trigger: `span.oe_price:contains("${currency}")`
},
]
}
registry.category('web_tour.tours').add('website_sale_gmc_check_advertised_prices_red_sofa_default', {
steps: () => check_price('1,000.0', '$')
});
registry.category('web_tour.tours').add('website_sale_gmc_check_advertised_prices_blue_sofa_default', {
steps: () => check_price('1,200.0', '$')
});
registry.category('web_tour.tours').add('website_sale_gmc_check_advertised_prices_red_sofa_christmas', {
steps: () => check_price('990.0', '€') // 1000.0 * 1.1 (EUR rate) - 10% discount
});
registry.category('web_tour.tours').add('website_sale_gmc_check_advertised_prices_blue_sofa_christmas', {
steps: () => check_price('1,188.0', '€') // 1200.0 * 1.1 (EUR rate) - 10% discount
});
registry.category('web_tour.tours').add('website_sale_gmc_check_advertised_prices_red_sofa_tax_included', {
steps: () => check_price('1,150.0', '$') // 1000.0 + 15% tax
});
registry.category('web_tour.tours').add('website_sale_gmc_check_advertised_prices_blue_sofa_tax_included', {
steps: () => check_price('1,380.0', '$') // 1200.0 + 15% tax
});

View file

@ -1,74 +1,77 @@
odoo.define('website_sale.google_analytics', function (require) {
'use strict';
import { registry } from "@web/core/registry";
import { patch } from "@web/core/utils/patch";
import * as tourUtils from "@website_sale/js/tours/tour_utils";
const tour = require("web_tour.tour");
const websiteSaleTracking = require('website_sale.tracking');
/**
* Patch tracking to avoid third party calls during tests.
*/
function patchTracking() {
const { Tracking } = odoo.loader.modules.get('@website_sale/interactions/tracking');
patch(Tracking.prototype, {
// Don't call super to avoid third party calls (GA).
onViewItem(event) {
const productTrackingInfo = event.detail;
document.body.setAttribute("view-event-id", productTrackingInfo.item_id);
},
onAddToCart(event) {
const productsTrackingInfo = event.detail;
document.body.setAttribute("cart-event-id", productsTrackingInfo[0].item_id);
},
});
}
if (odoo.loader.modules.has('@website_sale/interactions/tracking')) {
patchTracking();
} else {
odoo.loader.bus.addEventListener('module-started', (e) => {
if (e.detail.moduleName === '@website_sale/interactions/tracking') patchTracking();
});
}
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,
registry.category("web_tour.tours").add('google_analytics_view_item', {
url: '/shop?search=Colored T-Shirt',
},
[
steps: () => [
{
content: "select Colored T-Shirt",
trigger: '.oe_product_cart a:contains("Colored T-Shirt")',
run: "click",
expectUnloadPage: true,
},
{
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');
itemId = document.body.getAttribute("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',
trigger:
"ul.js_add_cart_variants ul.d-flex li:has(label.active) + li:has(label) input:not(:visible)",
run: "click",
},
{
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}]`,
trigger: `body[view-event-id]:not([view-event-id="${itemId}"])`,
timeout: 25000,
run: () => {}, // it's a check
},
]);
]});
tour.register('google_analytics_add_to_cart', {
test: true,
registry.category("web_tour.tours").add('google_analytics_add_to_cart', {
url: '/shop?search=Basic Shirt',
},
[
steps: () => [
...tourUtils.addToCart({productName: 'Basic Shirt', search: false, expectUnloadPage: true}),
{
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',
trigger: "body[cart-event-id]",
},
{
content: 'check add to cart event',
extra_trigger: 'body[cart-event-id]',
trigger: 'a:has(.my_cart_quantity:containsExact(1))',
trigger: "a:has(.my_cart_quantity:text(1))",
timeout: 25000,
run: () => {}, // it's a check
},
]);
});
]});

View file

@ -0,0 +1,19 @@
import configuratorTourUtils from "@sale/js/tours/product_configurator_tour_utils";
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add('website_sale_product_configurator_optional_products_tour', {
steps: () => [
{
trigger: 'ul.js_add_cart_variants span:contains("Aluminium") ~ span.small:contains("50.40")',
},
{
content: 'Click Aluminium Option',
trigger: 'ul.js_add_cart_variants span:contains("Aluminium")',
run: "click",
}, {
content: 'Add to cart',
trigger: '#add_to_cart',
run: "click",
},
configuratorTourUtils.assertPriceTotal("800.40"),
]});

View file

@ -0,0 +1,19 @@
import { registry } from '@web/core/registry';
import configuratorTourUtils from '@sale/js/tours/product_configurator_tour_utils';
import websiteConfiguratorTourUtils from '@website_sale/js/tours/product_configurator_tour_utils';
import * as wsTourUtils from '@website_sale/js/tours/tour_utils';
registry
.category('web_tour.tours')
.add('website_sale_product_configurator_strikethrough_price', {
url: '/shop?search=Main product',
steps: () => [
...wsTourUtils.addToCart({ productName: "Main product", search: false, expectUnloadPage: true }),
configuratorTourUtils.assertProductPrice("Main product", '55.00'),
websiteConfiguratorTourUtils.assertProductStrikethroughPrice("Main product", '110.00'),
configuratorTourUtils.assertOptionalProductPrice("Optional product", '5.50'),
websiteConfiguratorTourUtils.assertOptionalProductStrikethroughPrice(
"Optional product", '10.00'
),
],
});

View file

@ -0,0 +1,25 @@
import { registry } from '@web/core/registry';
import configuratorTourUtils from '@sale/js/tours/product_configurator_tour_utils';
import websiteConfiguratorTourUtils from '@website_sale/js/tours/product_configurator_tour_utils';
import * as wsTourUtils from '@website_sale/js/tours/tour_utils';
registry
.category('web_tour.tours')
.add('website_sale_product_configurator_zero_priced', {
url: '/shop?search=Main product',
steps: () => [
...wsTourUtils.addToCart({ productName: "Main product", search: false, expectUnloadPage: true }),
// Assert that the "Zero-priced" variant of the optional product can't be sold.
...websiteConfiguratorTourUtils.assertOptionalProductZeroPriced(
"Optional product (Zero-priced)"
),
// Add the "Zero-priced" variant by selecting the "Nonzero-priced" variant, adding it,
// and selecting the "Zero-priced" variant again.
configuratorTourUtils.selectAttribute("Optional product", "Price", "Nonzero-priced"),
configuratorTourUtils.addOptionalProduct("Optional product (Nonzero-priced)"),
configuratorTourUtils.selectAttribute("Optional product", "Price", "Zero-priced"),
// Assert that the "Zero-priced" variant of the optional product still can't be sold.
...websiteConfiguratorTourUtils.assertProductZeroPriced("Optional product (Zero-priced)"),
configuratorTourUtils.assertFooterButtonsDisabled(),
],
});

View file

@ -0,0 +1,19 @@
import { registry } from '@web/core/registry';
registry.category('web_tour.tours').add('website_sale_product_pricelist_qty_change', {
steps: () => [
{
content: "Price should be $20",
trigger: '.product_price:contains(20.0)',
},
{
content: "Change quantity to 5",
trigger: 'input.quantity',
run: 'edit 5 && click body',
},
{
content: "Price should now be $10",
trigger: '.product_price:contains(10.0)',
},
],
});

View file

@ -0,0 +1,76 @@
/** @odoo-module **/
import { registerWebsitePreviewTour } from '@website/js/tours/tour_utils';
registerWebsitePreviewTour(
'product_unpublished_without_category',
{
url: '/',
},
() => [
{
trigger:'body:not(:has(.o_new_content_menu_choices)) .o_new_content_container > button',
run: 'click',
},
{
trigger: 'button[data-module-xml-id="base.module_website_sale"]',
run: 'click',
},
{
trigger: '.modal-dialog .o_field_widget[name="name"] input',
run: 'edit Product Without Category',
},
{
trigger: '.modal-footer button.btn-primary',
run: 'click',
},
{
trigger: 'body:not(:has(.modal))',
},
{
trigger: ':iframe body:has(h1:contains("Product Without Category"))',
},
]
);
registerWebsitePreviewTour(
'product_published_with_category',
{
url: '/',
},
() => [
{
trigger:'body:not(:has(.o_new_content_menu_choices)) .o_new_content_container > button',
run: 'click',
},
{
trigger: 'button[data-module-xml-id="base.module_website_sale"]',
run: 'click',
},
{
trigger: '.modal-dialog .o_field_widget[name="name"] input',
run: 'edit Product With Category',
},
{
trigger: '.modal-dialog .o_field_widget[name="public_categ_ids"] input',
run: 'edit Test',
},
{
trigger: '.ui-autocomplete a:contains("Test Category")',
run: 'click',
},
{
trigger: '.modal-dialog .o_field_widget[name="public_categ_ids"] .badge:contains("Test Category")',
},
{
trigger: '.modal-footer button.btn-primary',
run: 'click',
},
{
trigger: 'body:not(:has(.modal))',
},
{
trigger: ':iframe body:has(h1:contains("Product With Category"))',
},
]
);

View file

@ -0,0 +1,54 @@
import { registry } from "@web/core/registry";
registry
.category('web_tour.tours')
.add('website_sale_product_reviews_reactions_public', {
url: '/shop?search=Storage Box Test',
steps: () => [
{
trigger: '.oe_product_cart a:contains("Storage Box Test")',
run: "click",
expectUnloadPage: true,
},
{
trigger: '.o_product_page_reviews_title',
run: "click",
},
{
trigger: "#chatterRoot:shadow .o-mail-Message-textContent:contains(Bad box!)",
run: "hover && click",
},
{
trigger: "#chatterRoot:shadow .o-mail-Message-actions",
run: async () => {
const addReactionButton = document.querySelector('#chatterRoot').shadowRoot.querySelector("[title='Add a Reaction']")
if (addReactionButton) {
throw new Error("Non-authenticated user should not be able to add a reaction to a message");
}
},
},
{
trigger: "#chatterRoot:shadow .o-mail-Message-core",
run: () => {
const reactionButton = document.querySelector("#chatterRoot").shadowRoot.querySelector(".o-mail-MessageReaction")
reactionButton.dispatchEvent(new Event("mouseenter"));
},
},
{
trigger: "#chatterRoot:shadow .o-mail-MessageReactionList-preview",
run: "click",
},
{
trigger: "#chatterRoot:shadow .o-mail-MessageReactionMenu",
},
{
trigger: "#chatterRoot:shadow .o-mail-Message-core",
run: () => {
const addReaction = document.querySelector("#chatterRoot").shadowRoot.querySelector(".o-mail-MessageReactions-add")
if (addReaction) {
throw new Error("Non-authenticated user should not be able to add a reaction to a message");
}
},
},
],
});

View file

@ -1,69 +1,76 @@
/** @odoo-module **/
import wTourUtils from "website.tour_utils";
import { stepUtils } from "@web_tour/tour_utils";
import {
clickOnEditAndWaitEditMode,
clickOnSave,
registerWebsitePreviewTour,
} from '@website/js/tours/tour_utils';
const clickOnImgAndWaitForLoad = [
{
content: "Click on the product image",
trigger: "iframe #o-carousel-product img[alt='Test Remove Image']",
trigger: ":iframe #o-carousel-product img[alt='Test Remove Image']",
run: "click",
},
{
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,
trigger: ".o_customize_tab [data-container-title='Image']",
},
];
const enterEditModeOfTestProduct = [
const enterEditModeOfTestProduct = () => [
stepUtils.waitIframeIsReady(),
{
content: "Click on the product anchor",
trigger: "iframe a:contains('Test Remove Image')",
trigger: ":iframe a:contains('Test Remove Image')",
run: "click",
},
...wTourUtils.clickOnEditAndWaitEditMode(),
{
content: "Check that the product page is loaded",
trigger: ":iframe .o_wsale_product_page",
},
...clickOnEditAndWaitEditMode(),
];
const removeImg = [
{
content: "Click on Remove",
trigger: "we-customizeblock-options:has(we-title:contains('Image')) we-button[data-name='media_wsale_remove']",
trigger: ".o_customize_tab [data-container-title='Image'] button[data-action-id='removeMedia']",
run: "click",
},
// 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,
trigger: ".o_customize_tab:not(:has([data-container-title='Image']))",
},
];
wTourUtils.registerWebsitePreviewTour("add_and_remove_main_product_image_no_variant", {
registerWebsitePreviewTour("add_and_remove_main_product_image_no_variant", {
url: "/shop?search=Test Remove Image",
test: true,
}, [
...enterEditModeOfTestProduct,
}, () => [
...enterEditModeOfTestProduct(),
{
content: "Double click on the product image",
trigger: "iframe #o-carousel-product img[alt='Test Remove 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']",
trigger: ".o_select_media_dialog .o_existing_attachment_cell .o_button_area",
run: "click",
},
{
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,
trigger: ".o_customize_tab [data-container-title='Image']",
},
...removeImg,
]);
wTourUtils.registerWebsitePreviewTour("remove_main_product_image_with_variant", {
registerWebsitePreviewTour("remove_main_product_image_with_variant", {
url: "/shop?search=Test Remove Image",
test: true,
}, [
...enterEditModeOfTestProduct,
}, () => [
...enterEditModeOfTestProduct(),
...clickOnImgAndWaitForLoad,
...wTourUtils.clickOnSave(),
...wTourUtils.clickOnEditAndWaitEditMode(),
...clickOnSave(),
...clickOnEditAndWaitEditMode(),
...clickOnImgAndWaitForLoad,
...removeImg,
]);

View file

@ -1,68 +1,27 @@
/** @odoo-module **/
import { registry } from "@web/core/registry";
import { assertCartContains } from '@website_sale/js/tours/tour_utils';
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,
registry.category("web_tour.tours").add('website_sale_reorder_from_portal', {
url: '/my/orders',
},
[
// Initial reorder, nothing in cart
steps: () => [
{
content: 'Select first order',
trigger: '.o_portal_my_doc_table a:first',
run: "click",
expectUnloadPage: true,
},
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: 'Reorder Again',
trigger: '.o_wsale_reorder_button',
run: "click",
expectUnloadPage: true,
},
...assertCartContains({productName: 'Reorder Product 1'}),
...assertCartContains({productName: 'Reorder Product 2'}),
{
content: "Check that quantity is 1",
trigger: ".js_quantity[value='1']",
run: "edit Test",
},
]
);
});

View file

@ -1,43 +1,52 @@
/** @odoo-modules */
import { stepUtils } from "@web_tour/tour_utils";
import { registerWebsitePreviewTour } from '@website/js/tours/tour_utils';
import wTourUtils from 'website.tour_utils';
wTourUtils.registerWebsitePreviewTour('website_sale_restricted_editor_ui', {
test: true,
registerWebsitePreviewTour('website_sale_restricted_editor_ui', {
url: `/shop`,
}, [
}, () => [
{
content: "Open the site menu to check what is inside",
trigger: '[data-menu-xmlid="website.menu_site"]',
run: "click",
},
{
// 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"]))',
run: "click",
},
{
// Wait for the possibility to edit to appear
trigger: ".o_menu_systray button:contains('Edit')",
},
{
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',
trigger: '.o_menu_systray:not(:has(.form-switch)):not(:has(.o_website_edit_in_backend))',
run: "click",
},
stepUtils.waitIframeIsReady(),
{
content: "Navigate to the first product",
trigger: 'iframe .oe_product_image_link',
trigger: ':iframe .oe_product_image_link',
run: "click",
},
{
content: "Click on publish/unpublish",
trigger: '.o_menu_systray_item .o_switch_danger_success:has(input:checked)',
trigger: '.o_website_publish_container a:has(input:checked)',
run: "click",
},
{
trigger:
".o_menu_systray_item:not([data-processing]) .form-switch:has(input:not(: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))',
run: "click",
},
{
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: () => {},
trigger: '.o-form-buttonbox [name="is_published"] .fa-globe.text-danger',
},
]);

View file

@ -1,8 +1,7 @@
/** @odoo-module **/
import tour from 'web_tour.tour';
import { registry } from "@web/core/registry";
function fail(errorMessage) {
const tour = registry.get("tourManager");
tour._consume_tour(tour.running_tour, errorMessage);
}
@ -12,61 +11,55 @@ function assert(current, expected, info) {
}
}
tour.register('tour_shop_archived_variant_multi', {
test: true,
registry.category("web_tour.tours").add('tour_shop_archived_variant_multi', {
url: '/shop?search=Test Product 2',
},
[
steps: () => [
{
content: "select Test Product",
trigger: '.oe_product_cart a:containsExact("Test Product 2")',
trigger: ".oe_product_cart a:text(Test Product 2)",
run: "click",
expectUnloadPage: true,
},
{
content: 'click on the first variant',
trigger: 'input[data-attribute_name="Size"][data-value_name="Small"]',
trigger: 'input[data-attribute-name="Size"][data-value-name="Small"]',
run: "click",
},
{
content: "click on the second variant",
trigger: 'input[data-attribute_name="Color"][data-value_name="Black"]',
trigger: 'input[data-attribute-name="Color"][data-value-name="Black"]',
run: "click",
},
{
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 that brand b is not available (but clickable)",
trigger: '.css_not_available input.css_not_available:not([disabled])',
},
{
content: "check combination is not possible",
trigger: '.js_main_product.css_not_available .css_not_available_msg:contains("This combination does not exist.")'
content: "change second variant to make brand b available",
trigger: 'input[data-attribute-name="Color"][data-value-name="White"]',
run: "click",
},
{
content: "check add to cart not possible",
trigger: '#add_to_cart.disabled',
run: function () {},
content: "check if brand b is available again",
trigger: 'input[data-value-name="Brand B"]:not(:has(.css_not_available))',
run: "click",
},
{
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,
registry.category("web_tour.tours").add('test_09_pills_variant', {
url: '/shop?search=Test Product 2',
},
[
steps: () => [
{
content: "select Test Product",
trigger: '.oe_product_cart a:containsExact("Test Product 2")',
trigger: ".oe_product_cart a:text(Test Product 2)",
run: "click",
expectUnloadPage: true,
},
{
content: "check there are two radio boxes, both hidden",
trigger: '.js_main_product',
run: function() {
var buttons = $('input.js_variant_change');
var buttons = [...document.querySelectorAll('input.js_variant_change')];
function isVisuallyHidden(elem) {
const style = window.getComputedStyle(elem);
@ -85,14 +78,15 @@ tour.register('test_09_pills_variant', {
{
content: "click on the second variant label",
trigger: 'label:contains("Small")',
run: "click",
},
{
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"]');
var button = [...document.querySelectorAll('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

@ -1,87 +1,109 @@
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');
import { browser } from "@web/core/browser/browser";
import { registry } from "@web/core/registry";
import * as tourUtils from "@website_sale/js/tours/tour_utils";
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',
},
registry.category("web_tour.tours").add('shop_cart_recovery', {
url: '/shop',
steps: () => [
...tourUtils.addToCart({ productName: "Acoustic Bloc Screens", expectUnloadPage: true }),
tourUtils.goToCart(),
{
content: "check product is in cart, get cart id, logout, go to login",
trigger: 'td.td-product_name:contains("Acoustic Bloc Screens")',
trigger: 'div:has(a>h6:contains("Acoustic Bloc Screens"))',
run: function () {
var orderId = $('.my_cart_quantity').data('order-id');
localStorage.setItem(orderIdKey, orderId);
const orderId = document.querySelector(".my_cart_quantity").dataset["orderId"];
browser.localStorage.setItem(orderIdKey, orderId);
window.location.href = "/web/session/logout?redirect=/web/login";
},
expectUnloadPage: true,
},
{
content: "edit login input",
trigger: '.oe_login_form input[name="login"]',
run: "edit admin",
},
{
content: "edit password input",
trigger: '.oe_login_form input[name="password"]',
run: "edit admin",
},
{
content: "edit hidden redirect input",
trigger: '.oe_login_form input[name="redirect"]:hidden',
run() {
const orderId = browser.localStorage.getItem(orderIdKey);
const url = "/odoo/action-sale.action_orders/" + orderId;
this.anchor.value = url;
}
},
{
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();
},
trigger: ".oe_login_form .oe_login_buttons button:contains(log in)",
run: "click",
expectUnloadPage: true,
},
{
content: "click action",
trigger: '.dropdown-toggle:contains("Action")',
trigger: '.o_cp_action_menus .dropdown-toggle',
run: "click",
},
{
content: "click Send a Cart Recovery Email",
trigger: 'span:containsExact("Send a Cart Recovery Email")',
content: "click Send an Email",
trigger: "span:text(Send an email)",
run: "click",
},
{
content: "Wait the modal is opened and form is fullfilled",
trigger: ".modal main .o_form_view_container [name=subject] input:value(/^S0/)",
},
{
content: "select template",
trigger: ".mail-composer-template-dropdown-btn",
run: "click",
},
{
content: 'Select the "Ecommerce: Cart Recovery" template from the list.',
trigger: '.mail-composer-template-dropdown.popover .o-dropdown-item:contains("Ecommerce: Cart Recovery")',
run: 'click'
},
{
content: "click Send email",
trigger: '.btn[name="action_send_mail"]',
trigger: '.btn.o_mail_send',
run: "click",
},
{
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);
trigger: ".o-mail-Message-body a:text(Resume order)",
run({ queryOne }) {
var link = queryOne('.o-mail-Message-body a:contains("Resume order")').getAttribute('href');
browser.localStorage.setItem(recoveryLinkKey, link);
window.location.href = "/web/session/logout?redirect=/";
}
},
expectUnloadPage: true,
},
{
content: "go to the recovery link",
trigger: 'a[href="/web/login"]',
run: function () {
const localStorage = browser.localStorage;
window.location.href = localStorage.getItem(recoveryLinkKey);
},
expectUnloadPage: true,
},
{
trigger: 'p:contains("This is your current cart")',
},
{
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")',
run: "click",
expectUnloadPage: true,
},
{
content: "check product is in restored cart",
trigger: 'td.td-product_name:contains("Acoustic Bloc Screens")',
run: function () {},
trigger: 'div>a>h6:contains("Acoustic Bloc Screens")',
},
]);
});
]});

View file

@ -1,13 +1,9 @@
/** @odoo-module **/
import { registry } from "@web/core/registry";
import * as tourUtils from '@website_sale/js/tours/tour_utils';
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'
},
[
registry.category("web_tour.tours").add('compare_list_price_price_list_display', {
url: '/shop?search=test_product',
steps: () => [
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"),
@ -15,15 +11,6 @@ tour.register('compare_list_price_price_list_display', {
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"),
@ -31,7 +18,7 @@ tour.register('compare_list_price_price_list_display', {
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.assertProductPrice("base_price", "4,000", "test_product_with_pricelist_and_compare_list_price"),
...tourUtils.selectPriceList('pricelist_without_discount'),
@ -41,7 +28,7 @@ tour.register('compare_list_price_price_list_display', {
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"),
tourUtils.assertProductPrice("base_price", "4,000", "test_product_with_pricelist_and_compare_list_price"),
]
);
});

View file

@ -1,31 +1,35 @@
odoo.define("website_sale.tour_shop_custom_attribute_value", function (require) {
"use strict";
import { registry } from "@web/core/registry";
var tour = require("web_tour.tour");
const tourUtils = require('website_sale.tour_utils');
tour.register("shop_custom_attribute_value", {
registry.category("web_tour.tours").add("shop_custom_attribute_value", {
url: "/shop?search=Customizable Desk",
test: true,
}, [{
steps: () => [{
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",
expectUnloadPage: true,
},
{
trigger: "li.js_attribute_value",
},
{
trigger: 'li.js_attribute_value span:contains(Custom)',
run: 'click',
}, {
trigger: 'input.variant_custom_value',
run: 'text Wood',
run: "edit Wood",
}, {
id: 'add_cart_step',
trigger: 'a:contains(ADD TO CART)',
trigger: 'a:contains(Add to cart)',
run: 'click',
},
tourUtils.goToCart(),
{
trigger: 'span:contains(Custom TEST: Wood)',
extra_trigger: '#cart_products',
run: function (){}, // check
}]);
});
trigger: 'button:contains(Go to Checkout)',
run: 'click',
expectUnloadPage: true,
},
{
trigger: "#cart_products",
},
{
trigger: 'span:contains(Custom: Wood)',
}]});

View file

@ -0,0 +1,55 @@
import configuratorTourUtils from "@sale/js/tours/product_configurator_tour_utils";
import { registry } from "@web/core/registry";
import * as tourUtils from '@website_sale/js/tours/tour_utils';
let optionVariantImage;
registry.category("web_tour.tours").add("a_shop_custom_attribute_value", {
url: "/shop?search=Customizable Desk",
steps: () => [{
content: "click on Customizable Desk",
trigger: '.oe_product_cart a:contains("Customizable Desk (TEST)")',
run: "click",
expectUnloadPage: true,
}, {
trigger: 'a.js_add_cart_json:has(i.oi-plus)',
run: 'click',
}, {
trigger: 'span.oe_currency_value:contains(750)',
}, {
id: 'add_cart_step',
trigger: 'a:contains(Add to cart)',
run: 'click',
}, {
trigger: configuratorTourUtils.optionalProductSelector("Conference Chair (TEST) (Steel)"),
run({ queryOne }) {
optionVariantImage =
configuratorTourUtils.optionalProductImageSrc(queryOne, "Conference Chair (TEST) (Steel)")
}
},
configuratorTourUtils.selectAttribute("Conference Chair", "Legs", "Aluminium"),
{
trigger: configuratorTourUtils.optionalProductSelector("Conference Chair (TEST) (Aluminium)"),
run({ queryOne }) {
const newOptionVariantImage =
configuratorTourUtils.optionalProductImageSrc(queryOne, "Conference Chair (TEST) (Aluminium)")
if (newOptionVariantImage === optionVariantImage) {
console.error("The variant image wasn't updated");
}
}
},
configuratorTourUtils.assertOptionalProductPrice("Conference Chair", "22.90"),
configuratorTourUtils.selectAttribute("Conference Chair", "Legs", "Steel"),
configuratorTourUtils.addOptionalProduct("Conference Chair"),
configuratorTourUtils.addOptionalProduct("Chair floor protection"),
configuratorTourUtils.assertPriceTotal("1,228.50"),
{
trigger: 'button:contains(Go to Checkout)',
run: 'click',
expectUnloadPage: true,
},
...tourUtils.assertCartContains({
productName: "Customizable Desk (TEST)",
backend: false,
}),
]});

View file

@ -1,150 +0,0 @@
/** @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

@ -1,54 +1,47 @@
odoo.define('website_sale.tour_shop_deleted_archived_variants', function (require) {
'use strict';
var tour = require('web_tour.tour');
import { registry } from "@web/core/registry";
// This tour relies on a data created from the python test.
tour.register('tour_shop_deleted_archived_variants', {
test: true,
registry.category("web_tour.tours").add('tour_shop_deleted_archived_variants', {
url: '/shop?search=Test Product 2',
},
[
steps: () => [
{
content: "check price on /shop (template price)",
trigger: '.oe_product_cart .oe_currency_value:contains("1.00")',
run: "click",
},
{
content: "select Test Product 2",
trigger: '.oe_product_cart a:containsExact("Test Product 2")',
trigger: ".oe_product_cart a:text(Test Product 2)",
run: "click",
expectUnloadPage: true,
},
{
content: "check price (3rd variant)",
trigger: '.oe_currency_value:contains("31.00")'
trigger: '.oe_currency_value:contains("31.00")',
run: "click",
},
{
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.")'
trigger: 'input[data-attribute-name="My Attribute"][data-value-name="My Value 2"]',
run: "click",
},
{
content: "click on the 3rd variant to reset the warning",
trigger: 'input[data-attribute_name="My Attribute"][data-value_name="My Value 3"]',
trigger: 'input[data-attribute-name="My Attribute"][data-value-name="My Value 3"]',
run: "click",
},
{
content: "check price (3rd variant)",
trigger: '.oe_currency_value:contains("31.00")'
trigger: '.oe_currency_value:contains("31.00")',
run: "click",
},
{
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.")'
trigger: 'input[data-attribute-name="My Attribute"][data-value-name="My Value 1"]',
run: "click",
},
{
content: "check add to cart not possible",
trigger: '#add_to_cart.disabled',
run: function () {},
}
]);
});
]});

View file

@ -1,37 +1,36 @@
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');
import { registry } from "@web/core/registry";
import * as tourUtils from "@website_sale/js/tours/tour_utils";
// This tour relies on a data created from the python test.
tour.register('tour_shop_dynamic_variants', {
test: true,
registry.category("web_tour.tours").add('tour_shop_dynamic_variants', {
url: '/shop?search=Dynamic Product',
},
[
steps: () => [
{
content: "select Dynamic Product",
trigger: '.oe_product_cart a:containsExact("Dynamic Product")',
trigger: ".oe_product_cart a:text(Dynamic Product)",
run: "click",
expectUnloadPage: true,
},
{
content: "click on the second variant",
trigger: 'input[data-attribute_name="Dynamic Attribute"][data-value_name="Dynamic Value 2"]',
trigger: 'input[data-attribute-name="Dynamic Attribute"][data-value-name="Dynamic Value 2"]',
run: "click",
},
{
content: "wait for variant to be loaded",
trigger: '.oe_price .oe_currency_value:contains("0.00")',
run: function () {},
},
{
trigger: 'body:has(input[type="hidden"][name="product_id"][value="0"])',
},
{
content: "click add to cart",
extra_trigger: 'body:has(input[type="hidden"][name="product_id"][value=0])',
trigger: '#add_to_cart',
run: "click",
},
tourUtils.goToCart(),
{
content: "check the variant is in the cart",
trigger: 'td.td-product_name:contains(Dynamic Product (Dynamic Value 2))',
},
]);
});
tourUtils.goToCart(),
...tourUtils.assertCartContains({
productName: 'Dynamic Product',
combinationName: 'Dynamic Value 2',
}),
]});

View file

@ -1,41 +1,98 @@
/** @odoo-module **/
import {
clickOnEditAndWaitEditMode,
clickOnSave,
registerWebsitePreviewTour,
} from '@website/js/tours/tour_utils';
import wTourUtils from "website.tour_utils";
wTourUtils.registerWebsitePreviewTour("shop_editor", {
test: true,
registerWebsitePreviewTour("shop_editor", {
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]",
trigger: ":iframe div.o_pricelist_dropdown a[data-bs-toggle=dropdown]",
run: "click",
},
{
trigger: ":iframe div.o_pricelist_dropdown a[data-bs-toggle=dropdown][aria-expanded=true]",
},
{
trigger: ":iframe input[name=search]",
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]",
run: "click",
},
{
trigger: ":iframe div.o_pricelist_dropdown a[data-bs-toggle=dropdown][aria-expanded=false]",
},
{
trigger: ":iframe div.o_pricelist_dropdown a[data-bs-toggle=dropdown]",
content: "Click on the pricelist again.",
run: "click",
}, {
trigger: ":iframe div.o_pricelist_dropdown a[data-bs-toggle=dropdown][aria-expanded=true]",
content: "Check pricelist dropdown opened",
}]);
wTourUtils.registerWebsitePreviewTour("shop_editor_set_product_ribbon", {
test: true,
registerWebsitePreviewTour("shop_editor_set_product_ribbon", {
url: "/shop",
edition: true,
}, [{
}, () => [{
content: "Click on first product",
trigger: "iframe .oe_product:first",
trigger: ":iframe .oe_product:first",
run: "click",
}, {
content: "Open the ribbon selector",
trigger: ".o_wsale_ribbon_select we-toggler",
trigger: ".o_wsale_ribbon_select + button:contains('None')",
run: "click",
}, {
content: "Select a ribbon",
trigger: '.o_wsale_ribbon_select we-button:contains("Sale")',
trigger: ".o_popover div.o-dropdown-item:contains('Sale')",
run: "click",
},
...wTourUtils.clickOnSave(),
...clickOnSave(),
{
content: "Check that the ribbon was properly saved",
trigger: 'iframe .oe_product:first .o_ribbon:contains("Sale")',
run: () => null,
trigger: ':iframe .oe_product:first .o_ribbons:contains("Sale")',
}]);
registerWebsitePreviewTour("shop_editor_no_alternative_products_visibility_tour", {
url: "/shop",
edition: false,
}, () => [
{
content: "Select the product with alternative products",
trigger: ':iframe .oe_product_cart[aria-label="product_with_alternative"] a',
run: "click",
},
{
content: "Ensure product page is loaded before clicking on Edit",
trigger: ':iframe #product_details',
},
...clickOnEditAndWaitEditMode(),
{
trigger: ':iframe .s_dynamic_snippet_title h4',
run: "click",
},
{
content: "Edit the alternative products section header",
trigger: `:iframe .container[contenteditable="true"] h4`,
run: function () {
this.anchor.textContent = "Edited Alternative"
this.anchor.dispatchEvent(new Event("input", { bubbles: true }));
},
},
...clickOnSave(),
{
content: "Navigate back to shop page",
trigger: ':iframe .breadcrumb-item a',
run: "click",
},
{
content: "Select the product without alternative products",
trigger: ':iframe .oe_product_cart[aria-label="product_without_alternative"] a',
run: "click",
},
{
content: "Ensure alternative products section is hidden",
trigger: ':iframe .s_dynamic_snippet_products:not(:visible)',
}
]);

View file

@ -0,0 +1,33 @@
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add("shop_attribute_filters_remain_when_changing_page", {
url: "/shop",
steps: () => [
{
content: "Select first attribute value",
trigger: ".products_attributes_filters form.js_attributes input:eq(0)",
run: "click",
expectUnloadPage: true,
},
{
content: "Select last attribute value",
trigger: ".products_attributes_filters form.js_attributes input:eq(3)",
run: "click",
expectUnloadPage: true,
},
{
content: "Select page 2",
trigger: 'li a.page-link:contains("2")',
run: "click",
expectUnloadPage: true,
},
{
content: "First attribute value should be checked",
trigger: ".products_attributes_filters form.js_attributes input:eq(0):checked",
},
{
content: "Last attribute value should be checked",
trigger: ".products_attributes_filters form.js_attributes input:eq(3):checked",
},
],
});

View file

@ -1,76 +0,0 @@
/** @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

@ -1,60 +1,64 @@
odoo.define('website_sale.tour_shop_mail', function (require) {
'use strict';
import { registry } from "@web/core/registry";
import { redirect } from "@web/core/utils/urls";
import * as tourUtils from "@website_sale/js/tours/tour_utils";
var tour = require('web_tour.tour');
const tourUtils = require('website_sale.tour_utils');
require('web.dom_ready');
tour.register('shop_mail', {
test: true,
registry.category("web_tour.tours").add('shop_mail', {
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',
},
steps: () => [
...tourUtils.addToCart({productName: 'Acoustic Bloc Screens', search: false, expectUnloadPage: true}),
tourUtils.goToCart(),
{
content: "check product is in cart, get cart id, go to backend",
trigger: 'td.td-product_name:contains("Acoustic Bloc Screens")',
trigger: 'div:has(a>h6: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;
const orderId = document.querySelector(".my_cart_quantity").dataset["orderId"];
redirect("/odoo/action-sale.action_orders/" + orderId);
},
expectUnloadPage: true,
},
{
content: "click confirm",
trigger: '.btn[name="action_confirm"]',
run: "click",
},
{
trigger: '.o_statusbar_status .o_arrow_button_current:contains("Sales Order")',
},
{
content: "click send by email",
trigger: '.btn[name="action_quotation_send"]',
extra_trigger: '.o_statusbar_status .o_arrow_button_current:contains("Sales Order")',
run: "click",
},
{
isActive: ["body:not(:has(.modal-footer button[name='action_send_mail']))"],
trigger: ".modal-footer button[name='document_layout_save']",
content: "let's continue",
tooltipPosition: "bottom",
run: "click",
},
{
content: "Open recipients dropdown",
trigger: '.o_field_many2many_tags_email[name=partner_ids] input',
run: 'click',
trigger: ".modal .o_field_many2many_tags_email[name=partner_ids] input",
run: 'edit Interior24',
},
{
content: "Select azure interior",
trigger: '.ui-menu-item a:contains(Interior24)',
in_modal: false,
trigger: ".modal .ui-menu-item a:contains(Interior24)",
run: "click",
},
{
trigger: '.modal .o_badge_text:contains("Azure")',
},
{
content: "click Send email",
trigger: '.btn[name="action_send_mail"]',
extra_trigger: '.o_badge_text:contains("Azure")',
trigger: '.modal .btn.o_mail_send',
run: "click",
},
{
trigger: "body:not(:has(.modal))",
},
{
content: "wait mail to be sent, and go see it",
trigger: '.o_Message_content:contains("Your"):contains("order")',
trigger: '.o-mail-Message-body:contains("Your"):contains("order")',
},
]);
});
]});

View file

@ -0,0 +1,80 @@
import { registry } from "@web/core/registry";
import * as tourUtils from "@website_sale/js/tours/tour_utils";
// This tour relies on a data created from the python test.
registry.category("web_tour.tours").add('tour_shop_multi_checkbox', {
url: '/shop?search=Product Multi',
steps: () => [
{
content: "select Product",
trigger: ".oe_product_cart a:text(Product Multi)",
run: "click",
expectUnloadPage: true,
},
{
content: "check price",
trigger: '.oe_currency_value:contains("750")',
},
{
content: 'click on the first option to select it',
trigger: 'input[data-attribute-name="Options"][data-value-name="Option 1"]',
run: "click",
},
{
content: "check third option is not available (but clickable)",
trigger: 'input[data-value-name="Option 3"].css_not_available:not([disabled])',
},
{
content: 'click on the second option to select it',
trigger: 'input[data-attribute-name="Options"][data-value-name="Option 2"]',
run: "click",
},
{
content: "check price of options is correct",
trigger: '.oe_currency_value:contains("753")',
},
{
content: "add to cart",
trigger: 'a:contains(Add to cart)',
run: "click",
},
tourUtils.goToCart(),
{
content: "check price is correct",
trigger: '#cart_products div div.text-muted>span:contains("Options: Option 1, Option 2")',
},
]});
registry.category("web_tour.tours").add('tour_shop_multi_checkbox_single_value', {
url: '/shop?search=Burger',
steps: () => [
{
content: "select Product",
trigger: '.oe_product_cart a:text(Burger)',
run: "click",
expectUnloadPage: true,
},
{
content: "check price",
trigger: '.oe_currency_value:contains("750")',
},
{
content: 'click on the first option to select it',
trigger: 'input[data-attribute-name="Toppings"][data-value-name="cheese"]',
run: "click",
},
{
content: "check price of options is correct",
trigger: '.oe_currency_value:contains("750")',
},
{
content: "add to cart",
trigger: 'a:contains(Add to cart)',
run: "click",
},
tourUtils.goToCart(),
{
content: "check choice was correctly saved",
trigger: '#cart_products div div.text-muted>span:contains("Toppings: cheese")',
},
]});

View file

@ -1,39 +1,28 @@
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');
import { registry } from "@web/core/registry";
import * as tourUtils from "@website_sale/js/tours/tour_utils";
// This tour relies on a data created from the python test.
tour.register('tour_shop_no_variant_attribute', {
test: true,
registry.category("web_tour.tours").add('tour_shop_no_variant_attribute', {
url: '/shop?search=Test Product 3',
},
[
steps: () => [
{
content: "select Test Product 3",
trigger: '.oe_product_cart a:containsExact("Test Product 3")',
trigger: ".oe_product_cart a:text(Test Product 3)",
run: "click",
expectUnloadPage: true,
},
{
content: "check price",
trigger: '.oe_currency_value:contains("1.00")',
run: function () {},
},
{
content: "add to cart",
trigger: 'a:contains(ADD TO CART)',
trigger: 'a:contains(Add to cart)',
run: "click",
},
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 () {},
trigger: 'h6[name="website_sale_cart_line_price"]:contains(11.0)',
},
]);
});
]});

View file

@ -1,35 +1,35 @@
odoo.define('website_sale_tour.website_sale_shop_pricelist_tour', function (require) {
'use strict';
import { registry } from "@web/core/registry";
var tour = require("web_tour.tour");
tour.register('website_sale_shop_pricelist_tour', {
test: true,
url: '/shop'
}, [
registry.category("web_tour.tours").add(
"website_sale.website_sale_shop_pricelist_tour",
{
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
},
]);
});
url: '/shop',
steps: () => [
{
content: "Check pricelist",
trigger: ".o_pricelist_dropdown .dropdown-toggle:not(:contains('User Pricelist'))",
},
{
content: "Go to login page",
trigger: "a:contains('Sign in')",
run: "click",
expectUnloadPage: true,
},
{
content: "Submit login",
trigger: '.oe_login_form',
run: function () {
document.querySelector('.oe_login_form input[name="login"]').value = "toto";
document.querySelector('.oe_login_form input[name="password"]').value = "long_enough_password";
document.querySelector('.oe_login_form input[name="redirect"]').value = "/shop";
document.querySelector('.oe_login_form').submit();
},
expectUnloadPage: true,
},
{
content: "Check pricelist",
trigger: ".o_pricelist_dropdown .dropdown-toggle:contains('User Pricelist')",
},
]
}
);

View file

@ -1,54 +1,50 @@
odoo.define('website_sale.tour_shop_zoom', function (require) {
'use strict';
var tour = require('web_tour.tour');
import { registry } from "@web/core/registry";
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,
registry.category("web_tour.tours").add('shop_zoom', {
url: '/shop?debug=1&search=' + imageName,
},
[
steps: () => [
{
content: "select " + imageName,
trigger: '.oe_product_cart a:containsExact("' + imageName + '")',
trigger: `.oe_product_cart a:text(${imageName})`,
run: "click",
expectUnloadPage: true,
},
{
content: "click on the image",
trigger: imageSelector,
run: 'clicknoleave',
run: "click",
},
{
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',
run: "click",
},
{
content: "change variant",
trigger: 'input[data-attribute_name="Beautiful Color"][data-value_name="' + nameGreen + '"]',
trigger: `input[data-attribute-name='Beautiful Color'][data-value-name='${nameGreen}']:not(:visible)`,
run: 'click',
},
{
content: "wait for variant to be loaded",
trigger: '.oe_currency_value:contains("21.00")'
trigger: '.oe_currency_value:contains("21.00")',
run: "click",
},
{
content: "click on the image",
trigger: imageSelector,
run: 'clicknoleave',
run: "click",
},
{
content: "check there is a zoom on that big image",
trigger: '.o_wsale_image_viewer',
run: () => {},
},
]);
});
]});

View file

@ -1,84 +1,51 @@
/** @odoo-module */
import {
changeOptionInPopover,
clickOnSave,
clickOnSnippet,
insertSnippet,
registerWebsitePreviewTour,
} from '@website/js/tours/tour_utils';
import { goToCart } from '@website_sale/js/tours/tour_utils';
import wTourUtils from 'website.tour_utils';
import wSaleTourUtils from 'website_sale.tour_utils';
const productsSnippet = {id: "s_dynamic_snippet_products", name: "Products", groupName: "Catalog"};
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_");
registerWebsitePreviewTour('website_sale.snippet_products', {
url: '/',
edition: true,
},
() => {
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}"]`),
...insertSnippet(productsSnippet),
...clickOnSnippet(productsSnippet),
...clickOnSave(),
{
content: 'Check the template is applied',
trigger: `iframe .s_dynamic_snippet_products.${templateClass} .carousel`,
run: () => null, // It's a check
trigger: ":iframe .s_dynamic_snippet_products .o_carousel_product_card .js_add_cart:not(:visible)",
run: 'click',
},
];
}
goToCart({ backend: true, expectUnloadPage: false }),
]
});
let templatesSteps = [];
for (const templateKey of templates) {
templatesSteps = templatesSteps.concat(changeTemplate(templateKey));
}
wTourUtils.registerWebsitePreviewTour('website_sale.snippet_products', {
test: true,
registerWebsitePreviewTour('website_sale.products_snippet_recently_viewed', {
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(),
() => [
...insertSnippet(productsSnippet),
...clickOnSnippet(productsSnippet),
...changeOptionInPopover("Products", "Filter", "Recently Viewed"),
...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',
run({ queryFirst }) {
queryFirst(
`:iframe .o_carousel_product_card[aria-label="Storage Box"] .js_remove`,
).style.display = "block";
}
},
{
trigger: 'iframe .s_dynamic_snippet_products .o_carousel_product_card .js_remove',
trigger: ':iframe .s_dynamic_snippet_products .o_carousel_product_card .js_remove',
run: 'click',
},
]);

View file

@ -0,0 +1,38 @@
import { registry } from "@web/core/registry";
import * as tourUtils from "@website_sale/js/tours/tour_utils";
registry.category("web_tour.tours").add('update_billing_shipping_address', {
url: '/shop',
steps: () => [
...tourUtils.addToCart({ productName: "Office Chair Black TEST", expectUnloadPage: true }),
tourUtils.goToCart({quantity: 1}),
tourUtils.goToCheckout(),
tourUtils.confirmOrder(),
{
content: "Edit Address",
trigger: '#delivery_and_billing a:contains("Edit")',
run: "click",
expectUnloadPage: true,
},
{
content: "Edit billing address which is shipping address too",
trigger: 'a.js_edit_address',
run: "click",
expectUnloadPage: true,
},
{
content: "Empty the phone field",
trigger: 'input[name="phone"]',
run: "clear",
},
{
content: "Save address",
trigger: "a[name='website_sale_main_button']",
run: "click",
},
{
content: "Check there is a warning for required field.",
trigger: ':invalid',
},
],
});

View file

@ -0,0 +1,70 @@
import { registry } from '@web/core/registry';
import * as tourUtils from '@website_sale/js/tours/tour_utils';
registry.category('web_tour.tours').add('shop_update_cart', {
url: '/shop',
steps: () => [
...tourUtils.searchProduct("conference chair", { select: true }),
{
trigger: "#product_detail",
},
{
content: "select Conference Chair Aluminium",
trigger: 'label:contains(Aluminium) input',
run: "click",
},
{
trigger: "#product_detail",
},
{
content: "select Conference Chair Steel",
trigger: 'label:contains(Steel) input',
run: "click",
},
{
trigger: "label:contains(Steel) input:checked",
},
{
content: "click on add to cart",
trigger: '#product_detail form #add_to_cart',
run: "click",
},
{
content: "click in modal on 'Proceed to checkout' button",
trigger: 'button:contains("Checkout")',
run: "click",
expectUnloadPage: true,
},
...tourUtils.assertCartContains({productName: 'Conference Chair', combinationName: 'Steel'}),
{
content: "add suggested",
trigger: '.js_cart_lines:has(a:contains("Storage Box")) button:contains("Add to cart")',
run: "click",
expectUnloadPage: true,
},
{
trigger: '#cart_products a[name="o_cart_line_product_link"]>h6:contains("Storage Box")',
},
{
content: "remove Storage Box",
trigger: '#cart_products div:has(a[name="o_cart_line_product_link"]>h6:contains("Storage Box")) a:has(i.oi-minus)',
run: "click",
},
{
trigger: '#wrap:not(:has(#cart_products a[name="o_cart_line_product_link"]>h6:contains("Storage Box")))',
},
{
content: "add one more",
trigger: '#cart_products div:has(a[name="o_cart_line_product_link"]>h6:contains("Conference Chair")) a:has(i.oi-plus)',
run: "click",
},
{
trigger: '#cart_products div:has(div>a>h6:contains("Conference Chair")) input.js_quantity:value(2)',
},
{
content: "set one",
trigger: '#cart_products input.js_quantity',
run: "edit 1",
},
],
});

View file

@ -0,0 +1,72 @@
import { registry } from "@web/core/registry";
// This tour relies on a data created from the python test.
registry.category("web_tour.tours").add('tour_variants_modal_window', {
url: '/shop?search=Short (TEST)',
steps: () => [
{
content: "Select the Short (TEST) product",
trigger: `.oe_product_cart a:contains(/^Short \\(TEST\\)$/)`,
run: "click",
expectUnloadPage: true,
},
{
content: "Click on the always variant",
trigger: 'input[data-attribute-name="Always attribute size"][data-value-name="M always"]',
run: "check",
},
{
content: "Click on the dynamic variant",
trigger: 'input[data-attribute-name="Dynamic attribute size"][data-value-name="M dynamic"]',
run: "check",
},
{
content: "Click on the never variant",
trigger: 'input[data-attribute-name="Never attribute size"][data-value-name="M never"]',
run: "check",
},
{
content: "Click on the never custom variant",
trigger: 'input[data-attribute-name="Never attribute size custom"][data-value-name="Yes never custom"]',
run: "check",
},
{
trigger: 'input.variant_custom_value',
run: "edit TEST",
},
{
content: "Click add to cart",
trigger: '#add_to_cart',
run: "click",
},
{
trigger:
'.modal:has(table.o_sale_product_configurator_table)',
},
{
content: "Go through the modal window of the product configurator",
trigger: 'button:contains("Checkout")',
run: "click",
expectUnloadPage: true,
},
{
content: "Check the product is in the cart",
trigger: 'div>a>h6:contains(Short (TEST))',
},
{
content: "Check always variant",
trigger: 'span[class*=h6]:contains(M always)',
},
{
content: "Check dynamic variant",
trigger: 'span[class*=h6]:contains(M dynamic)',
},
{
content: "Check never variant",
trigger: 'div.text-muted>span:contains(Never attribute size: M never)',
},
{
content: "Check never custom variant",
trigger: 'div.text-muted>span:contains(Never attribute size custom: Yes never custom: TEST)',
}
]});

View file

@ -0,0 +1,43 @@
import { registry } from '@web/core/registry';
registry.category('web_tour.tours').add('website_sale_contact_us_button', {
steps: () => [
{
content: "Check that the red color attribute is selected",
trigger: '.js_attribute_value:has([checked]):contains(red)',
},
{
content: "Product price should be 20",
trigger: '.product_price .oe_currency_value:contains(20.00)',
},
{
content: '"Add to Cart" button should be visibile',
trigger: '#add_to_cart_wrap',
},
{
content: '"Contact Us" button should be hidden',
trigger: '#contact_us_wrapper:not(:visible)',
},
{
content: "Select attribute with price zero value",
trigger: '.js_attribute_value:contains(blue) input',
run: 'click',
},
{
content: "Zero-priced product should be unavailable",
trigger: '#product_unavailable',
},
{
content: "Price should be hidden",
trigger: '.product_price:not(:visible)',
},
{
content: '"Add to Cart" button should be hidden',
trigger: '#add_to_cart_wrap:not(:visible)',
},
{
content: '"Contact Us" button should be visible',
trigger: '#contact_us_wrapper',
},
],
});