Skip to content

Commit c7552db

Browse files
committed
ACQE-6734 : Verify dynamic bundle product prices with different Cart Rules on storefront
Created testcase for Verify discount on dynamic-priced Bundle Product when associated Products are assigned to Categories with different Cart Rules
1 parent d290f35 commit c7552db

File tree

5 files changed

+208
-1
lines changed

5 files changed

+208
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontVerifyDiscountOnDynamicBundleProductDifferentCartRulesTest">
12+
<annotations>
13+
<features value="Bundle"/>
14+
<stories value="Discount on dynamic bundle products with different Cart Rules"/>
15+
<title value="Verify dynamic bundle product prices with different Cart Rules on storefront"/>
16+
<description value="Verify discount on dynamic-priced Bundle Product when associated Products are assigned to Categories with different Cart Rules"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-4709"/>
19+
</annotations>
20+
<before>
21+
<createData entity="SimpleSubCategory" stepKey="createFirstCategory"/>
22+
<createData entity="SimpleSubCategory" stepKey="createSecondCategory"/>
23+
<!--Create two simple product-->
24+
<createData entity="ApiSimpleProduct" stepKey="simpleProduct1">
25+
<requiredEntity createDataKey="createFirstCategory"/>
26+
<field key="price">99.99</field>
27+
</createData>
28+
<createData entity="ApiSimpleProduct" stepKey="simpleProduct2">
29+
<requiredEntity createDataKey="createSecondCategory"/>
30+
<field key="price">34.49</field>
31+
</createData>
32+
<!--Create Bundle product-->
33+
<createData entity="ApiBundleProductPriceViewRange" stepKey="createBundleProduct">
34+
<requiredEntity createDataKey="createFirstCategory"/>
35+
</createData>
36+
<createData entity="MultipleSelectOption" stepKey="createBundleOption1">
37+
<requiredEntity createDataKey="createBundleProduct"/>
38+
<field key="required">true</field>
39+
</createData>
40+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct">
41+
<requiredEntity createDataKey="createBundleProduct"/>
42+
<requiredEntity createDataKey="createBundleOption1"/>
43+
<requiredEntity createDataKey="simpleProduct1"/>
44+
</createData>
45+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct2">
46+
<requiredEntity createDataKey="createBundleProduct"/>
47+
<requiredEntity createDataKey="createBundleOption1"/>
48+
<requiredEntity createDataKey="simpleProduct2"/>
49+
</createData>
50+
</before>
51+
<after>
52+
<deleteData createDataKey="createFirstCategory" stepKey="deleteFirstCategory"/>
53+
<deleteData createDataKey="createSecondCategory" stepKey="deleteSecondCategory"/>
54+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
55+
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
56+
<deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/>
57+
<actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCartPriceRule">
58+
<argument name="ruleName" value="{{CustomSalesRuleWithNoCouponCode.name}}"/>
59+
</actionGroup>
60+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
61+
</after>
62+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
63+
<!-- Create cart price rule -->
64+
<actionGroup ref="AdminCreateCartPriceRuleActionGroup" stepKey="createCartPriceRule">
65+
<argument name="ruleName" value="CustomSalesRuleWithNoCouponCode"/>
66+
</actionGroup>
67+
<!-- Search and go to cart price rule page -->
68+
<actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="filterCreatedCartPriceRule">
69+
<argument name="ruleName" value="CustomSalesRuleWithNoCouponCode.name"/>
70+
</actionGroup>
71+
<actionGroup ref="AdminCreateCustomConditionInCartPriceRuleActionGroup" stepKey="createCustomCondition"/>
72+
<actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="saveAndAssertCartPriceRuleSuccessSaveMessage"/>
73+
<!-- Open Bundle Product page on storefront-->
74+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openBundleProductPage">
75+
<argument name="productUrl" value="$createBundleProduct.custom_attributes[url_key]$"/>
76+
</actionGroup>
77+
<!-- Click on customize And Add To Cart Button -->
78+
<actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickOnCustomizeAndAddToCartButton"/>
79+
<!-- Select Two Products, enter the quantity and add product to the cart -->
80+
<selectOption selector="{{StorefrontBundledSection.multiSelectOption}}" parameterArray="[$$simpleProduct1.name$$ +$99.99, $$simpleProduct2.name$$ +$34.49]" stepKey="selectOptions"/>
81+
<actionGroup ref="StorefrontEnterProductQuantityAndAddToTheCartActionGroup" stepKey="enterProductQuantityAndAddToTheCart">
82+
<argument name="quantity" value="1"/>
83+
</actionGroup>
84+
<!-- Go to shopping cart page -->
85+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openShoppingCartPage"/>
86+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal">
87+
<argument name="discount" value="13.45"/>
88+
</actionGroup>
89+
<!-- Search and go to cart price rule page and remove condition-->
90+
<actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="goToCartPriceRulePage"/>
91+
<actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="filterCartPriceRule">
92+
<argument name="ruleName" value="CustomSalesRuleWithNoCouponCode.name"/>
93+
</actionGroup>
94+
<scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToConditionsHeader"/>
95+
<conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/>
96+
<waitForElementClickable selector="{{AdminCartPriceRulesFormSection.removeCondition('1--1')}}" stepKey="waitForRemoveToBeClickable"/>
97+
<click selector="{{AdminCartPriceRulesFormSection.removeCondition('1--1')}}" stepKey="removeCondition"/>
98+
<actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="saveCartPriceRuleSuccessSaveMessage"/>
99+
<!-- Go to shopping cart page -->
100+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToShoppingCartPage"/>
101+
<actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="checkDiscount">
102+
<argument name="discount" value="13.45"/>
103+
</actionGroup>
104+
<!-- Assign category 1 to simple product 2 and unAssign category2 -->
105+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="OpenSimpleProductPage">
106+
<argument name="productId" value="$$simpleProduct2.id$$"/>
107+
</actionGroup>
108+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
109+
<actionGroup ref="AdminUnassignCategoryOnProductAndSaveActionGroup" stepKey="unAssignCategoryTwo">
110+
<argument name="categoryName" value="$$createSecondCategory.name$$"/>
111+
</actionGroup>
112+
<createData entity="AssignProductToCategory" stepKey="assignCategoryOne">
113+
<requiredEntity createDataKey="createFirstCategory"/>
114+
<requiredEntity createDataKey="simpleProduct2"/>
115+
</createData>
116+
<!-- Search and go to cart price rule page and add condition in action tab -->
117+
<actionGroup ref="AdminOpenCartPriceRulesPageActionGroup" stepKey="againOpenCartPriceRulePage"/>
118+
<actionGroup ref="AdminFilterCartPriceRuleActionGroup" stepKey="againFilterCartPriceRule">
119+
<argument name="ruleName" value="CustomSalesRuleWithNoCouponCode.name"/>
120+
</actionGroup>
121+
<actionGroup ref="AdminCreateCustomConditionInActionTabInCartPriceRuleActionGroup" stepKey="createConditionInActionsTab"/>
122+
<actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="saveCartPriceRule"/>
123+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
124+
<argument name="indices" value="catalogsearch_fulltext catalog_category_product catalog_product_price catalogrule_rule"/>
125+
</actionGroup>
126+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
127+
<argument name="tags" value="config full_page"/>
128+
</actionGroup>
129+
<!-- Go to shopping cart page -->
130+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="againGoToShoppingCartPage"/>
131+
<waitForElementNotVisible selector="{{CheckoutCartSummarySection.discountLabel}}" stepKey="discountIsNotApply"/>
132+
</test>
133+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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="AdminCreateCustomConditionInActionTabInCartPriceRuleActionGroup">
12+
<annotations>
13+
<description>Create custom condition in action tab in cart price rule page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productAttribute" type="string" defaultValue="Category"/>
17+
<argument name="categoryId" type="string" defaultValue="$$createSecondCategory.id$$"/>
18+
</arguments>
19+
20+
<conditionalClick selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.actionsHeaderOpen}}" visible="false" stepKey="clickToExpandActions"/>
21+
<scrollTo selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="scrollToActionsFieldset"/>
22+
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.apply}}" stepKey="waitActionsFieldsetFullyOpened"/>
23+
<click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="clickAdd"/>
24+
<waitForPageLoad stepKey="waitForDropDownOpened"/>
25+
<selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{productAttribute}}" stepKey="selectConditionAttributeIsCategory"/>
26+
<waitForPageLoad after="selectConditionAttributeIsCategory" stepKey="waitForOperatorOpened"/>
27+
<click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooserIcon"/>
28+
<fillField selector="{{AdminCartPriceRulesFormSection.actionValue}}" userInput="{{categoryId}}" stepKey="choseNeededCategoryFromCategoryGrid"/>
29+
<click selector="{{AdminCartPriceRulesFormSection.applyAction}}" stepKey="applyAction"/>
30+
</actionGroup>
31+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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="AdminCreateCustomConditionInCartPriceRuleActionGroup">
12+
<annotations>
13+
<description>Create custom condition in cart price rule page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="condition" type="string" defaultValue="Product attribute combination"/>
17+
<argument name="productAttribute" type="string" defaultValue="Category"/>
18+
<argument name="categoryId" type="string" defaultValue="$$createFirstCategory.id$$"/>
19+
</arguments>
20+
21+
<scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToConditionsHeader"/>
22+
<conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" visible="true" stepKey="clickToExpandConditions"/>
23+
<click selector="{{AdminCartPriceRulesFormSection.addNewCondition('1')}}" stepKey="clickOnAddNewCondition"/>
24+
<selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelectDropdown('1')}}" userInput="{{condition}}" stepKey="selectProductAttributeCombination"/>
25+
<waitForPageLoad stepKey="waitForConditionLoad"/>
26+
<waitForElementClickable selector="{{AdminCartPriceRulesFormSection.addNewCondition('1--1')}}" stepKey="waitForAddNewConditionToBeClickable"/>
27+
<click selector="{{AdminCartPriceRulesFormSection.addNewCondition('1--1')}}" stepKey="clickOnTheAddNewCondition"/>
28+
<waitForPageLoad stepKey="waitForToggleLoad"/>
29+
<selectOption selector="{{AdminCartPriceRulesFormSection.conditionSelectDropdown('1--1')}}" userInput="{{productAttribute}}" stepKey="selectCategory"/>
30+
<waitForElementClickable selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="waitForEllipsis"/>
31+
<click selector="{{AdminCartPriceRulesFormSection.targetEllipsis}}" stepKey="clickOnEllipsis"/>
32+
<waitForElementVisible selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1--1')}}" stepKey="waitForCategoryToBeVisible"/>
33+
<fillField selector="{{AdminCartPriceRulesFormSection.ruleFieldByIndex('1--1--1')}}" userInput="{{categoryId}}" stepKey="fillCategoryId"/>
34+
</actionGroup>
35+
</actionGroups>

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,4 +669,11 @@
669669
<data key="uses_per_coupon">2</data>
670670
<data key="simple_free_shipping">0</data>
671671
</entity>
672-
</entities>
672+
<entity name="CustomSalesRuleWithNoCouponCode" type="SalesRule">
673+
<data key="name" unique="suffix">SalesRule</data>
674+
<data key="websites">Main Website</data>
675+
<data key="customerGroups">'NOT LOGGED IN', 'General', 'Wholesale', 'Retailer'</data>
676+
<data key="apply">Percent of product price discount</data>
677+
<data key="discountAmount">10</data>
678+
</entity>
679+
</entities>

app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
<element name="addNewCondition" type="button" selector="//ul[@id = 'conditions__{{nestedIndex}}__children']/li/span[contains(@class, 'rule-param-new-child')]" parameterized="true" timeout="30"/>
5858
<element name="conditionSelectDropdown" type="select" selector="select[name='rule[conditions][{{nestedIndex}}][new_child]']" parameterized="true"/>
5959
<element name="selectCountryDropdown" type="select" selector="(//*[contains(@value,'country_id')]/..//select)[last()]"/>
60+
<element name="removeCondition" type="select" selector="//input[@id='conditions__{{index}}__type']/following-sibling::span//a[@class='rule-param-remove']" parameterized="true"/>
6061

6162
<!--Conditions checker -->
6263
<element name="openList" type="button" selector="a.rule-chooser-trigger>img.v-middle.rule-chooser-trigger"/>

0 commit comments

Comments
 (0)