Skip to content

Commit 25f3d7d

Browse files
committed
MAGETWO-97240: Category rules should apply to complex products
1 parent 374a213 commit 25f3d7d

File tree

4 files changed

+36
-28
lines changed

4 files changed

+36
-28
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,6 @@
272272
<amOnPage url="{{AdminProductEditPage.url(productId)}}" stepKey="amOnPage"/>
273273
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{categoryName}}]" stepKey="selectCategory"/>
274274
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton"/>
275-
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/>
275+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveProductMessage"/>
276276
</actionGroup>
277277
</actionGroups>

app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCartPriceRuleActionGroup.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,27 @@
3838
<click selector="{{AdminMainActionsSection.saveAndContinue}}" stepKey="clickSaveButton"/>
3939
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
4040
</actionGroup>
41+
42+
<actionGroup name="SetConditionForActionsInCartPriceRuleActionGroup">
43+
<arguments>
44+
<argument name="actionsAggregator" type="string" defaultValue="ANY"/>
45+
<argument name="actionsValue" type="string" defaultValue="FALSE"/>
46+
<argument name="childAttribute" type="string" defaultValue="Category"/>
47+
<argument name="actionValue"/>
48+
</arguments>
49+
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickOnActionTab"/>
50+
<click selector="{{AdminCartPriceRulesFormSection.condition('ALL')}}" stepKey="clickToChooseOption"/>
51+
<selectOption selector="{{AdminCartPriceRulesFormSection.actionsAggregator}}" userInput="{{actionsAggregator}}" stepKey="selectCondition"/>
52+
<click selector="{{AdminCartPriceRulesFormSection.condition('TRUE')}}" stepKey="clickToChooseOption2"/>
53+
<selectOption selector="{{AdminCartPriceRulesFormSection.actionsValue}}" userInput="{{actionsValue}}" stepKey="selectCondition2"/>
54+
<click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="selectActionConditions"/>
55+
<waitForPageLoad stepKey="waitForDropDownOpened"/>
56+
<selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{childAttribute}}" stepKey="selectAttribute"/>
57+
<waitForPageLoad stepKey="waitForOperatorOpened"/>
58+
<click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption3"/>
59+
<fillField selector="{{AdminCartPriceRulesFormSection.actionValue}}" userInput="{{actionValue}}" stepKey="fillActionValue"/>
60+
<click selector="{{AdminCartPriceRulesFormSection.applyAction}}" stepKey="applyAction"/>
61+
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveButton"/>
62+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
63+
</actionGroup>
4164
</actionGroups>

app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,8 @@
171171
<data key="uses_per_coupon">10</data>
172172
<data key="simple_free_shipping">1</data>
173173
</entity>
174+
175+
<entity name="SalesRuleNoCouponWithFixedDiscount" extends="ApiCartRule">
176+
<data key="simple_action">by_fixed</data>
177+
</entity>
174178
</entities>

app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToComplexProductsTest.xml

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
<description value="Sales rules filtering on category should apply to all products, including complex products."/>
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MAGETWO-70192"/>
19-
<group value="CatalogRule"/>
19+
<group value="catalogRule"/>
2020
</annotations>
2121
<before>
2222
<!-- Create two Categories: CAT1 and CAT2 -->
23-
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
23+
<createData entity="_defaultCategory" stepKey="createCategory"/>
2424
<createData entity="SimpleSubCategory" stepKey="createCategory2"/>
2525
<!--Create config1 and config2-->
2626
<actionGroup ref="AdminCreateApiConfigurableProductWithHiddenChildActionGroup" stepKey="createConfigurableProduct1">
@@ -71,34 +71,15 @@
7171
<deleteData createDataKey="createConfigChildProduct2CreateConfigurableProduct2" stepKey="deleteConfigChildProduct4"/>
7272
<deleteData createDataKey="createConfigProductAttributeCreateConfigurableProduct2" stepKey="deleteConfigProductAttribute2"/>
7373
<!--Delete Cart Price Rule -->
74-
<actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCartPriceRule">
75-
<argument name="ruleName" value="{{ApiSalesRule.name}}"/>
76-
</actionGroup>
74+
<deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/>
7775
<actionGroup ref="logout" stepKey="logout"/>
7876
</after>
7977
<!-- 1: Create a cart price rule applying to CAT1 with discount -->
80-
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceGridPage"/>
81-
<click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/>
82-
<fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{ApiSalesRule.name}}" stepKey="fillRuleName"/>
83-
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsite"/>
84-
<actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="chooseNotLoggedInCustomerGroup"/>
85-
<!-- Open the Actions Tab-->
86-
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickOnActionTab"/>
87-
<fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="50" stepKey="fillDiscountAmount"/>
88-
<selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount" stepKey="selectActionType"/>
89-
<click selector="{{AdminCartPriceRulesFormSection.condition('ALL')}}" stepKey="clickToChooseOption2"/>
90-
<selectOption selector="{{AdminCartPriceRulesFormSection.actionsAggregator}}" userInput="ANY" stepKey="selectCondition"/>
91-
<click selector="{{AdminCartPriceRulesFormSection.condition('TRUE')}}" stepKey="clickToChooseOption3"/>
92-
<selectOption selector="{{AdminCartPriceRulesFormSection.actionsValue}}" userInput="FALSE" stepKey="selectCondition2"/>
93-
<click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="selectActionConditions"/>
94-
<waitForPageLoad stepKey="waitForDropDownOpened"/>
95-
<selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="Category" stepKey="selectAttribute"/>
96-
<waitForPageLoad stepKey="waitForOperatorOpened"/>
97-
<click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption1"/>
98-
<fillField selector="{{AdminCartPriceRulesFormSection.actionValue}}" userInput="$$createCategory.id$$" stepKey="fillActionValue"/>
99-
<click selector="{{AdminCartPriceRulesFormSection.applyAction}}" stepKey="applyAction"/>
100-
<click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/>
101-
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
78+
<createData entity="SalesRuleNoCouponWithFixedDiscount" stepKey="createCartPriceRule"/>
79+
<amOnPage url="{{AdminCartPriceRuleEditPage.url($$createCartPriceRule.rule_id$$)}}" stepKey="goToCartPriceRuleEditPage"/>
80+
<actionGroup ref="SetConditionForActionsInCartPriceRuleActionGroup" stepKey="setConditionForActionsInCartPriceRuleActionGroup">
81+
<argument name="actionValue" value="$$createCategory.id$$"/>
82+
</actionGroup>
10283
<!-- 2: Go to frontend and add an item from both CAT1 and CAT2 to your cart -->
10384
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToFrontend"/>
10485
<!-- 3: Open configurable product 1 and add all his child products to cart -->

0 commit comments

Comments
 (0)