Skip to content

Commit 55c67e3

Browse files
committed
AC-5453 :Disabled Inventory Check Onepage Checkout with Out of Stock Product
1 parent fa3d6ec commit 55c67e3

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

app/code/Magento/CatalogInventory/Test/Mftf/Data/CatalogInventoryConfigData.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,12 @@
5353
<data key="path">cataloginventory/item_options/manage_stock</data>
5454
<data key="value">0</data>
5555
</entity>
56+
<entity name="EnableInventoryCheckOnCartLoad">
57+
<data key="path">cataloginventory/options/enable_inventory_check</data>
58+
<data key="value">1</data>
59+
</entity>
60+
<entity name="DisableInventoryCheckOnCartLoad">
61+
<data key="path">cataloginventory/options/enable_inventory_check</data>
62+
<data key="value">0</data>
63+
</entity>
5664
</entities>
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="DisabledInventoryCheckOnePageCheckoutTest">
12+
<annotations>
13+
<features value="Disabled Inventory Check Onepage Checkout with Out of Stock Product"/>
14+
<stories value="Disabled Inventory Check Onepage Checkout with Out of Stock Product"/>
15+
<title value="OnePageCheckoutWithOutOfStockProducts"/>
16+
<description value="Disabling Inventory and Doing Checkout For Out Of Stock Products"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="AC-5453"/>
19+
</annotations>
20+
21+
<before>
22+
<!--Create Category-->
23+
<createData entity="_defaultCategory" stepKey="testCategory"/>
24+
<!-- Create SimpleProductwithPrice100 -->
25+
<createData entity="SimpleProduct_100" stepKey="simpleProductOne">
26+
<requiredEntity createDataKey="testCategory"/>
27+
</createData>
28+
<!-- Assign SimpleProductOne to Category -->
29+
<createData entity="AssignProductToCategory" stepKey="assignSimpleProductOneToTestCategory">
30+
<requiredEntity createDataKey="testCategory"/>
31+
<requiredEntity createDataKey="simpleProductOne"/>
32+
</createData>
33+
<!--Set Enable Inventory Check On Cart Load = No-->
34+
<magentoCLI command="config:set {{DisableInventoryCheckOnCartLoad.path}} {{DisableInventoryCheckOnCartLoad.value}}" stepKey="disableCartLoad"/>
35+
<!-- Cache Flush-->
36+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushConfigCache">
37+
<argument name="tags" value="config"/>
38+
</actionGroup>
39+
</before>
40+
<!--Delete Category, Product and Set Enable Inventory Check On Cart Load = Yes-->
41+
<after>
42+
<magentoCLI command="config:set {{EnableInventoryCheckOnCartLoad.path}} {{EnableInventoryCheckOnCartLoad.value}}" stepKey="enableCartLoad"/>
43+
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
44+
<deleteData createDataKey="simpleProductOne" stepKey="deleteProduct"/>
45+
<deleteData createDataKey="testCategory" stepKey="deleteTestCategory"/>
46+
</after>
47+
48+
<!--Go to product page-->
49+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductFromCategory">
50+
<argument name="productUrlKey" value="$simpleProductOne.custom_attributes[url_key]$"/>
51+
</actionGroup>
52+
<!--Add Product to Shopping Cart-->
53+
<actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage">
54+
<argument name="productName" value="$simpleProductOne.name$"/>
55+
</actionGroup>
56+
<!--Open MiniCart-->
57+
<actionGroup ref="StorefrontOpenMiniCartActionGroup" stepKey="openViewAndEditCart"/>
58+
<!--Go to Checkout-->
59+
<click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="gotocheckout"/>
60+
<!--Filling shipping information and click next-->
61+
<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShipping">
62+
<argument name="shippingMethod" value="Flat Rate"/>
63+
<argument name="customerVar" value="Simple_US_Customer_NY"/>
64+
<argument name="customerAddressVar" value="US_Address_NY"/>
65+
</actionGroup>
66+
<!--Select Payment Method-->
67+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod"/>
68+
<!-- Open and switch to a new browser tab. -->
69+
<openNewTab stepKey="openNewTab"/>
70+
<!-- Open Product From AdminPage-->
71+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
72+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductEditPageinNewTab">
73+
<argument name="productId" value="$simpleProductOne.id$"/>
74+
</actionGroup>
75+
<!-- Set Stock Status of Product to Out Of Stock-->
76+
<actionGroup ref="AdminSetStockStatusActionGroup" stepKey="outOfStockStatus">
77+
<argument name="stockStatus" value="Out of Stock"/>
78+
</actionGroup>
79+
<!-- Save Product-->
80+
<actionGroup ref="SaveProductFormActionGroup" stepKey="clicksaveProduct"/>
81+
<!-- Switch to Previous tab and Check Error message There are no source items with the in stock status* is displayed -->
82+
<switchToPreviousTab stepKey="switchToPreviousTab"/>
83+
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
84+
<see selector="{{CheckoutPaymentSection.errormessage}}" userInput="There are no source items with the in stock status" stepKey="seeErrorMessage"/>
85+
<click selector="{{CheckoutPaymentSection.cartItemsArea}}" stepKey="clickCartItemsArea"/>
86+
<see selector="{{CheckoutPaymentSection.productQuantityInCartBlock}}" userInput="1" stepKey="seeItemQty"/>
87+
88+
</test>
89+
</tests>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,7 @@
6666
<element name="discount" type="block" selector="tr.totals.discount"/>
6767
<element name="discountPrice" type="text" selector=".discount .price"/>
6868
<element name="billingAddressSameAsShippingCashOnDeliveryCheckbox" type="checkbox" selector="#billing-address-same-as-shipping-cashondelivery"/>
69+
<element name="errormessage" type="text" selector="//div[@data-ui-id='checkout-cart-validationmessages-message-error']"/>
70+
<element name="productQuantityInCartBlock" type="text" selector="//div[@class='details-qty']/span[@class='value']" />
6971
</section>
7072
</sections>

0 commit comments

Comments
 (0)