Skip to content

[MFTF] Add product to the Cart if Backorders are allowed on Product level and Product Qty<=0 #33431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminSetBackordersOnProductAdvancedInventoryActionGroup">
<annotations>
<description>Deselects the "Use Config Settings" checkbox and set the "Backorders" select value to required</description>
</annotations>
<arguments>
<argument name="backorders" type="string" defaultValue="Allow Qty Below 0"/>
</arguments>

<uncheckOption selector="{{AdminProductFormAdvancedInventorySection.useConfigSettingsForBackorders}}" stepKey="uncheckUseConfigSettings"/>
<selectOption selector="{{AdminProductFormAdvancedInventorySection.backorders}}" userInput="{{backorders}}" stepKey="fillBackorders"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontAddProductWithBackordersAllowedOnProductLevelToCartTest">
<annotations>
<features value="Catalog"/>
<stories value="Manage inventory, backorders"/>
<title value="Add Product to Cart, Backorders Allowed On Product Level"/>
<severity value="MAJOR"/>
<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"/>
<group value="catalog"/>
</annotations>

<before>
<createData entity="SimpleProductInStockQuantityZero" stepKey="createProduct"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</before>

<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
</after>

<actionGroup ref="NavigateToCreatedProductEditPageActionGroup" stepKey="openCreatedProductEditPage">
<argument name="product" value="$$createProduct$$"/>
</actionGroup>
<actionGroup ref="AdminClickOnAdvancedInventoryLinkActionGroup" stepKey="clickOnAdvancedInventoryLink"/>
<actionGroup ref="AdminSetBackordersOnProductAdvancedInventoryActionGroup" stepKey="allowBackorders"/>
<actionGroup ref="AdminFillAdvancedInventoryQtyActionGroup" stepKey="fillProductQty">
<argument name="qty" value="-5"/>
</actionGroup>
<actionGroup ref="AdminSubmitAdvancedInventoryFormActionGroup" stepKey="clickDoneButton"/>
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>

<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="gotoAndAddProductToCart">
<argument name="product" value="$$createProduct$$"/>
</actionGroup>

<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="gotoCart"/>
<actionGroup ref="AssertStorefrontCheckoutCartItemsActionGroup" stepKey="assertProductItemInCheckOutCart">
<argument name="productName" value="$$createProduct.name$$"/>
<argument name="productSku" value="$$createProduct.sku$$"/>
<argument name="productPrice" value="$$createProduct.price$$"/>
<argument name="subtotal" value="$$createProduct.price$$" />
<argument name="qty" value="1"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@
<element name="minQtyConfigSetting" type="checkbox" selector="//input[@name='product[stock_data][use_config_min_qty]']" timeout="30"/>
<element name="advancedInventoryModal" type="block" selector=".product_form_product_form_advanced_inventory_modal[data-role=modal]"/>
<element name="maxiQtyAllowedInCartError" type="text" selector="[name='product[stock_data][max_sale_qty]'] + label.admin__field-error"/>
<element name="backorders" type="select" selector="//*[@name='product[stock_data][backorders]']"/>
<element name="useConfigSettingsForBackorders" type="checkbox" selector="//input[@name='product[stock_data][use_config_backorders]']"/>
</section>
</sections>