Skip to content

Commit acfa860

Browse files
MAGETWO-64282: Out of stock associated products to configurable are not full page cache cleaned
- Add automated test
1 parent 5a4f4a6 commit acfa860

File tree

4 files changed

+136
-0
lines changed

4 files changed

+136
-0
lines changed

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,4 +419,17 @@
419419
<data key="status">1</data>
420420
<requiredEntity type="product_extension_attribute">EavStock100</requiredEntity>
421421
</entity>
422+
<entity name="ApiSimpleSingleQty" type="product2">
423+
<data key="sku" unique="suffix">api-simple-product</data>
424+
<data key="type_id">simple</data>
425+
<data key="attribute_set_id">4</data>
426+
<data key="visibility">4</data>
427+
<data key="name" unique="suffix">Api Simple Product</data>
428+
<data key="price">123.00</data>
429+
<data key="urlKey" unique="suffix">api-simple-product</data>
430+
<data key="status">1</data>
431+
<data key="quantity">1</data>
432+
<requiredEntity type="product_extension_attribute">EavStock1</requiredEntity>
433+
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
434+
</entity>
422435
</entities>

app/code/Magento/Catalog/Test/Mftf/Data/ProductExtensionAttributeData.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@
1717
<entity name="EavStock10" type="product_extension_attribute">
1818
<requiredEntity type="stock_item">Qty_10</requiredEntity>
1919
</entity>
20+
<entity name="EavStock1" type="product_extension_attribute">
21+
<requiredEntity type="stock_item">Qty_1</requiredEntity>
22+
</entity>
2023
</entities>

app/code/Magento/Catalog/Test/Mftf/Data/StockItemData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@
2828
<data key="qty">101</data>
2929
<data key="is_in_stock">true</data>
3030
</entity>
31+
<entity name="Qty_1" type="stock_item">
32+
<data key="qty">1</data>
33+
<data key="is_in_stock">true</data>
34+
</entity>
3135
</entities>
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AssociatedProductToConfigurableOutOfStockTest">
12+
<annotations>
13+
<features value="CatalogInventory"/>
14+
<stories value="Add/remove images and videos for all product types and category"/>
15+
<title value="Out of stock associated products to configurable are not full page cache cleaned "/>
16+
<description value="After last configurable product was ordered it becomes out of stock"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-94135"/>
19+
<group value="CatalogInventory"/>
20+
</annotations>
21+
22+
<before>
23+
<createData entity="SimpleSubCategory" stepKey="simplecategory"/>
24+
25+
<!-- Create configurable product with two options -->
26+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
27+
<requiredEntity createDataKey="simplecategory"/>
28+
</createData>
29+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
30+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
31+
<requiredEntity createDataKey="createConfigProductAttribute"/>
32+
</createData>
33+
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
34+
<requiredEntity createDataKey="createConfigProductAttribute"/>
35+
</createData>
36+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
37+
<requiredEntity createDataKey="createConfigProductAttribute"/>
38+
</createData>
39+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
40+
<requiredEntity createDataKey="createConfigProductAttribute"/>
41+
</getData>
42+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
43+
<requiredEntity createDataKey="createConfigProductAttribute"/>
44+
</getData>
45+
46+
<!-- Create child product with single quantity -->
47+
<createData entity="ApiSimpleSingleQty" stepKey="createConfigChildProduct1">
48+
<requiredEntity createDataKey="createConfigProductAttribute"/>
49+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
50+
</createData>
51+
52+
<createData entity="ApiSimpleOne" stepKey="createConfigChildProduct2">
53+
<requiredEntity createDataKey="createConfigProductAttribute"/>
54+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
55+
</createData>
56+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
57+
<requiredEntity createDataKey="createConfigProduct"/>
58+
<requiredEntity createDataKey="createConfigProductAttribute"/>
59+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
60+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
61+
</createData>
62+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
63+
<requiredEntity createDataKey="createConfigProduct"/>
64+
<requiredEntity createDataKey="createConfigChildProduct1"/>
65+
</createData>
66+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
67+
<requiredEntity createDataKey="createConfigProduct"/>
68+
<requiredEntity createDataKey="createConfigChildProduct2"/>
69+
</createData>
70+
71+
<!-- Create customer -->
72+
<createData entity="Simple_US_Customer" stepKey="createSimpleUsCustomer">
73+
<field key="group_id">1</field>
74+
</createData>
75+
</before>
76+
77+
<after>
78+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
79+
<deleteData createDataKey="simplecategory" stepKey="deleteSimpleCategory"/>
80+
<deleteData createDataKey="createSimpleUsCustomer" stepKey="deleteCustomer"/>
81+
<deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/>
82+
<deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/>
83+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
84+
</after>
85+
86+
<!-- Login as a customer -->
87+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="signUpNewUser">
88+
<argument name="Customer" value="$$createSimpleUsCustomer$$"/>
89+
</actionGroup>
90+
91+
<!-- Go to configurable product page -->
92+
<click userInput="$$simplecategory.name$$" stepKey="clickOnCategoryName"/>
93+
<waitForPageLoad stepKey="waitForCategoryPageLoad"/>
94+
<click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigProduct.name$$)}}" stepKey="browseClickCategoryConfigProductView" after="clickOnCategoryName"/>
95+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
96+
97+
<!-- Order product with single quantity -->
98+
<selectOption userInput="$$createConfigProductAttributeOption1.option[store_labels][1][label]$$" selector="{{StorefrontProductInfoMainSection.optionByAttributeId($$createConfigProductAttribute.attribute_id$$)}}" stepKey="configProductFillOption" />
99+
<click stepKey="addSimpleProductToCart" selector="{{StorefrontProductActionSection.addToCart}}"/>
100+
<waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/>
101+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToShoppingCartPage"/>
102+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
103+
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/>
104+
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
105+
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
106+
<amOnPage url="{{StorefrontCategoryPage.url($$simplecategory.name$$)}}" stepKey="onCategoryPage"/>
107+
<waitForPageLoad stepKey="waitForCategoryLoad"/>
108+
109+
<!-- Wait till cron job runs for schedule updates -->
110+
<wait time="60" stepKey="waitForUpdateStarts"/>
111+
112+
<!-- Assert that product with single quantity is not available for order -->
113+
<click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigProduct.name$$)}}" stepKey="browseClickCategoryConfigProductView2" />
114+
<dontSee userInput="$$createConfigProductAttributeOption1.option[store_labels][1][label]$$" selector="{{StorefrontProductInfoMainSection.optionByAttributeId($$createConfigProductAttribute.attribute_id$$)}}" stepKey="assertOptionNotAvailable" />
115+
</test>
116+
</tests>

0 commit comments

Comments
 (0)