Skip to content

Commit a609945

Browse files
committed
Refactoring the test
1 parent fadbf69 commit a609945

File tree

1 file changed

+75
-29
lines changed

1 file changed

+75
-29
lines changed

app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckConfigurableProductPriceWithDisabledChildProductTest.xml

Lines changed: 75 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -124,62 +124,108 @@
124124
</after>
125125

126126
<!-- Open Product in Store Front Page -->
127-
<amOnPage url="$$createConfigProduct.sku$$.html" stepKey="openProductInStoreFront"/>
128-
<waitForPageLoad stepKey="waitForProductToLoad"/>
127+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront">
128+
<argument name="product" value="$createConfigProduct$"/>
129+
</actionGroup>
130+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad"/>
129131

130132
<!-- Verify category,Configurable product and initial price -->
131-
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryInFrontPage"/>
132-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInStoreFront"/>
133-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct1.price$$" stepKey="seeInitialPriceInStoreFront"/>
133+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage">
134+
<argument name="categoryName" value="$$createCategory.name$$"/>
135+
</actionGroup>
136+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront">
137+
<argument name="productName" value="$$createConfigProduct.name$$"/>
138+
</actionGroup>
139+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeInitialPriceInStoreFront">
140+
<argument name="productPrice" value="$$createConfigChildProduct1.price$$"/>
141+
</actionGroup>
134142
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront">
135143
<argument name="productSku" value="$$createConfigProduct.sku$$"/>
136144
</actionGroup>
137-
<see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="In Stock" stepKey="seeProductStatusInStoreFront"/>
145+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront">
146+
<argument name="productStockStatus" value="In Stock"/>
147+
</actionGroup>
138148

139149
<!-- Verify First Child Product attribute option is displayed -->
140150
<see selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="seeOption1"/>
141151

142152
<!-- Select product Attribute option1, option2 and option3 and verify changes in the price -->
143-
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="selectOption1"/>
144-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct1.price$$" stepKey="seeChildProduct1PriceInStoreFront"/>
145-
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption2.label$$" stepKey="selectOption2"/>
146-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct2.price$$" stepKey="seeChildProduct2PriceInStoreFront"/>
147-
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption3.label$$" stepKey="selectOption3"/>
148-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct3.price$$" stepKey="seeChildProduct3PriceInStoreFront"/>
149-
153+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption1">
154+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
155+
<argument name="optionLabel" value="$$getConfigAttributeOption1.label$$"/>
156+
</actionGroup>
157+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct1PriceInStoreFront">
158+
<argument name="productPrice" value="$$createConfigChildProduct1.price$$"/>
159+
</actionGroup>
160+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption2">
161+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
162+
<argument name="optionLabel" value="$$getConfigAttributeOption2.label$$"/>
163+
</actionGroup>
164+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct2PriceInStoreFront">
165+
<argument name="productPrice" value="$$createConfigChildProduct2.price$$"/>
166+
</actionGroup>
167+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption3">
168+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
169+
<argument name="optionLabel" value="$$getConfigAttributeOption3.label$$"/>
170+
</actionGroup>
171+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct3PriceInStoreFront">
172+
<argument name="productPrice" value="$$createConfigChildProduct3.price$$"/>
173+
</actionGroup>
150174
<!-- Open Product Index Page and Filter First Child product -->
151-
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
152-
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProduct">
153-
<argument name="product" value="ApiSimpleOne"/>
175+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="navigateToProductIndex"/>
176+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterProduct"/>
177+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="selectFirstRow">
178+
<argument name="productId" value="$$createConfigChildProduct1.id$$"/>
154179
</actionGroup>
155-
<click selector="{{AdminProductGridFilterSection.nthRow('1')}}" stepKey="selectFirstRow"/>
156180
<waitForPageLoad stepKey="waitForProductPageToLoad"/>
157181

158182
<!-- Disable the product -->
159-
<click selector="{{AdminProductFormSection.enableProductLabel}}" stepKey="disableProduct"/>
183+
<actionGroup ref="ToggleProductEnabledActionGroup" stepKey="disableProduct"/>
160184
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickOnSaveButton"/>
161-
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
185+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="messageYouSavedTheProductIsShown">
186+
<argument name="message" value="You saved the product."/>
187+
</actionGroup>
162188

163189
<!-- Open Product Store Front Page -->
164-
<amOnPage url="$$createConfigProduct.sku$$.html" stepKey="openProductInStoreFront1"/>
165-
<waitForPageLoad stepKey="waitForProductToLoad1"/>
190+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront1">
191+
<argument name="product" value="$createConfigProduct$"/>
192+
</actionGroup>
193+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad1"/>
166194

167195
<!-- Verify category,configurable product and updated price -->
168-
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="seeCategoryInFrontPage1"/>
169-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="$$createConfigProduct.name$$" stepKey="seeProductNameInStoreFront1"/>
170-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct2.price$$" stepKey="seeUpdatedProductPriceInStoreFront"/>
196+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage1">
197+
<argument name="categoryName" value="$$createCategory.name$$"/>
198+
</actionGroup>
199+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront1">
200+
<argument name="productName" value="$$createConfigProduct.name$$"/>
201+
</actionGroup>
202+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeUpdatedProductPriceInStoreFront">
203+
<argument name="productPrice" value="$$createConfigChildProduct2.price$$"/>
204+
</actionGroup>
171205
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront1">
172206
<argument name="productSku" value="$$createConfigProduct.sku$$"/>
173207
</actionGroup>
174-
<see selector="{{StorefrontProductInfoMainSection.productStockStatus}}" userInput="In Stock" stepKey="seeProductStatusInStoreFront1"/>
208+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront1">
209+
<argument name="productStockStatus" value="In Stock"/>
210+
</actionGroup>
175211

176212
<!-- Verify product Attribute Option1 is not displayed -->
177213
<dontSee selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="dontSeeOption1"/>
178214

179215
<!--Select product Attribute option2 and option3 and verify changes in the price -->
180-
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption2.label$$" stepKey="selectTheOption2"/>
181-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct2.price$$" stepKey="seeSecondChildProductPriceInStoreFront"/>
182-
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption3.label$$" stepKey="selectTheOption3"/>
183-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$$createConfigChildProduct3.price$$" stepKey="seeThirdProductPriceInStoreFront"/>
216+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectTheOption2">
217+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
218+
<argument name="optionLabel" value="$$getConfigAttributeOption2.label$$"/>
219+
</actionGroup>
220+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeSecondChildProductPriceInStoreFront">
221+
<argument name="productPrice" value="$$createConfigChildProduct2.price$$"/>
222+
</actionGroup>
223+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectTheOption3">
224+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
225+
<argument name="optionLabel" value="$$getConfigAttributeOption3.label$$"/>
226+
</actionGroup>
227+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeThirdProductPriceInStoreFront">
228+
<argument name="productPrice" value="$$createConfigChildProduct3.price$$"/>
229+
</actionGroup>
184230
</test>
185231
</tests>

0 commit comments

Comments
 (0)