Skip to content

Commit 03ab273

Browse files
committed
Merge remote-tracking branch 'origin/MC-20441' into 2.3-develop-mftf-pr23
2 parents 65763df + 882abef commit 03ab273

File tree

4 files changed

+179
-2
lines changed

4 files changed

+179
-2
lines changed

app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontProductCartActionGroup.xml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
<arguments>
104104
<argument name="subtotal" type="string"/>
105105
<argument name="shipping" type="string"/>
106-
<argument name="shippingMethod" type="string"/>
106+
<argument name="shippingMethod" type="string" defaultValue="Flat Rate - Fixed"/>
107107
<argument name="total" type="string"/>
108108
</arguments>
109109

@@ -112,6 +112,7 @@
112112
<conditionalClick selector="{{CheckoutCartSummarySection.shippingHeading}}" dependentSelector="{{CheckoutCartSummarySection.shippingMethodForm}}" visible="false" stepKey="openEstimateShippingSection"/>
113113
<waitForElementVisible selector="{{CheckoutCartSummarySection.flatRateShippingMethod}}" stepKey="waitForShippingSection"/>
114114
<checkOption selector="{{CheckoutCartSummarySection.flatRateShippingMethod}}" stepKey="selectShippingMethod"/>
115+
<scrollTo selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="scrollToSummary"/>
115116
<see userInput="{{subtotal}}" selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="assertSubtotal"/>
116117
<see userInput="({{shippingMethod}})" selector="{{CheckoutCartSummarySection.shippingMethod}}" stepKey="assertShippingMethod"/>
117118
<reloadPage stepKey="reloadPage" after="assertShippingMethod" />
@@ -146,4 +147,15 @@
146147
<fillField stepKey="fillZip" selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{taxCode.zip}}"/>
147148
<waitForPageLoad stepKey="waitForFormUpdate"/>
148149
</actionGroup>
149-
</actionGroups>
150+
151+
<actionGroup name="StorefrontCheckCartTotalWithDiscountCategoryActionGroup" extends="StorefrontCheckCartActionGroup">
152+
<annotations>
153+
<description>EXTENDS: StorefrontCheckCartActionGroup. Validates that the provided Discount is present in the Storefront Shopping Cart.</description>
154+
</annotations>
155+
<arguments>
156+
<argument name="discount" type="string"/>
157+
</arguments>
158+
<waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscount"/>
159+
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-${{discount}}" stepKey="assertDiscount"/>
160+
</actionGroup>
161+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontAddGroupedProductWithTwoLinksToCartActionGroup" extends="AddSimpleProductToCart">
12+
<annotations>
13+
<description>Adding to the Shopping Cart single Grouped product, with 2 associated from the Product page</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="linkedProduct1Name" type="string"/>
17+
<argument name="linkedProduct2Name" type="string"/>
18+
<argument name="linkedProduct1Qty" type="string" defaultValue="1"/>
19+
<argument name="linkedProduct2Qty" type="string" defaultValue="1"/>
20+
</arguments>
21+
<fillField selector="{{StorefrontProductPageSection.qtyInputWithProduct(linkedProduct1Name)}}" userInput="{{linkedProduct1Qty}}" before="addToCart" stepKey="fillQuantityForFirsProduct"/>
22+
<fillField selector="{{StorefrontProductPageSection.qtyInputWithProduct(linkedProduct2Name)}}" userInput="{{linkedProduct2Qty}}" after="fillQuantityForFirsProduct" stepKey="fillQuantityForSecondProduct"/>
23+
</actionGroup>
24+
</actionGroups>

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,28 @@
139139

