Skip to content

Commit b8e289a

Browse files
committed
Refactoring the test
1 parent d3f202a commit b8e289a

File tree

2 files changed

+45
-11
lines changed

2 files changed

+45
-11
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="AdminFillProductQtyOnProductFormActionGroup">
12+
<annotations>
13+
<description>Fills in Quantity field on the Admin Products creation/edit page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productQty" type="string"/>
17+
</arguments>
18+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{productQty}}" stepKey="fillProductQty"/>
19+
</actionGroup>
20+
</actionGroups>

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductOutOfStockTest/AdminConfigurableProductChildrenOutOfStockTest.xml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@
8888
</after>
8989

9090
<!-- Check to make sure that the configurable product shows up as in stock -->
91-
<amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage"/>
92-
<waitForPageLoad stepKey="waitForStoreFrontLoad"/>
93-
<see stepKey="checkForOutOfStock" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK"/>
91+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="goToConfigProductPage"/>
92+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStoreFrontLoad"/>
93+
<actionGroup ref="StorefrontCheckProductStockStatus" stepKey="checkForOutOfStock">
94+
<argument name="productUrlKey" value="$$createConfigProduct.custom_attributes[url_key]$$"/>
95+
<argument name="productName" value="$$createConfigProduct.name$$"/>
96+
</actionGroup>
9497

9598
<!-- Find the first simple product that we just created using the product grid and go to its page-->
9699
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="visitAdminProductPage"/>
@@ -102,13 +105,18 @@
102105
<actionGroup ref="AdminProductGridSectionClickFirstRowActionGroup" stepKey="clickOnProductPage"/>
103106

104107
<!-- Edit the quantity of the simple first product as 0 -->
105-
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="0" stepKey="fillProductQuantity"/>
108+
<actionGroup ref="AdminFillProductQtyOnProductFormActionGroup" stepKey="fillProductQuantity">
109+
<argument name="productQty" value="0"/>
110+
</actionGroup>
106111
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveProduct"/>
107112

108113
<!-- Check to make sure that the configurable product shows up as in stock -->
109-
<amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage2"/>
110-
<waitForPageLoad stepKey="waitForStoreFrontLoad2"/>
111-
<see stepKey="checkForOutOfStock2" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK"/>
114+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="goToConfigProductPage2"/>
115+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStoreFrontLoad2"/>
116+
<actionGroup ref="StorefrontCheckProductStockStatus" stepKey="checkForOutOfStock2">
117+
<argument name="productUrlKey" value="$$createConfigProduct.custom_attributes[url_key]$$"/>
118+
<argument name="productName" value="$$createConfigProduct.name$$"/>
119+
</actionGroup>
112120

113121
<!-- Find the second simple product that we just created using the product grid and go to its page-->
114122
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="visitAdminProductPage2"/>
@@ -120,12 +128,18 @@
120128
<actionGroup ref="AdminProductGridSectionClickFirstRowActionGroup" stepKey="clickOnProductPage2"/>
121129

122130
<!-- Edit the quantity of the second simple product as 0 -->
123-
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="0" stepKey="fillProductQuantity2"/>
131+
<actionGroup ref="AdminFillProductQtyOnProductFormActionGroup" stepKey="fillProductQuantity2">
132+
<argument name="productQty" value="0"/>
133+
</actionGroup>
124134
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveProduct2"/>
125135

126136
<!-- Check to make sure that the configurable product shows up as out of stock -->
127-
<amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage3"/>
128-
<waitForPageLoad stepKey="waitForStoreFrontLoad3"/>
129-
<see stepKey="checkForOutOfStock3" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="OUT OF STOCK"/>
137+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="goToConfigProductPage3"/>
138+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStoreFrontLoad3"/>
139+
<actionGroup ref="StorefrontCheckProductStockStatus" stepKey="checkForOutOfStock3">
140+
<argument name="productUrlKey" value="$$createConfigProduct.custom_attributes[url_key]$$"/>
141+
<argument name="productName" value="$$createConfigProduct.name$$"/>
142+
<argument name="stockStatus" value="OUT OF STOCK"/>
143+
</actionGroup>
130144
</test>
131145
</tests>

0 commit comments

Comments
 (0)