Skip to content

Commit a8885ca

Browse files
committed
MC-3046: Configurable Product goes 'Out of Stock' if all associated Simple Products are a combination of 'Out of Stock' and deleted
1 parent 317e9b3 commit a8885ca

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,116 @@
233233
<waitForPageLoad stepKey="waitForStoreFrontLoad3"/>
234234
<see stepKey="lookForOutOfStock3" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="OUT OF STOCK"/>
235235
</test>
236+
237+
<test name="AdminConfigurableProductOutOfStockAndDeleteCombinationTest">
238+
<annotations>
239+
<features value="ConfigurableProduct"/>
240+
<stories value="Product visibility when in stock/out of stock"/>
241+
<title value="Configurable Product goes 'Out of Stock' if all associated Simple Products are a combination of 'Out of Stock' and deleted"/>
242+
<description value="Configurable Product goes 'Out of Stock' if all associated Simple Products are a combination of 'Out of Stock' and deleted"/>
243+
<severity value="CRITICAL"/>
244+
<testCaseId value="MC-3046"/>
245+
<group value="ConfigurableProduct"/>
246+
</annotations>
247+
<before>
248+
<!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. -->
249+
<!-- Create the category to put the product in -->
250+
<createData entity="ApiCategory" stepKey="createCategory"/>
251+
252+
<!-- Create the configurable product based on the data in the /data folder -->
253+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
254+
<requiredEntity createDataKey="createCategory"/>
255+
</createData>
256+
257+
<!-- Make the configurable product have two options, that are children of the default attribute set -->
258+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
259+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
260+
<requiredEntity createDataKey="createConfigProductAttribute"/>
261+
</createData>
262+
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
263+
<requiredEntity createDataKey="createConfigProductAttribute"/>
264+
</createData>
265+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
266+
<requiredEntity createDataKey="createConfigProductAttribute"/>
267+
</createData>
268+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
269+
<requiredEntity createDataKey="createConfigProductAttribute"/>
270+
</getData>
271+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
272+
<requiredEntity createDataKey="createConfigProductAttribute"/>
273+
</getData>
274+
275+
<!-- Create the 2 children that will be a part of the configurable product -->
276+
<createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1">
277+
<requiredEntity createDataKey="createConfigProductAttribute"/>
278+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
279+
</createData>
280+
<createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2">
281+
<requiredEntity createDataKey="createConfigProductAttribute"/>
282+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
283+
</createData>
284+
285+
<!-- Assign the two products to the configurable product -->
286+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
287+
<requiredEntity createDataKey="createConfigProduct"/>
288+
<requiredEntity createDataKey="createConfigProductAttribute"/>
289+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
290+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
291+
</createData>
292+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
293+
<requiredEntity createDataKey="createConfigProduct"/>
294+
<requiredEntity createDataKey="createConfigChildProduct1"/>
295+
</createData>
296+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
297+
<requiredEntity createDataKey="createConfigProduct"/>
298+
<requiredEntity createDataKey="createConfigChildProduct2"/>
299+
</createData>
300+
301+
<!-- log in -->
302+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
303+
</before>
304+
305+
<after>
306+
<amOnPage url="admin/admin/auth/logout/" stepKey="logout"/>
307+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
308+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
309+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
310+
</after>
311+
312+
<!-- Check to make sure that the configurable product shows up as in stock -->
313+
<amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage"/>
314+
<waitForPageLoad stepKey="waitForStoreFrontLoad"/>
315+
<see stepKey="lookForOutOfStock" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK" />
316+
317+
<!-- Delete the first simple product -->
318+
<actionGroup stepKey="deleteProduct1" ref="deleteProductBySku">
319+
<argument name="sku" value="{{ApiSimpleOne.sku}}"/>
320+
</actionGroup>
321+
322+
<!-- Check to make sure that the configurable product shows up as in stock -->
323+
<amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage2"/>
324+
<waitForPageLoad stepKey="waitForStoreFrontLoad2"/>
325+
<see stepKey="lookForOutOfStock2" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK"/>
326+
327+
<!-- Find the second simple product that we just created using the product grid and go to its page-->
328+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage2"/>
329+
<waitForPageLoad stepKey="waitForAdminProductGridLoad2"/>
330+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
331+
<actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct2">
332+
<argument name="product" value="ApiSimpleTwo"/>
333+
</actionGroup>
334+
<waitForPageLoad stepKey="waitForFiltersToBeApplied2"/>
335+
<click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage2"/>
336+
<waitForPageLoad stepKey="waitForProductPageLoad2"/>
337+
338+
<!-- Edit the quantity of the second simple product as 0 -->
339+
<fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="0" stepKey="fillProductQuantity2"/>
340+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct2"/>
341+
<waitForPageLoad stepKey="waitForProductPageSaved2"/>
342+
343+
<!-- Check to make sure that the configurable product shows up as out of stock -->
344+
<amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage3"/>
345+
<waitForPageLoad stepKey="waitForStoreFrontLoad3"/>
346+
<see stepKey="lookForOutOfStock3" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="OUT OF STOCK"/>
347+
</test>
236348
</tests>

0 commit comments

Comments
 (0)