Skip to content

Commit 33a1f4b

Browse files
committed
MAGETWO-93082: Automate with MFTF flow when Configurable Product goes "Out of Stock" if all associated Simple Products are "Out of Stock"
1 parent 4e63cc4 commit 33a1f4b

File tree

2 files changed

+224
-5
lines changed

2 files changed

+224
-5
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,7 @@
4848
<click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/>
4949
<waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/>
5050
<click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/>
51+
<see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been deleted." stepKey="seeSuccessMessage"/>
52+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
5153
</actionGroup>
5254
</actionGroups>

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

Lines changed: 222 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11-
<test name="AdminConfigurableProductOutOfStockTest">
11+
<test name="AdminConfigurableProductChildrenOutOfStockTest">
1212
<annotations>
1313
<features value="ConfigurableProduct"/>
1414
<stories value="Product visibility when in stock/out of stock"/>
1515
<title value="Configurable Product goes 'Out of Stock' if all associated Simple Products are 'Out of Stock'"/>
16+
<severity value="CRITICAL"/>
1617
<description value="Configurable Product goes 'Out of Stock' if all associated Simple Products are 'Out of Stock'"/>
1718
<testCaseId value="MAGETWO-79939"/>
1819
<group value="configurableProduct"/>
@@ -86,7 +87,7 @@
8687
</after>
8788

8889
<!-- Check to make sure that the configurable product shows up as in stock -->
89-
<amOnPage url="/$$createConfigProduct.custom_attributes[url_key]$$.html" stepKey="goToConfigProductPage"/>
90+
<amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.custom_attributes[url_key]$$)}}" stepKey="goToConfigProductPage"/>
9091
<waitForPageLoad stepKey="waitForStoreFrontLoad"/>
9192
<see selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK" stepKey="lookForOfStock"/>
9293

@@ -107,7 +108,7 @@
107108
<waitForPageLoad stepKey="waitForProductPageSaved"/>
108109

109110
<!-- Check to make sure that the configurable product shows up as in stock -->
110-
<amOnPage url="/$$createConfigProduct.custom_attributes[url_key]$$.html" stepKey="goToConfigProductPage2"/>
111+
<amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.custom_attributes[url_key]$$)}}" stepKey="goToConfigProductPage2"/>
111112
<waitForPageLoad stepKey="waitForStoreFrontLoad2"/>
112113
<see selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK" stepKey="lookForOutOfStock2"/>
113114

@@ -128,8 +129,224 @@
128129
<waitForPageLoad stepKey="waitForProductPageSaved2"/>
129130

