Skip to content

Commit d91ff15

Browse files
committed
MC-3042: Configurable Product goes "Out of Stock" if all associated Simple Products are deleted
1 parent c631e5d commit d91ff15

File tree

1 file changed

+103
-1
lines changed

1 file changed

+103
-1
lines changed

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

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../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'"/>
1616
<description value="Configurable Product goes 'Out of Stock' if all associated Simple Products are 'Out of Stock'"/>
17+
<severity value="CRITICAL"/>
1718
<testCaseId value="MC-181"/>
1819
<group value="ConfigurableProduct"/>
1920
</annotations>
@@ -131,4 +132,105 @@
131132
<waitForPageLoad stepKey="waitForStoreFrontLoad3"/>
132133
<see stepKey="lookForOutOfStock3" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="OUT OF STOCK"/>
133134
</test>
135+
136+
<test name="AdminConfigurableProductOutOfStockTestDeleteChildren">
137+
<annotations>
138+
<features value="ConfigurableProduct"/>
139+
<stories value="Product visibility when in stock/out of stock"/>
140+
<title value="Configurable Product goes 'Out of Stock' if all associated Simple Products are deleted"/>
141+
<description value="Configurable Product goes 'Out of Stock' if all associated Simple Products are deleted"/>
142+
<severity value="CRITICAL"/>
143+
<testCaseId value="MC-3042"/>
144+
<group value="ConfigurableProduct"/>
145+
</annotations>
146+
<before>
147+
<!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. -->
148+
<!-- Create the category to put the product in -->
149+
<createData entity="ApiCategory" stepKey="createCategory"/>
150+
151+
<!-- Create the configurable product based on the data in the /data folder -->
152+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
153+
<requiredEntity createDataKey="createCategory"/>
154+
</createData>
155+
156+
<!-- Make the configurable product have two options, that are children of the default attribute set -->
157+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
158+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
159+
<requiredEntity createDataKey="createConfigProductAttribute"/>
160+
</createData>
161+
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
162+
<requiredEntity createDataKey="createConfigProductAttribute"/>
163+
</createData>
164+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
165+
<requiredEntity createDataKey="createConfigProductAttribute"/>
166+
</createData>
167+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
168+
<requiredEntity createDataKey="createConfigProductAttribute"/>
169+
</getData>
170+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
171+
<requiredEntity createDataKey="createConfigProductAttribute"/>
172+
</getData>
173+
174+
<!-- Create the 2 children that will be a part of the configurable product -->
175+
<createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1">
176+
<requiredEntity createDataKey="createConfigProductAttribute"/>
177+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
178+
</createData>
179+
<createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2">
180+
<requiredEntity createDataKey="createConfigProductAttribute"/>
181+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
182+
</createData>
183+
184+
<!-- Assign the two products to the configurable product -->
185+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
186+
<requiredEntity createDataKey="createConfigProduct"/>
187+
<requiredEntity createDataKey="createConfigProductAttribute"/>
188+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
189+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
190+
</createData>
191+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
192+
<requiredEntity createDataKey="createConfigProduct"/>
193+
<requiredEntity createDataKey="createConfigChildProduct1"/>
194+
</createData>
195+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
196+
<requiredEntity createDataKey="createConfigProduct"/>
197+
<requiredEntity createDataKey="createConfigChildProduct2"/>
198+
</createData>
199+
200+
<!-- log in -->
201+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
202+
</before>
203+
204+
<after>
205+
<amOnPage url="admin/admin/auth/logout/" stepKey="logout"/>
206+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
207+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
208+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
209+
</after>
210+
211+
<!-- Check to make sure that the configurable product shows up as in stock -->
212+
<amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage"/>
213+
<waitForPageLoad stepKey="waitForStoreFrontLoad"/>
214+
<see stepKey="lookForOutOfStock" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK" />
215+
216+
<!-- Delete the first simple product -->
217+
<actionGroup stepKey="deleteProduct1" ref="deleteProductBySku">
218+
<argument name="sku" value="{{ApiSimpleOne.sku}}"/>
219+
</actionGroup>
220+
221+
<!-- Check to make sure that the configurable product shows up as in stock -->
222+
<amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage2"/>
223+
<waitForPageLoad stepKey="waitForStoreFrontLoad2"/>
224+
<see stepKey="lookForOutOfStock2" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK"/>
225+
226+
<!-- Delete the second simple product -->
227+
<actionGroup stepKey="deleteProduct2" ref="deleteProductBySku">
228+
<argument name="sku" value="{{ApiSimpleTwo.sku}}"/>
229+
</actionGroup>
230+
231+
<!-- Check to make sure that the configurable product shows up as out of stock -->
232+
<amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage3"/>
233+
<waitForPageLoad stepKey="waitForStoreFrontLoad3"/>
234+
<see stepKey="lookForOutOfStock3" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="OUT OF STOCK"/>
235+
</test>
134236
</tests>

0 commit comments

Comments
 (0)