Skip to content

Commit 5815a5d

Browse files
committed
ACQE-4085 : Check price for dynamic bundle product with mixed discounts
The testcase purpose to verify mixed discount prices for bundle product on storefront
1 parent 995a05c commit 5815a5d

File tree

3 files changed

+210
-0
lines changed

3 files changed

+210
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
2+
<?xml version="1.0" encoding="UTF-8"?>
3+
<!--
4+
/**
5+
* Copyright © Magento, Inc. All rights reserved.
6+
* See COPYING.txt for license details.
7+
*/
8+
-->
9+
10+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
12+
<test name="StorefrontCheckPriceForDynamicBundleProductWithMixedDiscountsTest">
13+
<annotations>
14+
<features value="Bundle"/>
15+
<stories value="View bundle product"/>
16+
<title value="Check mixed discount prices for bundle product"/>
17+
<description value="The testcase purpose to verify mixed discount prices for bundle product on storefront"/>
18+
<testCaseId value="AC-4571"/>
19+
<severity value="MAJOR"/>
20+
</annotations>
21+
<before>
22+
<!-- create three categories-->
23+
<createData entity="_defaultCategory" stepKey="category1"/>
24+
<createData entity="_defaultCategory" stepKey="category2"/>
25+
<createData entity="_defaultCategory" stepKey="category3"/>
26+
<!-- login to backend -->
27+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
28+
<actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="clearExistingCatalogPriceRules"/>
29+
<!-- create two catalog rules for categories -->
30+
<!-- first catalog rule -->
31+
<actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="openNewCatalogPriceRulePage"/>
32+
<actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForCatalogPriceRule"/>
33+
<actionGroup ref="AdminFillCatalogRuleConditionActionGroup" stepKey="fillConditionsForCatalogPriceRule">
34+
<argument name="conditionValue" value="$category2.id$"/>
35+
</actionGroup>
36+
<actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForCatalogPriceRule">
37+
<argument name="apply" value="by_percent"/>
38+
<argument name="discountAmount" value="100"/>
39+
</actionGroup>
40+
<actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyFirstPriceRule"/>
41+
<!-- second catalog rule -->
42+
<actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="openAgainNewCatalogPriceRulePage"/>
43+
<actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForSecondCatalogPriceRule"/>
44+
<actionGroup ref="AdminFillCatalogRuleConditionActionGroup" stepKey="fillConditionsForSecondCatalogPriceRule">
45+
<argument name="conditionValue" value="$category3.id$"/>
46+
</actionGroup>
47+
<actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForSecondCatalogPriceRule">
48+
<argument name="apply" value="by_percent"/>
49+
<argument name="discountAmount" value="70"/>
50+
</actionGroup>
51+
<actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplySecondPriceRule"/>
52+
<!-- create 6 simple products -->
53+
<!-- create first product -->
54+
<createData entity="_defaultProduct" stepKey="firstProduct">
55+
<field key="price">10.5</field>
56+
<field key="quantity">1000</field>
57+
<requiredEntity createDataKey="category1"/>
58+
</createData>
59+
<createData entity="tierPriceForSimpleProduct" stepKey="addTierPrice">
60+
<requiredEntity createDataKey="firstProduct"/>
61+
</createData>
62+
<!-- create second product -->
63+
<createData entity="SimpleProduct4" stepKey="secondProduct">
64+
<field key="price">15</field>
65+
<requiredEntity createDataKey="category2"/>
66+
</createData>
67+
<!-- create third product -->
68+
<createData entity="_defaultProduct" stepKey="thirdProduct">
69+
<field key="price">23.40</field>
70+
<field key="quantity">1000</field>
71+
<requiredEntity createDataKey="category1"/>
72+
</createData>
73+
<createData entity="specialProductPriceForProduct" stepKey="addSpecialPrice">
74+
<requiredEntity createDataKey="thirdProduct"/>
75+
</createData>
76+
<!-- create fourth product -->
77+
<createData entity="_defaultProduct" stepKey="fourthProduct">
78+
<field key="price">30</field>
79+
<field key="quantity">1000</field>
80+
<requiredEntity createDataKey="category3"/>
81+
</createData>
82+
<!-- create fifth product -->
83+
<createData entity="_defaultProduct" stepKey="fifthProduct">
84+
<field key="price">25</field>
85+
<field key="status">0</field>
86+
<field key="quantity">1000</field>
87+
<requiredEntity createDataKey="category1"/>
88+
</createData>
89+
<!-- create sixth product -->
90+
<createData entity="_defaultProduct" stepKey="sixthProduct">
91+
<field key="price">25</field>
92+
<field key="quantity">1000</field>
93+
<requiredEntity createDataKey="category1"/>
94+
</createData>
95+
<createData entity="specialProductPriceForSimpleProduct" stepKey="addSpecialPriceForSixthProduct">
96+
<requiredEntity createDataKey="sixthProduct"/>
97+
</createData>
98+
<!--Create Bundle product -->
99+
<createData entity="ApiBundleProductPriceViewRange" stepKey="createBundleProduct">
100+
<requiredEntity createDataKey="category1"/>
101+
</createData>
102+
<!-- Add options to the product -->
103+
<createData entity="MultipleSelectOption" stepKey="createBundleOption1_1">
104+
<requiredEntity createDataKey="createBundleProduct"/>
105+
<field key="required">false</field>
106+
</createData>
107+
<createData entity="DropDownBundleOption" stepKey="createBundleOption1_2">
108+
<requiredEntity createDataKey="createBundleProduct"/>
109+
<field key="required">false</field>
110+
</createData>
111+
<!-- add products to checkbox option -->
112+
<createData entity="ApiBundleLink" stepKey="linkOptionToFifthProduct">
113+
<requiredEntity createDataKey="createBundleProduct"/>
114+
<requiredEntity createDataKey="createBundleOption1_2"/>
115+
<requiredEntity createDataKey="fifthProduct"/>
116+
<field key="qty">1</field>
117+
</createData>
118+
<createData entity="ApiBundleLink" stepKey="linkOptionToFourthProduct">
119+
<requiredEntity createDataKey="createBundleProduct"/>
120+
<requiredEntity createDataKey="createBundleOption1_2"/>
121+
<requiredEntity createDataKey="fourthProduct"/>
122+
<field key="qty">3</field>
123+
</createData>
124+
<createData entity="ApiBundleLink" stepKey="linkOptionToSixthProduct">
125+
<requiredEntity createDataKey="createBundleProduct"/>
126+
<requiredEntity createDataKey="createBundleOption1_2"/>
127+
<requiredEntity createDataKey="sixthProduct"/>
128+
<field key="qty">1</field>
129+
</createData>
130+
<!-- add products to multiselect option -->
131+
<createData entity="ApiBundleLink" stepKey="linkOptionToSecondProduct">
132+
<requiredEntity createDataKey="createBundleProduct"/>
133+
<requiredEntity createDataKey="createBundleOption1_1"/>
134+
<requiredEntity createDataKey="secondProduct"/>
135+
<field key="qty">3</field>
136+
</createData>
137+
<createData entity="ApiBundleLink" stepKey="linkOptionToFirstProduct">
138+
<requiredEntity createDataKey="createBundleProduct"/>
139+
<requiredEntity createDataKey="createBundleOption1_1"/>
140+
<requiredEntity createDataKey="firstProduct"/>
141+
<field key="qty">2</field>
142+
</createData>
143+
<createData entity="ApiBundleLink" stepKey="linkOptionToThirdProduct">
144+
<requiredEntity createDataKey="createBundleProduct"/>
145+
<requiredEntity createDataKey="createBundleOption1_1"/>
146+
<requiredEntity createDataKey="thirdProduct"/>
147+
<field key="qty">1</field>
148+
</createData>
149+
<!-- Add advanced pricing to bundle product -->
150+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductForEdit">
151+
<argument name="productId" value="$createBundleProduct.id$"/>
152+
</actionGroup>
153+
<actionGroup ref="AdminBundleProductSetAdvancedPricingActionGroup" stepKey="addProductTierPrice">
154+
<argument name="quantity" value="1"/>
155+
<argument name="price" value="Discount"/>
156+
<argument name="amount" value="75"/>
157+
<argument name="priceView" value="Price Range"/>
158+
</actionGroup>
159+
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
160+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexInvalidatedIndices">
161+
<argument name="indices" value="catalogsearch_fulltext catalog_category_product catalog_product_price catalogrule_rule"/>
162+
</actionGroup>
163+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
164+
<argument name="tags" value="full_page"/>
165+
</actionGroup>
166+
</before>
167+
<after>
168+
<!-- delete created data -->
169+
<deleteData createDataKey="firstProduct" stepKey="deleteFirstProduct"/>
170+
<deleteData createDataKey="secondProduct" stepKey="deleteSecondProduct"/>
171+
<deleteData createDataKey="thirdProduct" stepKey="deleteThirdProduct"/>
172+
<deleteData createDataKey="fourthProduct" stepKey="deleteFourthProduct"/>
173+
<deleteData createDataKey="fifthProduct" stepKey="deleteFifthProduct"/>
174+
<deleteData createDataKey="sixthProduct" stepKey="deleteSixthProduct"/>
175+
<deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/>
176+
<actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteCatalogPriceRules"/>
177+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
178+
</after>
179+
<!-- Go to storefront category page -->
180+
<!-- check product prices on category and product page -->
181+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="amOnCategoryPage">
182+
<argument name="category" value="$$category1$$"/>
183+
</actionGroup>
184+
<waitForText userInput="From $4.69 Regular Price $21.00" selector="{{StorefrontCategoryProductSection.priceFromByProductId($$createBundleProduct.id$$)}}" stepKey="seePriceFromInCategoryBundle"/>
185+
<waitForText userInput="To $16.44 Regular Price $134.40" selector="{{StorefrontCategoryProductSection.priceToByProductId($$createBundleProduct.id$$)}}" stepKey="seePriceToInCategoryBundle"/>
186+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openBundleProductPage">
187+
<argument name="productUrl" value="$$createBundleProduct.custom_attributes[url_key]$$"/>
188+
</actionGroup>
189+
<waitForElement selector="{{StorefrontProductInfoMainSection.priceFrom('From $4.69 Regular Price $21.00')}}" stepKey="seePriceFromBundle"/>
190+
<waitForElement selector="{{StorefrontProductInfoMainSection.priceTo('To $16.44 Regular Price $134.40')}}" stepKey="seePriceToBundle"/>
191+
</test>
192+
</tests>