140140
<click selector="{{AdminCartPriceRulesFormSection.active}}" stepKey="clickActiveToDisable" after="fillRuleName"/>
141141
</actionGroup>
142+
143+
<actionGroup name="AdminCreateCartPriceRuleWithConditionIsCategoryActionGroup" extends="AdminCreateCartPriceRuleActionGroup">
144+
<annotations>
145+
<description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Sets the provide Condition (Actions Aggregator/Value, Child Attribute and Action Value) for Actions on the Admin Cart Price Rule creation/edit page.</description>
146+
</annotations>
147+
<arguments>
148+
<argument name="actionsAggregator" type="string" defaultValue="ANY"/>
149+
<argument name="actionsValue" type="string" defaultValue="FALSE"/>
150+
<argument name="childAttribute" type="string" defaultValue="Category"/>
151+
<argument name="actionValue" type="string"/>
152+
</arguments>
153+
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" after="fillDiscountAmount" stepKey="clickOnActionTab"/>
154+
<click selector="{{AdminCartPriceRulesFormSection.condition('ALL')}}" after="clickOnActionTab" stepKey="clickToChooseFirstRuleConditionValue"/>
155+
<selectOption selector="{{AdminCartPriceRulesFormSection.actionsAggregator}}" userInput="{{actionsAggregator}}" after="clickToChooseFirstRuleConditionValue" stepKey="changeFirstRuleConditionValue"/>
156+
<click selector="{{AdminCartPriceRulesFormSection.condition('TRUE')}}" after="changeFirstRuleConditionValue" stepKey="clickToChooseSecondRuleConditionValue"/>
157+
<selectOption selector="{{AdminCartPriceRulesFormSection.actionsValue}}" userInput="{{actionsValue}}" after="clickToChooseSecondRuleConditionValue" stepKey="changeSecondRuleConditionValue"/>
158+
<click selector="{{AdminCartPriceRulesFormSection.conditions}}" after="changeSecondRuleConditionValue" stepKey="clickConditionDropDownMenu"/>
159+
<waitForPageLoad stepKey="waitForDropDownOpened"/>
160+
<selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{childAttribute}}" after="clickConditionDropDownMenu" stepKey="selectConditionAttributeIsCategory"/>
161+
<waitForPageLoad after="selectConditionAttributeIsCategory" stepKey="waitForOperatorOpened"/>
162+
<click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" after="waitForOperatorOpened" stepKey="clickToChooserIcon"/>
163+
<fillField selector="{{AdminCartPriceRulesFormSection.actionValue}}" userInput="{{actionValue}}" after="clickToChooserIcon" stepKey="choseNeededCategoryFromCategoryGrid"/>
164+
<click selector="{{AdminCartPriceRulesFormSection.applyAction}}" after="choseNeededCategoryFromCategoryGrid" stepKey="applyAction"/>
165+
</actionGroup>
142166
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
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="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest">
11+
<annotations>
12+
<features value="SalesRule"/>
13+
<stories value="Create cart price rule"/>
14+
<title value="Category rules should apply to grouped product with invisible individual products"/>
15+
<description value="Category rules should apply to grouped product with invisible individual products"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="MC-13608"/>
18+
<group value="SalesRule"/>
19+
</annotations>
20+
<before>
21+
<createData entity="ApiCategory" stepKey="createCategoryOne"/>
22+
<createData entity="ApiSimpleProduct" stepKey="createFirstSimpleProduct">
23+
<field key ="price">100</field>
24+
<field key="visibility">1</field>
25+
<requiredEntity createDataKey="createCategoryOne"/>
26+
</createData>
27+
<createData entity="ApiSimpleProduct" stepKey="createSecondSimpleProduct">
28+
<field key ="price">200</field>
29+
<field key="visibility">1</field>
30+
<requiredEntity createDataKey="createCategoryOne"/>
31+
</createData>
32+
<createData entity="ApiCategory" stepKey="createCategoryTwo"/>
33+
<createData entity="ApiSimpleProduct" stepKey="createThirdSimpleProduct">
34+
<field key ="price">300</field>
35+
<field key="visibility">1</field>
36+
<requiredEntity createDataKey="createCategoryTwo"/>
37+
</createData>
38+
<createData entity="ApiSimpleProduct" stepKey="createFourthSimpleProduct">
39+
<field key ="price">400</field>
40+
<field key="visibility">1</field>
41+
<requiredEntity createDataKey="createCategoryTwo"/>
42+
</createData>
43+
<createData entity="ApiGroupedProduct2" stepKey="createGroupedProduct">
44+
<requiredEntity createDataKey="createCategoryOne"/>
45+
</createData>
46+
<createData entity="OneSimpleProductLink" stepKey="addFirstProduct">
47+
<requiredEntity createDataKey="createGroupedProduct"/>
48+
<requiredEntity createDataKey="createFirstSimpleProduct"/>
49+
</createData>
50+
<updateData entity="OneMoreSimpleProductLink" createDataKey="addFirstProduct" stepKey="addSecondProduct">
51+
<requiredEntity createDataKey="createGroupedProduct"/>
52+
<requiredEntity createDataKey="createSecondSimpleProduct"/>
53+
</updateData>
54+
<createData entity="ApiGroupedProduct2" stepKey="createSecondGroupedProduct">
55+
<requiredEntity createDataKey="createCategoryTwo"/>
56+
</createData>
57+
<createData entity="OneSimpleProductLink" stepKey="addThirdProduct">
58+
<requiredEntity createDataKey="createSecondGroupedProduct"/>
59+
<requiredEntity createDataKey="createThirdSimpleProduct"/>
60+
</createData>
61+
<updateData entity="OneMoreSimpleProductLink" createDataKey="addThirdProduct" stepKey="addFourthProduct">
62+
<requiredEntity createDataKey="createSecondGroupedProduct"/>
63+
<requiredEntity createDataKey="createFourthSimpleProduct"/>
64+
</updateData>
65+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
66+
</before>
67+
<after>
68+
<deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
69+
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
70+
<deleteData createDataKey="createThirdSimpleProduct" stepKey="deleteThirdSimpleProduct"/>
71+
<deleteData createDataKey="createFourthSimpleProduct" stepKey="deleteFourthSimpleProduct"/>
72+
<deleteData createDataKey="createGroupedProduct" stepKey="deleteGroupedProduct"/>
73+
<deleteData createDataKey="createSecondGroupedProduct" stepKey="deleteSecondGroupedProduct"/>
74+
<deleteData createDataKey="createCategoryOne" stepKey="deleteCategoryOne"/>
75+
<deleteData createDataKey="createCategoryTwo" stepKey="deleteCategoryTwo"/>
76+
<actionGroup ref="AdminDeleteCartPriceRuleActionGroup" stepKey="deleteCartPriceRule">
77+
<argument name="ruleName" value="TestSalesRule"/>
78+
</actionGroup>
79+
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/>
80+
<actionGroup ref="logout" stepKey="logout"/>
81+
</after>
82+
<!-- Start to create new cart price rule via Category conditions -->
83+
<actionGroup ref="AdminCreateCartPriceRuleWithConditionIsCategoryActionGroup" stepKey="createCartPriceRuleWithCondition">
84+
<argument name="ruleName" value="TestSalesRule"/>
85+
<argument name="actionValue" value="$createCategoryTwo.id$"/>
86+
</actionGroup>
87+
<!-- Add SecondGroupedProduct to the cart -->
88+
<actionGroup ref="StorefrontAddGroupedProductWithTwoLinksToCartActionGroup" stepKey="addSecondGroupedProductToCart">
89+
<argument name="product" value="$createSecondGroupedProduct$"/>
90+
<argument name="linkedProduct1Name" value="$createThirdSimpleProduct.name$"/>
91+
<argument name="linkedProduct2Name" value="$createFourthSimpleProduct.name$"/>
92+
</actionGroup>
93+
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="openTheCartWithSecondGroupedProduct"/>
94+
<!-- Discount amount is not applied -->
95+
<actionGroup ref="StorefrontCheckCartActionGroup" stepKey="checkDiscountIsNotApplied">
96+
<argument name="subtotal" value="$700.00"/>
97+
<argument name="shipping" value="$10.00"/>
98+
<argument name="total" value="$710.00"/>
99+
</actionGroup>
100+
<!-- Discount is absent in cart subtotal -->
101+
<dontSeeElement selector="{{CheckoutCartSummarySection.discountLabel}}" stepKey="discountIsNotApplied"/>
102+
<!-- Add FirstGroupedProduct to the cart -->
103+
<actionGroup ref="StorefrontAddGroupedProductWithTwoLinksToCartActionGroup" stepKey="addFirsGroupedProductToCart">
104+
<argument name="product" value="$createGroupedProduct$"/>
105+
<argument name="linkedProduct1Name" value="$createFirstSimpleProduct.name$"/>
106+
<argument name="linkedProduct2Name" value="$createSecondSimpleProduct.name$"/>
107+
</actionGroup>
108+
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="openTheCartWithFirstAndSecondGroupedProducts"/>
109+
<!-- Discount amount is applied for product from first category only -->
110+
<actionGroup ref="StorefrontCheckCartTotalWithDiscountCategoryActionGroup" stepKey="checkDiscountIsApplied">
111+
<argument name="subtotal" value="$1,000.00"/>
112+
<argument name="shipping" value="$20.00"/>
113+
<argument name="discount" value="150.00"/>
114+
<argument name="total" value="$870.00"/>
115+
</actionGroup>
116+
</test>
117+
</tests>

0 commit comments

Comments
 (0)