Skip to content

Commit e8ed77d

Browse files
committed
MAGETWO-87013: Cart Price Rules - Category Drill Down problems
1 parent ca11b5d commit e8ed77d

File tree

4 files changed

+108
-0
lines changed

4 files changed

+108
-0
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/CategoryData.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,10 @@
1919
<data key="is_active">true</data>
2020
<data key="include_in_menu">true</data>
2121
</entity>
22+
<entity name="SubCategoryWithParent" type="category">
23+
<data key="name" unique="suffix">subCategory</data>
24+
<data key="name_lwr" unique="suffix">subCategory</data>
25+
<data key="is_active">true</data>
26+
<var key="parent_id" entityType="category" entityKey="id" />
27+
</entity>
2228
</entities>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
10+
<page name="PriceRuleNewPage" url="sales_rule/promo_quote/new/" area="admin" module="SalesRule">
11+
<section name="PriceRuleConditionsSection"/>
12+
</page>
13+
</pages>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="PriceRuleConditionsSection">
12+
<element name="conditionsTab" type="text" selector="//div[@data-index='conditions']//span[contains(.,'Conditions')][1]"/>
13+
<element name="createNewRule" type="text" selector="span.rule-param.rule-param-new-child" />
14+
<element name="rulesDropdown" type="text" selector="select[data-form-part='sales_rule_form'][data-ui-id='newchild-0-select-rule-conditions-1-new-child']"/>
15+
<element name="addProductAttributesButton" type="text" selector="//*[@id='conditions__1--1__children']/li/span/a" />
16+
<element name="productAttributesDropdown" type="select" selector="//select[@id='conditions__1--1__new_child']" />
17+
<element name="changeCategoriesButton" type="text" selector="//*[@id='conditions__1--1__children']/li[1]/span[2]/a" />
18+
<element name="categoriesChooser" type="text" selector="//*[@id='conditions__1--1__children']/li[1]/span[2]/span/label/a" />
19+
<element name="treeRoot" type="text" selector=".x-tree-root-ct.x-tree-lines" />
20+
<element name="lastTreeNode" type="text" selector=".x-tree-root-ct.x-tree-lines > div > li > ul > li:last-child div img.x-tree-elbow-end-plus" />
21+
<element name="subcategory4level" type="text" selector=".x-tree-root-ct.x-tree-lines > div > li > ul > li > ul > li > ul > li > ul > li > div img.x-tree-elbow-end-plus" />
22+
</section>
23+
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
10+
<test name="PriceRuleCategoryNestingTest">
11+
<annotations>
12+
<description value="Category nesting level must be the same as were created in categories."/>
13+
<severity value="CRITICAL"/>
14+
<testCaseId value="MAGETWO-88031"/>
15+
<group value="sale_rules"/>
16+
</annotations>
17+
<before>
18+
<createData entity="_defaultCategory" stepKey="subcategory1"/>
19+
<createData entity="SubCategoryWithParent" stepKey="subcategory2">
20+
<requiredEntity createDataKey="subcategory1"/>
21+
</createData>
22+
<createData entity="SubCategoryWithParent" stepKey="subcategory3">
23+
<requiredEntity createDataKey="subcategory2"/>
24+
</createData>
25+
<createData entity="SubCategoryWithParent" stepKey="subcategory4">
26+
<requiredEntity createDataKey="subcategory3"/>
27+
</createData>
28+
<createData entity="SubCategoryWithParent" stepKey="subcategory5">
29+
<requiredEntity createDataKey="subcategory4"/>
30+
</createData>
31+
</before>
32+
<after>
33+
<deleteData createDataKey="subcategory1" stepKey="deleteCategory1" />
34+
<deleteData createDataKey="subcategory2" stepKey="deleteCategory2" />
35+
<deleteData createDataKey="subcategory3" stepKey="deleteCategory3" />
36+
<deleteData createDataKey="subcategory4" stepKey="deleteCategory4" />
37+
<deleteData createDataKey="subcategory5" stepKey="deleteCategory5" />
38+
<amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/admin/auth/logout/" stepKey="amOnLogoutPage" />
39+
</after>
40+
41+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/>
42+
<amOnPage stepKey="openCatalogPriceRulePage" url="{{PriceRuleNewPage.url}}" />
43+
<waitForPageLoad stepKey="waitCatalogPriceRulePageLoad"/>
44+
<click stepKey="openConditionsSection" selector="{{PriceRuleConditionsSection.conditionsTab}}" />
45+
<click stepKey="createNewRule" selector="{{PriceRuleConditionsSection.createNewRule}}" />
46+
<selectOption stepKey="selectProductAttributes" selector="{{PriceRuleConditionsSection.rulesDropdown}}" userInput="Magento\SalesRule\Model\Rule\Condition\Product\Found" />
47+
<waitForAjaxLoad stepKey="ajaxLoad1"/>
48+
<waitForElement stepKey="wait1" selector="{{PriceRuleConditionsSection.addProductAttributesButton}}" />
49+
<click stepKey="clickToshowAttributes" selector="{{PriceRuleConditionsSection.addProductAttributesButton}}"/>
50+
<selectOption stepKey="selectCategoryAttribute" selector="{{PriceRuleConditionsSection.productAttributesDropdown}}" userInput="Magento\SalesRule\Model\Rule\Condition\Product|category_ids" />
51+
<waitForAjaxLoad stepKey="ajaxLoad2"/>
52+
53+
<waitForElement stepKey="wait2" selector="{{PriceRuleConditionsSection.changeCategoriesButton}}" />
54+
<click stepKey="changeCategories" selector="{{PriceRuleConditionsSection.changeCategoriesButton}}" />
55+
<click stepKey="showCategoriesChooser" selector="{{PriceRuleConditionsSection.categoriesChooser}}" />
56+
<waitForAjaxLoad stepKey="ajaxLoad3"/>
57+
58+
<waitForElement selector="{{PriceRuleConditionsSection.treeRoot}}" stepKey="wait3"/>
59+
<click stepKey="openLatestTreeNode1" selector="{{PriceRuleConditionsSection.lastTreeNode" />
60+
<click stepKey="openLatestTreeNode2" selector="{{PriceRuleConditionsSection.lastTreeNode" />
61+
<click stepKey="openLatestTreeNode3" selector="{{PriceRuleConditionsSection.lastTreeNode" />
62+
<waitForAjaxLoad stepKey="ajaxLoad4"/>
63+
<waitForElement selector="{{PriceRuleConditionsSection.subcategory4level}}" stepKey="wait4"/>
64+
<click stepKey="openLatestTreeNode4" selector="{{PriceRuleConditionsSection.subcategory4level}}" />
65+
</test>
66+
</tests>

0 commit comments

Comments
 (0)