Skip to content

Commit

Permalink
[IMP]website_product_configurator: write test case for website_produc…
Browse files Browse the repository at this point in the history
…t_configurator
  • Loading branch information
pledrateam committed Nov 23, 2021
1 parent 966a0f8 commit bfe5621
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 34 deletions.
79 changes: 45 additions & 34 deletions website_product_configurator/static/src/js/website_config_tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ odoo.define("website_product_configurator.tour_configuration", function (require
},
{
content: "click to select fuel",
trigger: "div.tab-pane.container.fade.active.in select:first",
extra_trigger: ".nav-item.config_step.active a:contains(Engine)",
trigger: ".tab-pane.fade.container.show.active select",
run: function () {
$(
".tab-pane.container.fade.active.in select:first option:contains(Gasoline)"
".tab-pane.fade.container.show.active select:first option:contains(Gasoline)"
)[0].selected = true;
$(
".tab-pane.container.fade.active.in select:first option:contains(Gasoline)"
".tab-pane.fade.container.show.active select:first option:contains(Gasoline)"
)
.closest("select")
.change();
Expand All @@ -42,32 +41,32 @@ odoo.define("website_product_configurator.tour_configuration", function (require
{
content: "click to select engine",
trigger:
".tab-pane.container.fade.active.in select.form-control.config_attribute.required_config_attrib",
".tab-pane.fade.container.show.active select.form-control.config_attribute.cfg-select.required_config_attrib",
run: function () {
$(
".tab-pane.container.fade.active.in select.form-control.config_attribute.required_config_attrib option:contains(218i)"
".tab-pane.fade.container.show.active select > option:contains(218i)"
)[0].selected = true;
$(
".tab-pane.container.fade.active.in select.form-control.config_attribute.required_config_attrib option:contains(218i)"
".tab-pane.fade.container.show.active select > option:contains(218i)"
)
.closest("select")
.change();
},
},
{
content: "click on continue",
trigger: "#form_action span:contains(Continue)",
trigger: "span:contains(Continue)",
run: "click",
},
{
content: "click to select color",
extra_trigger: ".nav-item.config_step.active a:contains(Body)",
trigger: "div.tab-pane.container.fade.active.in select:first",
trigger: ".tab-pane.fade.container.show.active select",
run: function () {
$(
".tab-pane.container.fade.active.in select:first option:contains(Silver)"
".tab-pane.fade.container.show.active select:first option:contains(Silver)"
)[0].selected = true;
$(
".tab-pane.container.fade.active.in select:first option:contains(Silver)"
".tab-pane.fade.container.show.active select:first option:contains(Silver)"
)
.closest("select")
.change();
Expand All @@ -76,70 +75,71 @@ odoo.define("website_product_configurator.tour_configuration", function (require
{
content: "click to select rims",
trigger:
"div.tab-pane.container.fade.active.in select.form-control.config_attribute.required_config_attrib",
".tab-pane.fade.container.show.active select.form-control.config_attribute.cfg-select.required_config_attrib",
run: function () {
$(
".tab-pane.container.fade.active.in select.form-control.config_attribute.required_config_attrib option:contains(V-spoke 16)"
".tab-pane.fade.container.show.active select > option:contains(V-spoke 16)"
)[0].selected = true;
$(
".tab-pane.container.fade.active.in select.form-control.config_attribute.required_config_attrib option:contains(V-spoke 16)"
".tab-pane.fade.container.show.active select > option:contains(V-spoke 16)"
)
.closest("select")
.change();
},
},
{
content: "click on continue",
trigger: "#form_action span:contains(Continue)",
extra_trigger: ".nav-item.config_step a:contains(Lines)",
trigger: "span:contains(Continue)",
run: "click",
},
{
content: "click to select Lines",
extra_trigger: ".nav-item.config_step.active a:contains(Lines)",
trigger: ".tab-pane.container.fade.active.in select:first",
trigger: ".tab-pane.fade.container.show.active select",
run: function () {
$(
".tab-pane.container.fade.active.in select:first option:contains(Sport Line)"
".tab-pane.fade.container.show.active select option:contains(Sport Line)"
)[0].selected = true;
$(
".tab-pane.container.fade.active.in select:first option:contains(Sport Line)"
".tab-pane.fade.container.show.active select option:contains(Sport Line)"
)
.closest("select")
.change();
},
},
{
content: "click on continue",
trigger: "#form_action span:contains(Continue)",
trigger: "span:contains(Continue)",
run: "click",
},
{
content: "click to select tapistry",
extra_trigger: ".nav-item.config_step.active a:contains(Interior)",
trigger: "div.tab-pane.container.fade.active.in select:first",
trigger: ".tab-pane.fade.container.show.active select",
run: function () {
$(
".tab-pane.container.fade.active.in select:first option:contains(Black)"
".tab-pane.fade.container.show.active select option:contains(Black)"
)[0].selected = true;
$(
".tab-pane.container.fade.active.in select:first option:contains(Black)"
".tab-pane.fade.container.show.active select option:contains(Black)"
)
.closest("select")
.change();
},
},
{
content: "click on continue",
trigger: "#form_action span:contains(Continue)",
trigger: "span:contains(Continue)",
run: "click",
},
{
content: "click to select Transmission",
extra_trigger: ".nav-item.config_step.active a:contains(Extras)",
trigger: "div.tab-pane.container.fade.active.in select:first",
trigger: ".tab-pane.fade.container.show.active select",
run: function () {
$(
'.tab-pane.container.fade.active.in select:first option:contains("Automatic (Steptronic)")'
'.tab-pane.fade.container.show.active select:first option:contains("Automatic (Steptronic)")'
)[0].selected = true;
$(
'.tab-pane.container.fade.active.in select:first option:contains("Automatic (Steptronic)")'
'.tab-pane.fade.container.show.active select:first option:contains("Automatic (Steptronic)")'
)
.closest("select")
.change();
Expand All @@ -148,21 +148,32 @@ odoo.define("website_product_configurator.tour_configuration", function (require
{
content: "click to select Options",
trigger:
"div.tab-pane.container.fade.active.in select.form-control.config_attribute.required_config_attrib",
".tab-pane.fade.container.show.active select.form-control.config_attribute.cfg-select.required_config_attrib",
run: function () {
$(
".tab-pane.container.fade.active.in select.form-control.config_attribute.required_config_attrib option:contains(Armrest)"
".tab-pane.fade.container.show.active select > option:contains(Armrest)"
)[0].selected = true;
$(
".tab-pane.container.fade.active.in select.form-control.config_attribute.required_config_attrib option:contains(Armrest)"
".tab-pane.fade.container.show.active select > option:contains(Armrest)"
)
.closest("select")
.change();
},
},
{
content: "click on continue",
trigger: "#form_action span:contains(Continue)",
trigger: "span:contains(Continue)",
run: "click",
},
{
content: "click on add to cart",
trigger: "#add_to_cart",
run: "click",
},
{
content: "proceed to checkout product",
trigger: 'a[href*="/shop/checkout"]',
run: "click",
},
]
);
Expand Down
8 changes: 8 additions & 0 deletions website_product_configurator/tests/test_sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ def test_cart_update(self):
cart_update.get("quantity"), self.sale_order.order_line.product_uom_qty
)

self.sale_order.write({"order_line": False})
self.sale_order._cart_update(
product_id=product_id,
set_qty=1,
add_qty=1,
)
self.assertTrue(self.sale_order.order_line, "No Sale Order Line created.")

def test_get_real_price_currency(self):
price, rule_id = self.sale_order.pricelist_id.get_product_price_rule(
self.sale_order.order_line.product_id,
Expand Down

0 comments on commit bfe5621

Please sign in to comment.