Skip to content

Commit

Permalink
[MIG] website_sale_product_attribute_value_filter_existing: Migration…
Browse files Browse the repository at this point in the history
… to 17.0
  • Loading branch information
lef-adhoc committed May 21, 2024
1 parent 39477d7 commit d5e2cfd
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Website Sale Attribute Value Existing",
"summary": "Allow hide attributes values not used in variants",
"version": "16.0.1.0.3",
"version": "17.0.1.0.0",
"development_status": "Production/Stable",
"category": "Website",
"website": "https:/OCA/e-commerce",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
/** @odoo-module **/

import tour from "web_tour.tour";
import {registry} from "@web/core/registry";

tour.register(
"website_sale_product_attribute_value_filter_existing",
{
registry
.category("web_tour.tours")
.add("website_sale_product_attribute_value_filter_existing", {
test: true,
url: "/shop",
},
// No product has the yellow colour attribute defined.
// When enter to "/shop" the attribute "test yellow" should not appear in the list of filters by attribute.
[
// For the following steps it is checked that the attribute "test yellow" is
// not present in the list but the attributes "test red", "test blue" and
// "test green" must be present.
{
content:
"Search a product. Ensure 'test red', 'test blue' and 'test green' attributes are present while 'Test yellow' is not.",
trigger: "form input[name=search]",
run: "text desk",
extra_trigger:
".js_attributes:not(:contains('Test yellow')):has(label:contains('Test red')), .js_attributes:not(:contains('Test yellow')):has(label:contains('Test blue')), .js_attributes:not(:contains('Test yellow')):has(label:contains('Test green'))",
},
{
content:
"Submit search button. Ensure 'test red', 'test blue' and 'test green' attributes are present while 'Test yellow' is not.",
trigger: 'form:has(input[name="search"]) .oe_search_button',
extra_trigger:
".js_attributes:not(:contains('Test yellow')):has(label:contains('Test red')), .js_attributes:not(:contains('Test yellow')):has(label:contains('Test blue')), .js_attributes:not(:contains('Test yellow')):has(label:contains('Test green'))",
},
// After searching, the attributes "test red" and "test green" must be present.
// "Test yelow" should not be present as it is not used in any product and
// "test blue" should not be present as it is not used in the products shown.
{
content:
"Go to /shop after the search. Ensure 'test red' and 'test green' attributes are present while 'Test yellow' and 'test blue' are not.",
trigger: "a[href='/shop']",
extra_trigger:
".js_attributes:not(:contains('Test blue'), :contains('Test yellow')):has(label:contains('Test green')), .js_attributes:not(:contains('Test blue'), :contains('Test yellow')):has(label:contains('Test red'))",
},
]
);
steps: () => [
// No product has the yellow colour attribute defined.
// When enter to "/shop" the attribute "test yellow" should not appear in the list of filters by attribute.
// For the following steps it is checked that the attribute "test yellow" is
// not present in the list but the attributes "test red", "test blue" and
// "test green" must be present.
{
content:
"Search a product. Ensure 'test red', 'test blue' and 'test green' attributes are present while 'Test yellow' is not.",
trigger: "form input[name=search]",
run: "text desk",
extra_trigger:
".js_attributes:not(:contains('Test yellow')):has(label:contains('Test red')), .js_attributes:not(:contains('Test yellow')):has(label:contains('Test blue')), .js_attributes:not(:contains('Test yellow')):has(label:contains('Test green'))",
},
{
content:
"Submit search button. Ensure 'test red', 'test blue' and 'test green' attributes are present while 'Test yellow' is not.",
trigger: 'form:has(input[name="search"]) .oe_search_button',
extra_trigger:
".js_attributes:not(:contains('Test yellow')):has(label:contains('Test red')), .js_attributes:not(:contains('Test yellow')):has(label:contains('Test blue')), .js_attributes:not(:contains('Test yellow')):has(label:contains('Test green'))",
},
// After searching, the attributes "test red" and "test green" must be present.
// "Test yellow" should not be present as it is not used in any product and
// "test blue" should not be present as it is not used in the products shown.
{
content:
"Go to /shop after the search. Ensure 'test red' and 'test green' attributes are present while 'Test yellow' and 'test blue' are not.",
trigger: "a[href='/shop']",
extra_trigger:
".js_attributes:not(:contains('Test yellow')):has(label:contains('Test red')), .js_attributes:not(:contains('Test yellow')):has(label:contains('Test blue')), .js_attributes:not(:contains('Test yellow')):has(label:contains('Test green'))",
},
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,6 @@ def test_ui_website(self):
"website_sale_product_attribute_value_filter_existing",
login="admin",
# deplay step here to ensure the tests pass
step_delay=100,
step_delay=300,
timeout=600,
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
<attribute name="t-if">attr_values_used &amp; v</attribute>
</xpath>
<xpath
expr="//t[@t-if=&quot;a.display_type == 'radio' or a.display_type == 'pills'&quot;]//t[@t-foreach='a.value_ids']/div"
expr="//div[@t-elif=&quot;a.display_type in ('radio', 'pills', 'multi')&quot;]//t[@t-foreach='a.value_ids']/div"
position="attributes"
>
<attribute name="t-if">attr_values_used &amp; v</attribute>
</xpath>
<xpath
expr="//div[@t-if=&quot;a.display_type == 'color'&quot;]//t[@t-foreach='a.value_ids']/label"
position="attributes"
>
</template>
<template
id="o_wsale_offcanvas_color_attribute"
inherit_id="website_sale.o_wsale_offcanvas_color_attribute"
>
<xpath expr="//t[@t-foreach='a.value_ids']/label" position="attributes">
<attribute name="t-if">attr_values_used &amp; v</attribute>
</xpath>
</template>
Expand Down

0 comments on commit d5e2cfd

Please sign in to comment.