app/code/Magento/Catalog/Test/Mftf/Data/CatalogSpecialPriceData.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,14 @@
2323
<data key="store_id">0</data>
2424
<var key="sku" entityType="product" entityKey="sku" />
2525
</entity>
26+
<entity name="specialProductPriceForProduct" type="catalogSpecialPrice">
27+
<data key="price">18.77</data>
28+
<data key="store_id">0</data>
29+
<var key="sku" entityType="product" entityKey="sku" />
30+
</entity>
31+
<entity name="specialProductPriceForSimpleProduct" type="catalogSpecialPrice">
32+
<data key="price">19.99</data>
33+
<data key="store_id">0</data>
34+
<var key="sku" entityType="product" entityKey="sku" />
35+
</entity>
2636
</entities>

app/code/Magento/Catalog/Test/Mftf/Data/TierPriceData.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,12 @@
100100
<data key="customer_group">General</data>
101101
<data key="quantity">3</data>
102102
</entity>
103+
<entity name="tierPriceForSimpleProduct" type="catalogTierPrice">
104+
<data key="price">9.99</data>
105+
<data key="price_type">fixed</data>
106+
<data key="website_id">0</data>
107+
<data key="customer_group">ALL GROUPS</data>
108+
<data key="quantity">1</data>
109+
<var key="sku" entityType="product" entityKey="sku" />
110+
</entity>
103111
</entities>

0 commit comments

Comments
 (0)