Skip to content

Commit 44af436

Browse files
committed
MFTF Test cases added
1 parent d2d473a commit 44af436

File tree

1 file changed

+208
-0
lines changed

1 file changed

+208
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
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="AdminCheckConfigurableProductPriceWhenChildProductPriceUpdatedTest">
11+
<annotations>
12+
<stories value="Configurable Product"/>
13+
<title value="Check price of configurable product when one child product price is updated"/>
14+
<description value="Login as admin and check the configurable product price when one child product child product price is updated"/>
15+
<severity value="CRITICAL"/>
16+
<group value="product"/>
17+
</annotations>
18+
<before>
19+
<!-- Login as Admin -->
20+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/>
21+
22+
<!-- Create Default Category -->
23+
<createData entity="_defaultCategory" stepKey="createCategory"/>
24+
25+
<!-- Create an attribute with two options to be used in the child product -->
26+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
27+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
28+
<requiredEntity createDataKey="createConfigProductAttribute"/>
29+
</createData>
30+
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
31+
<requiredEntity createDataKey="createConfigProductAttribute"/>
32+
</createData>
33+
34+
<!-- Add the attribute just created to default attribute set -->
35+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
36+
<requiredEntity createDataKey="createConfigProductAttribute"/>
37+
</createData>
38+
39+
<!-- Get the first option of the attribute created -->
40+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
41+
<requiredEntity createDataKey="createConfigProductAttribute"/>
42+
</getData>
43+
44+
<!-- Get the second option of the attribute created -->
45+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
46+
<requiredEntity createDataKey="createConfigProductAttribute"/>
47+
</getData>
48+
49+
<!-- Create Configurable product -->
50+
<createData entity="BaseConfigurableProduct" stepKey="createConfigProduct">
51+
<requiredEntity createDataKey="createCategory"/>
52+
</createData>
53+
54+
<!-- Create a simple product and give it the attribute with the first option -->
55+
<createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1">
56+
<requiredEntity createDataKey="createConfigProductAttribute"/>
57+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
58+
<field key="price">10.00</field>
59+
</createData>
60+
61+
<!--Create a simple product and give it the attribute with the second option -->
62+
<createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2">
63+
<requiredEntity createDataKey="createConfigProductAttribute"/>
64+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
65+
<field key="price">20.00</field>
66+
</createData>
67+
68+
<!-- Create the configurable product -->
69+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
70+
<requiredEntity createDataKey="createConfigProduct"/>
71+
<requiredEntity createDataKey="createConfigProductAttribute"/>
72+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
73+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
74+
</createData>
75+
76+
<!-- Add the first simple product to the configurable product -->
77+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
78+
<requiredEntity createDataKey="createConfigProduct"/>
79+
<requiredEntity createDataKey="createConfigChildProduct1"/>
80+
</createData>
81+
82+
<!-- Add the second simple product to the configurable product -->
83+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
84+
<requiredEntity createDataKey="createConfigProduct"/>
85+
<requiredEntity createDataKey="createConfigChildProduct2"/>
86+
</createData>
87+
88+
<!--Open Index Management Page and Select Index mode "Update by Schedule" -->
89+
<magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" />
90+
91+
<!-- Run cron -->
92+
<magentoCron stepKey="runIndexCronJobs" groups="index"/>
93+
<comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCache"/>
94+
95+
<!-- Wait till cron job runs for schedule updates -->
96+
<wait time="60" stepKey="waitForUpdateStarts"/>
97+
</before>
98+
<after>
99+
<!-- Delete Created Data -->
100+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
101+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
102+
<deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/>
103+
<deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/>
104+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteAttribute"/>
105+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
106+
107+
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
108+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
109+
</after>
110+
111+
<!-- Open Product in Store Front Page -->
112+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront">
113+
<argument name="product" value="$createConfigProduct$"/>
114+
</actionGroup>
115+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad"/>
116+
117+
<!-- Verify category,Configurable product and initial price -->
118+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage">
119+
<argument name="categoryName" value="$$createCategory.name$$"/>
120+
</actionGroup>
121+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront">
122+
<argument name="productName" value="$$createConfigProduct.name$$"/>
123+
</actionGroup>
124+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeInitialPriceInStoreFront">
125+
<argument name="productPrice" value="$$createConfigChildProduct1.price$$"/>
126+
</actionGroup>
127+
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront">
128+
<argument name="productSku" value="$$createConfigProduct.sku$$"/>
129+
</actionGroup>
130+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront">
131+
<argument name="productStockStatus" value="In Stock"/>
132+
</actionGroup>
133+
134+
<!-- Verify First Child Product attribute option is displayed -->
135+
<see selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="seeOption1"/>
136+
137+
<!-- Select product Attribute option1, option2 and option3 and verify changes in the price -->
138+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption1">
139+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
140+
<argument name="optionLabel" value="$$getConfigAttributeOption1.label$$"/>
141+
</actionGroup>
142+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct1PriceInStoreFront">
143+
<argument name="productPrice" value="$$createConfigChildProduct1.price$$"/>
144+
</actionGroup>
145+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption2">
146+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
147+
<argument name="optionLabel" value="$$getConfigAttributeOption2.label$$"/>
148+
</actionGroup>
149+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct2PriceInStoreFront">
150+
<argument name="productPrice" value="$$createConfigChildProduct2.price$$"/>
151+
</actionGroup>
152+
<!-- Open Product Index Page and Filter First Child product -->
153+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="navigateToProductIndex"/>
154+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterProduct"/>
155+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanFullPageCache">
156+
<argument name="tags" value="full_page"/>
157+
</actionGroup>
158+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="selectFirstRow">
159+
<argument name="productId" value="$$createConfigChildProduct1.id$$"/>
160+
</actionGroup>
161+
<waitForPageLoad stepKey="waitForProductPageToLoad"/>
162+
163+
<updateData entity="SimpleProductUpdatePrice90" createDataKey="createConfigChildProduct1" stepKey="updateSimpleProductOne"/>
164+
165+
<!-- Run cron -->
166+
<magentoCron stepKey="runIndexCronJobs" groups="index"/>
167+
<comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCache"/>
168+
169+
<!-- Wait till cron job runs for schedule updates -->
170+
<wait time="60" stepKey="waitForUpdateStarts"/>
171+
172+
<!-- Open Product Store Front Page -->
173+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront1">
174+
<argument name="product" value="$createConfigProduct$"/>
175+
</actionGroup>
176+
<comment userInput="CommentConfigurableProductTwoOptions is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad1"/>
177+
178+
<!-- Verify category,configurable product and updated price -->
179+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage1">
180+
<argument name="categoryName" value="$$createCategory.name$$"/>
181+
</actionGroup>
182+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront1">
183+
<argument name="productName" value="$$createConfigProduct.name$$"/>
184+
</actionGroup>
185+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeUpdatedProductPriceInStoreFront">
186+
<argument name="productPrice" value="$$createConfigChildProduct2.price$$"/>
187+
</actionGroup>
188+
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront1">
189+
<argument name="productSku" value="$$createConfigProduct.sku$$"/>
190+
</actionGroup>
191+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront1">
192+
<argument name="productStockStatus" value="In Stock"/>
193+
</actionGroup>
194+
195+
<!-- Verify product Attribute Option1 is displayed -->
196+
197+
<see selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="seeOption1AfterUpdate"/>
198+
199+
<!--Select product Attribute option1 and verify changes in the price -->
200+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption1AfterUpdate">
201+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
202+
<argument name="optionLabel" value="$$getConfigAttributeOption1.label$$"/>
203+
</actionGroup>
204+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct1PriceInStoreFrontAfterUpdate">
205+
<argument name="productPrice" value="$$createConfigChildProduct1.price$$"/>
206+
</actionGroup>
207+
</test>
208+
</tests>

0 commit comments

Comments
 (0)