130131
<!-- Check to make sure that the configurable product shows up as out of stock -->
131-
<amOnPage url="/$$createConfigProduct.custom_attributes[url_key]$$.html" stepKey="goToConfigProductPage3"/>
132+
<amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.custom_attributes[url_key]$$)}}" stepKey="goToConfigProductPage3"/>
132133
<waitForPageLoad stepKey="waitForStoreFrontLoad3"/>
133-
<see selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="OUT OF STOCK" stepKey="lookForOutOfStock3"/>
134+
<see userInput="OUT OF STOCK" selector="{{StorefrontProductInfoMainSection.stockIndication}}" stepKey="lookForOutOfStock3"/>
135+
</test>
136+
137+
<test name="AdminConfigurableProductOutOfStockDeleteChildrenTest">
138+
<annotations>
139+
<features value="ConfigurableProduct"/>
140+
<stories value="Product visibility when in stock/out of stock"/>
141+
<title value="Configurable Product goes 'Out of Stock' if all associated Simple Products are deleted"/>
142+
<description value="Configurable Product goes 'Out of Stock' if all associated Simple Products are deleted"/>
143+
<severity value="CRITICAL"/>
144+
<testCaseId value="MAGETWO-79939"/>
145+
<group value="ConfigurableProduct"/>
146+
</annotations>
147+
<before>
148+
<!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. -->
149+
<!-- Create the category to put the product in -->
150+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
151+
152+
<!-- Create the configurable product based on the data in the /data folder -->
153+
<createData entity="BaseConfigurableProduct" stepKey="createConfigProduct">
154+
<requiredEntity createDataKey="createCategory"/>
155+
</createData>
156+
157+
<!-- Make the configurable product have two options, that are children of the default attribute set -->
158+
<createData entity="productAttributeWithDropdownTwoOptions" stepKey="createConfigProductAttribute"/>
159+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
160+
<requiredEntity createDataKey="createConfigProductAttribute"/>
161+
</createData>
162+
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
163+
<requiredEntity createDataKey="createConfigProductAttribute"/>
164+
</createData>
165+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
166+
<requiredEntity createDataKey="createConfigProductAttribute"/>
167+
</createData>
168+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
169+
<requiredEntity createDataKey="createConfigProductAttribute"/>
170+
</getData>
171+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
172+
<requiredEntity createDataKey="createConfigProductAttribute"/>
173+
</getData>
174+
175+
<!-- Create the 2 children that will be a part of the configurable product -->
176+
<createData entity="SimpleOption" stepKey="createConfigChildProduct1">
177+
<requiredEntity createDataKey="createConfigProductAttribute"/>
178+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
179+
</createData>
180+
<createData entity="SimpleOption" stepKey="createConfigChildProduct2">
181+
<field key="sku">SimpleTwoOption</field>
182+
<requiredEntity createDataKey="createConfigProductAttribute"/>
183+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
184+
</createData>
185+
186+
<!-- Assign the two products to the configurable product -->
187+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
188+
<requiredEntity createDataKey="createConfigProduct"/>
189+
<requiredEntity createDataKey="createConfigProductAttribute"/>
190+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
191+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
192+
</createData>
193+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
194+
<requiredEntity createDataKey="createConfigProduct"/>
195+
<requiredEntity createDataKey="createConfigChildProduct1"/>
196+
</createData>
197+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
198+
<requiredEntity createDataKey="createConfigProduct"/>
199+
<requiredEntity createDataKey="createConfigChildProduct2"/>
200+
</createData>
201+
202+
<!-- log in -->
203+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
204+
</before>
205+
206+
<after>
207+
<actionGroup ref="logout" stepKey="logout"/>
208+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
209+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
210+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
211+
</after>
212+
213+
<!-- Check to make sure that the configurable product shows up as in stock -->
214+
<amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.custom_attributes[url_key]$$)}}" stepKey="goToConfigProductPage"/>
215+
<waitForPageLoad stepKey="waitForStoreFrontLoad"/>
216+
<see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.stockIndication}}" stepKey="lookForOutOfStock"/>
217+
218+
<!-- Delete the first simple product -->
219+
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteConfigChildProduct1">
220+
<argument name="product" value="$$createConfigChildProduct1$$"/>
221+
</actionGroup>
222+
223+
<!-- Check to make sure that the configurable product shows up as in stock -->
224+
<amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.custom_attributes[url_key]$$)}}" stepKey="goToConfigProductPage2"/>
225+
<waitForPageLoad stepKey="waitForStoreFrontLoad2"/>
226+
<see stepKey="lookForOutOfStock2" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK"/>
227+
228+
<!-- Delete the second simple product -->
229+
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteConfigChildProduct2">
230+
<argument name="product" value="$$createConfigChildProduct2$$"/>
231+
</actionGroup>
232+
233+
<!-- Check to make sure that the configurable product shows up as out of stock -->
234+
<amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.custom_attributes[url_key]$$)}}" stepKey="goToConfigProductPage3"/>
235+
<waitForPageLoad stepKey="waitForStoreFrontLoad3"/>
236+
<see userInput="OUT OF STOCK" selector="{{StorefrontProductInfoMainSection.stockIndication}}" stepKey="lookForOutOfStock3"/>
237+
</test>
238+
239+
<test name="AdminConfigurableProductOutOfStockAndDeleteCombinationTest">
240+
<annotations>
241+
<features value="ConfigurableProduct"/>
242+
<stories value="Product visibility when in stock/out of stock"/>
243+
<title value="Configurable Product goes 'Out of Stock' if all associated Simple Products are a combination of 'Out of Stock' and deleted"/>
244+
<description value="Configurable Product goes 'Out of Stock' if all associated Simple Products are a combination of 'Out of Stock' and deleted"/>
245+
<severity value="CRITICAL"/>
246+
<testCaseId value="MAGETWO-79939"/>
247+
<group value="ConfigurableProduct"/>
248+
</annotations>
249+
<before>
250+
<!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. -->
251+
<!-- Create the category to put the product in -->
252+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
253+
254+
<!-- Create the configurable product based on the data in the /data folder -->
255+
<createData entity="BaseConfigurableProduct" stepKey="createConfigProduct">
256+
<requiredEntity createDataKey="createCategory"/>
257+
</createData>
258+
259+
<!-- Make the configurable product have two options, that are children of the default attribute set -->
260+
<createData entity="productAttributeWithDropdownTwoOptions" stepKey="createConfigProductAttribute"/>
261+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
262+
<requiredEntity createDataKey="createConfigProductAttribute"/>
263+
</createData>
264+
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
265+
<requiredEntity createDataKey="createConfigProductAttribute"/>
266+
</createData>
267+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
268+
<requiredEntity createDataKey="createConfigProductAttribute"/>
269+
</createData>
270+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
271+
<requiredEntity createDataKey="createConfigProductAttribute"/>
272+
</getData>
273+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
274+
<requiredEntity createDataKey="createConfigProductAttribute"/>
275+
</getData>
276+
277+
<!-- Create the 2 children that will be a part of the configurable product -->
278+
<createData entity="SimpleOption" stepKey="createConfigChildProduct1">
279+
<requiredEntity createDataKey="createConfigProductAttribute"/>
280+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
281+
</createData>
282+
<createData entity="SimpleOption" stepKey="createConfigChildProduct2">
283+
<field key="sku">SimpleTwoOption</field>
284+
<requiredEntity createDataKey="createConfigProductAttribute"/>
285+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
286+
</createData>
287+
288+
<!-- Assign the two products to the configurable product -->
289+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
290+
<requiredEntity createDataKey="createConfigProduct"/>
291+
<requiredEntity createDataKey="createConfigProductAttribute"/>
292+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
293+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
294+
</createData>
295+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
296+
<requiredEntity createDataKey="createConfigProduct"/>
297+
<requiredEntity createDataKey="createConfigChildProduct1"/>
298+
</createData>
299+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
300+
<requiredEntity createDataKey="createConfigProduct"/>
301+
<requiredEntity createDataKey="createConfigChildProduct2"/>
302+
</createData>
303+
304+
<!-- log in -->
305+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
306+
</before>
307+
308+
<after>
309+
<actionGroup ref="logout" stepKey="logout"/>
310+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
311+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
312+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
313+
<deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/>
314+
</after>
315+
316+
<!-- Check to make sure that the configurable product shows up as in stock -->
317+
<amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.custom_attributes[url_key]$$)}}" stepKey="goToConfigProductPage"/>
318+
<waitForPageLoad stepKey="waitForStoreFrontLoad"/>
319+
<see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.stockIndication}}" stepKey="lookForInOfStock"/>
320+
321+
<!-- Delete the first simple product -->
322+
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteConfigChildProduct1">
323+
<argument name="product" value="$$createConfigChildProduct1$$"/>
324+
</actionGroup>
325+
326+
<!-- Check to make sure that the configurable product shows up as in stock -->
327+
<amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.custom_attributes[url_key]$$)}}" stepKey="goToConfigProductPage2"/>
328+
<waitForPageLoad stepKey="waitForStoreFrontLoad2"/>
329+
<see userInput="IN STOCK" selector="{{StorefrontProductInfoMainSection.stockIndication}}" stepKey="lookForInOfStock2"/>
330+
331+
<!-- Find the second simple product that we just created using the product grid and go to its page-->
332+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage2"/>
333+
<waitForPageLoad stepKey="waitForAdminProductGridLoad2"/>
334+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
335+
<actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct2">
336+
<argument name="product" value="$$createConfigChildProduct2$$"/>
337+
</actionGroup>
338+
<waitForPageLoad stepKey="waitForFiltersToBeApplied2"/>
339+
<click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage2"/>
340+
<waitForPageLoad stepKey="waitForProductPageLoad2"/>
341+
342+
<!-- Edit the quantity of the second simple product as 0 -->
343+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="0" stepKey="fillProductQuantity2"/>
344+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct2"/>
345+
<waitForPageLoad stepKey="waitForProductPageSaved2"/>
346+
347+
<!-- Check to make sure that the configurable product shows up as out of stock -->
348+
<amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.custom_attributes[url_key]$$)}}" stepKey="goToConfigProductPage3"/>
349+
<waitForPageLoad stepKey="waitForStoreFrontLoad3"/>
350+
<see selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="OUT OF STOCK" stepKey="lookForOutOfStock"/>
134351
</test>
135352
</tests>

0 commit comments

Comments
 (0)