Skip to content

Commit 9f1fa18

Browse files
ENGCOM-9150: [MFTF] Add product to the Cart if Backorders are allowed on Product level and Product Qty<=0 #33431
2 parents f3ee1e5 + d4243fb commit 9f1fa18

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminSetBackordersOnProductAdvancedInventoryActionGroup">
12+
<annotations>
13+
<description>Deselects the "Use Config Settings" checkbox and set the "Backorders" select value to required</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="backorders" type="string" defaultValue="Allow Qty Below 0"/>
17+
</arguments>
18+
19+
<uncheckOption selector="{{AdminProductFormAdvancedInventorySection.useConfigSettingsForBackorders}}" stepKey="uncheckUseConfigSettings"/>
20+
<selectOption selector="{{AdminProductFormAdvancedInventorySection.backorders}}" userInput="{{backorders}}" stepKey="fillBackorders"/>
21+
</actionGroup>
22+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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="StorefrontAddProductWithBackordersAllowedOnProductLevelToCartTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Manage inventory, backorders"/>
15+
<title value="Add Product to Cart, Backorders Allowed On Product Level"/>
16+
<severity value="MAJOR"/>
17+
<description value="Customer should be able to add products to Cart if product qty less or equal 0 and Backorders are allowed on Product level"/>
18+
<group value="catalog"/>
19+
</annotations>
20+
21+
<before>
22+
<createData entity="SimpleProductInStockQuantityZero" stepKey="createProduct"/>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
</before>
25+
26+
<after>
27+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
28+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
29+
</after>
30+
31+
<actionGroup ref="NavigateToCreatedProductEditPageActionGroup" stepKey="openCreatedProductEditPage">
32+
<argument name="product" value="$$createProduct$$"/>
33+
</actionGroup>
34+
<actionGroup ref="AdminClickOnAdvancedInventoryLinkActionGroup" stepKey="clickOnAdvancedInventoryLink"/>
35+
<actionGroup ref="AdminSetBackordersOnProductAdvancedInventoryActionGroup" stepKey="allowBackorders"/>
36+
<actionGroup ref="AdminFillAdvancedInventoryQtyActionGroup" stepKey="fillProductQty">
37+
<argument name="qty" value="-5"/>
38+
</actionGroup>
39+
<actionGroup ref="AdminSubmitAdvancedInventoryFormActionGroup" stepKey="clickDoneButton"/>
40+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
41+
42+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="gotoAndAddProductToCart">
43+
<argument name="product" value="$$createProduct$$"/>
44+
</actionGroup>
45+
46+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="gotoCart"/>
47+
<actionGroup ref="AssertStorefrontCheckoutCartItemsActionGroup" stepKey="assertProductItemInCheckOutCart">
48+
<argument name="productName" value="$$createProduct.name$$"/>
49+
<argument name="productSku" value="$$createProduct.sku$$"/>
50+
<argument name="productPrice" value="$$createProduct.price$$"/>
51+
<argument name="subtotal" value="$$createProduct.price$$" />
52+
<argument name="qty" value="1"/>
53+
</actionGroup>
54+
</test>
55+
</tests>

app/code/Magento/CatalogInventory/Test/Mftf/Section/AdminProductFormAdvancedInventorySection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,7 @@
3232
<element name="minQtyConfigSetting" type="checkbox" selector="//input[@name='product[stock_data][use_config_min_qty]']" timeout="30"/>
3333
<element name="advancedInventoryModal" type="block" selector=".product_form_product_form_advanced_inventory_modal[data-role=modal]"/>
3434
<element name="maxiQtyAllowedInCartError" type="text" selector="[name='product[stock_data][max_sale_qty]'] + label.admin__field-error"/>
35+
<element name="backorders" type="select" selector="//*[@name='product[stock_data][backorders]']"/>
36+
<element name="useConfigSettingsForBackorders" type="checkbox" selector="//input[@name='product[stock_data][use_config_backorders]']"/>
3537
</section>
3638
</sections>

0 commit comments

Comments
 (0)