-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] website_product_configurator: Reconfigure cart line
- Loading branch information
1 parent
c35a496
commit c4ff3f4
Showing
11 changed files
with
269 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
website_product_configurator/static/tests/tours/reconfigure_cart_line.esm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/** @odoo-module **/ | ||
import tour from "web_tour.tour"; | ||
|
||
import websiteSaleTourUtils from "website_sale.tour_utils"; | ||
|
||
tour.register( | ||
"website_product_configurator.reconfigure_cart_line", | ||
{ | ||
test: true, | ||
}, | ||
[ | ||
{ | ||
content: "Add to cart", | ||
trigger: "#add_to_cart", | ||
}, | ||
websiteSaleTourUtils.goToCart({quantity: 1}), | ||
{ | ||
content: "Check Silver car is in cart", | ||
trigger: "#cart_products td.td-product_name strong:contains('Silver')", | ||
// eslint-disable-next-line no-empty-function | ||
run: () => {}, | ||
}, | ||
{ | ||
content: "Click on reconfigure link", | ||
trigger: "td[class='td-reconfigure_action'] > a", | ||
}, | ||
{ | ||
content: "Check banner is shown", | ||
trigger: "div[role='alert']", | ||
// eslint-disable-next-line no-empty-function | ||
run: () => {}, | ||
}, | ||
{ | ||
content: "Go to Body step", | ||
trigger: "#product_config_form a:contains('Body')", | ||
run: "click", | ||
}, | ||
{ | ||
content: "Select Red color", | ||
// Paint color is the first select of the active tab | ||
trigger: "div.show[role='tabpanel'] select", | ||
run: function () { | ||
const color_select = $("div.show[role='tabpanel'] select")[0]; | ||
const $red = $(color_select).find("option:contains('Red')"); | ||
$(color_select).val($red.attr("value")).change(); | ||
}, | ||
}, | ||
{ | ||
content: "Go to last step", | ||
trigger: "#product_config_form a:contains('Extras')", | ||
}, | ||
{ | ||
content: "Confirm", | ||
trigger: "button#form_action span:contains('Continue')", | ||
}, | ||
{ | ||
content: "Check configured car is red", | ||
trigger: "#product_details span:contains('Red')", | ||
// eslint-disable-next-line no-empty-function | ||
run: () => {}, | ||
}, | ||
{ | ||
content: "Add to cart", | ||
trigger: "#add_to_cart", | ||
}, | ||
{ | ||
content: "Check banner is shown", | ||
trigger: "div[role='alert']", | ||
// eslint-disable-next-line no-empty-function | ||
run: () => {}, | ||
}, | ||
websiteSaleTourUtils.goToCart({quantity: 1}), | ||
{ | ||
content: "Check Red car is in cart", | ||
trigger: "#cart_products td.td-product_name strong:contains('Red')", | ||
// eslint-disable-next-line no-empty-function | ||
run: () => {}, | ||
}, | ||
] | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
website_product_configurator/tests/test_reconfigure_cart_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright 2024 Simone Rubino - Aion Tech | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
import operator | ||
from functools import reduce | ||
|
||
from odoo.tests import HttpCase, tagged | ||
|
||
from .test_website_product_configurator_values import TestProductConfiguratorValues | ||
|
||
|
||
@tagged("post_install", "-at_install") | ||
class TestReconfigureProductHTTP(HttpCase, TestProductConfiguratorValues): | ||
def test_tour(self): | ||
admin_user = self.env.ref("base.user_admin") | ||
|
||
session = self.session_id | ||
session.user_id = admin_user | ||
pavs_xmlids = [ | ||
"product_configurator.product_attribute_value_gasoline", | ||
"product_configurator.product_attribute_value_218i", | ||
"product_configurator.product_attribute_value_steptronic", | ||
"product_configurator.product_attribute_value_silver", | ||
"product_configurator.product_attribute_value_rims_378", | ||
"product_configurator.product_attribute_value_tapistry_black", | ||
"product_configurator.product_attribute_value_sport_line", | ||
"product_configurator.product_attribute_value_armrest", | ||
] | ||
pavs_list = [self.env.ref(xmlid) for xmlid in pavs_xmlids] | ||
session.value_ids = reduce(operator.or_, pavs_list) | ||
session.action_confirm() | ||
|
||
session_url = "/product_configurator/product/%s" % session.id | ||
self.start_tour( | ||
session_url, | ||
"website_product_configurator.reconfigure_cart_line", | ||
login=admin_user.login, | ||
) |
Oops, something went wrong.