Skip to content

Commit 8dd4612

Browse files
Merge branch '2.4-develop' into functiona-tests-mainline-deployment-1
2 parents 9e690ba + 9335934 commit 8dd4612

File tree

2 files changed

+148
-0
lines changed

2 files changed

+148
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
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="AdminCreateCartPriceRuleWithConditionsAndDiscountActionGroup" extends="AdminCreateCartPriceRuleActionGroup">
12+
<annotations>
13+
<description>EXTENDS: AdminCreateCartPriceRuleActionGroup. Removes 'fillDiscountAmount'. Adds the 2 provided Conditions (Name, Rule, Rule to Change and Category Name) to a Cart Price Rule.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="condition1" type="string" defaultValue="Products subselection"/>
17+
<argument name="condition2" type="string" defaultValue="Category"/>
18+
<argument name="ruleToChange1" type="string" defaultValue="is"/>
19+
<argument name="rule1" type="string" defaultValue="equals or greater than"/>
20+
<argument name="ruleToChange2" type="string" defaultValue="..."/>
21+
<argument name="rule2" type="string" defaultValue="2"/>
22+
<argument name="categoryName" type="string" defaultValue="_defaultCategory.name"/>
23+
</arguments>
24+
25+
<!--Go to Conditions section-->
26+
<click selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="openConditionsSection" after="selectActionType"/>
27+
<click selector="{{AdminCartPriceRulesFormSection.addCondition('1')}}" stepKey="addFirstCondition" after="openConditionsSection"/>
28+
<selectOption selector="{{AdminCartPriceRulesFormSection.ruleCondition('1')}}" userInput="{{condition1}}" stepKey="selectRule" after="addFirstCondition"/>
29+
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange1)}}" stepKey="waitForFirstRuleElement" after="selectRule"/>
30+
<click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange1)}}" stepKey="clickToChangeRule" after="waitForFirstRuleElement"/>
31+
<selectOption selector="{{AdminCartPriceRulesFormSection.ruleParameterSelect('1--1')}}" userInput="{{rule1}}" stepKey="selectRule1" after="clickToChangeRule"/>
32+
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="waitForSecondRuleElement" after="selectRule1"/>
33+
<click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="clickToChangeRule1" after="waitForSecondRuleElement"/>
34+
<fillField selector="{{AdminCartPriceRulesFormSection.ruleParameterInput('1--1')}}" userInput="{{rule2}}" stepKey="fillRule" after="clickToChangeRule1"/>
35+
<click selector="{{AdminCartPriceRulesFormSection.addCondition('1--1')}}" stepKey="addSecondCondition" after="fillRule"/>
36+
<selectOption selector="{{AdminCartPriceRulesFormSection.ruleCondition('1--1')}}" userInput="{{condition2}}" stepKey="selectSecondCondition" after="addSecondCondition"/>
37+
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="waitForThirdRuleElement" after="selectSecondCondition"/>
38+
<click selector="{{AdminCartPriceRulesFormSection.ruleParameter(ruleToChange2)}}" stepKey="addThirdCondition" after="waitForThirdRuleElement"/>
39+
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.openChooser('1--1--1')}}" stepKey="waitForForthRuleElement" after="addThirdCondition"/>
40+
<click selector="{{AdminCartPriceRulesFormSection.openChooser('1--1--1')}}" stepKey="openChooser" after="waitForForthRuleElement"/>
41+
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="waitForCategoryVisible" after="openChooser"/>
42+
<checkOption selector="{{AdminCartPriceRulesFormSection.categoryCheckbox(categoryName)}}" stepKey="checkCategoryName" after="waitForCategoryVisible"/>
43+
</actionGroup>
44+
</actionGroups>
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontCartPriceRuleOverCategoryAndQuantityTest">
12+
<annotations>
13+
<features value="SalesRule"/>
14+
<stories value="Create cart price rule"/>
15+
<title value="Customer should see cart price rule discount for greater than quantity and parent category for the product"/>
16+
<description value="Customer should see cart price rule discount for greater than quantity and parent category for the product"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="AC-13476"/>
19+
<useCaseId value="ACP2E-3456"/>
20+
<group value="SalesRule"/>
21+
</annotations>
22+
23+
<before>
24+
<!-- Create category -->
25+
<createData entity="_defaultCategory" stepKey="defaultCategory"/>
26+
27+
<!-- Admin Login -->
28+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
29+
30+
<!--Create cart price rule-->
31+
<actionGroup ref="AdminCreateCartPriceRuleWithConditionsAndDiscountActionGroup" stepKey="createRule">
32+
<argument name="ruleName" value="TestSalesRule"/>
33+
<argument name="condition1" value="Products subselection"/>
34+
<argument name="condition2" value="Category"/>
35+
<argument name="ruleToChange1" value="is"/>
36+
<argument name="rule1" value="equals or greater than"/>
37+
<argument name="ruleToChange2" value="..."/>
38+
<argument name="rule2" value="3"/>
39+
<argument name="categoryName" value="{{_defaultCategory.name}}"/>
40+
</actionGroup>
41+
42+
<!-- Create subcategories -->
43+
<createData entity="SubCategoryWithParent" stepKey="subcategory2">
44+
<requiredEntity createDataKey="defaultCategory"/>
45+
</createData>
46+
<createData entity="SubCategoryWithParent" stepKey="subcategory3">
47+
<requiredEntity createDataKey="subcategory2"/>
48+
</createData>
49+
50+
<!-- Create product and assign to subcategory -->
51+
<createData entity="_defaultProduct" stepKey="createSimpleProduct">
52+
<requiredEntity createDataKey="subcategory3"/>
53+
</createData>
54+
</before>
55+
56+
<after>
57+
<!-- Delete created cart price rule -->
58+
<actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCartPriceRule">
59+
<argument name="ruleName" value="{{TestSalesRule.name}}"/>
60+
</actionGroup>
61+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilters"/>
62+
63+
<!-- Delete created category and product -->
64+
<deleteData createDataKey="defaultCategory" stepKey="deleteDefaultCategory"/>
65+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
66+
67+
<!-- Admin Logout -->
68+
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/>
69+
</after>
70+
71+
<!--Go to Storefront and add product to cart and checkout from cart-->
72+
<amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/>
73+
<waitForPageLoad stepKey="waitForProductPage" />
74+
<fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="3" stepKey="setQuantity"/>
75+
<actionGroup ref="StorefrontAddToCartCustomOptionsProductPageActionGroup" stepKey="AddProductToCard">
76+
<argument name="productName" value="$$createSimpleProduct.name$$"/>
77+
</actionGroup>
78+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
79+
<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShipping"/>
80+
81+
<!--Check totals-->
82+
<grabTextFrom selector="{{CheckoutPaymentSection.orderSummarySubtotal}}" stepKey="grabSubtotal"/>
83+
<grabTextFrom selector="{{CheckoutPaymentSection.discountPrice}}" stepKey="grabDiscount"/>
84+
<grabTextFrom selector="{{CheckoutPaymentSection.orderSummaryShippingTotal}}" stepKey="grabShippingTotal"/>
85+
<grabTextFrom selector="{{CheckoutPaymentSection.orderSummaryTotal}}" stepKey="grabTotal"/>
86+
87+
<assertEquals stepKey="assertSubtotal">
88+
<expectedResult type="string">$369.00</expectedResult>
89+
<actualResult type="variable">$grabSubtotal</actualResult>
90+
</assertEquals>
91+
<assertEquals stepKey="assertDiscount">
92+
<expectedResult type="string">-$184.50</expectedResult>
93+
<actualResult type="variable">$grabDiscount</actualResult>
94+
</assertEquals>
95+
<assertEquals stepKey="assertShippingTotal">
96+
<expectedResult type="string">$15.00</expectedResult>
97+
<actualResult type="variable">$grabShippingTotal</actualResult>
98+
</assertEquals>
99+
<assertEquals stepKey="assertTotal">
100+
<expectedResult type="string">$199.50</expectedResult>
101+
<actualResult type="variable">$grabTotal</actualResult>
102+
</assertEquals>
103+
</test>
104+
</tests>

0 commit comments

Comments
 (0)