Skip to content

Commit 56c8866

Browse files
authored
Merge pull request magento#102 from magento-pangolin/MC-11063
MC-11063
2 parents 06de7e3 + b6fce58 commit 56c8866

File tree

6 files changed

+106
-0
lines changed

6 files changed

+106
-0
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductToCartActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<argument name="product" defaultValue="product"/>
1313
</arguments>
1414
<amOnPage url="{{StorefrontProductPage.url(product.custom_attributes[url_key])}}" stepKey="goToProductPage"/>
15+
<waitForPageLoad stepKey="waitForProductPage"/>
1516
<click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart"/>
1617
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/>
1718
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="CatalogInventoryOptionsShowOutOfStockEnable">
12+
<data key="path">cataloginventory/options/show_out_of_stock</data>
13+
<data key="label">Yes</data>
14+
<data key="value">1</data>
15+
</entity>
16+
<entity name="CatalogInventoryOptionsShowOutOfStockDisable">
17+
<!-- Magento default value -->
18+
<data key="path">cataloginventory/options/show_out_of_stock</data>
19+
<data key="label">No</data>
20+
<data key="value">0</data>
21+
</entity>
22+
<entity name="CatalogInventoryItemOptionsBackordersEnable">
23+
<data key="path">cataloginventory/item_options/backorders</data>
24+
<data key="label">Yes</data>
25+
<data key="value">1</data>
26+
</entity>
27+
<entity name="CatalogInventoryItemOptionsBackordersDisable">
28+
<!-- Magento default value -->
29+
<data key="path">cataloginventory/item_options/backorders</data>
30+
<data key="label">No</data>
31+
<data key="value">0</data>
32+
</entity>
33+
</entities>

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,18 @@
153153
<data key="status">1</data>
154154
<data key="quantity">0</data>
155155
</entity>
156+
<entity name="SimpleProductInStockQuantityZero" type="product">
157+
<data key="sku" unique="suffix">testSku</data>
158+
<data key="type_id">simple</data>
159+
<data key="attribute_set_id">4</data>
160+
<data key="visibility">4</data>
161+
<data key="name" unique="suffix">SimpleProductInStockQuantityZero</data>
162+
<data key="price">123.00</data>
163+
<data key="urlKey" unique="suffix">SimpleProductInStockQuantityZero</data>
164+
<data key="status">1</data>
165+
<data key="quantity">0</data>
166+
<requiredEntity type="product_extension_attribute">EavStock0</requiredEntity>
167+
</entity>
156168
<!-- Simple Product Disabled -->
157169
<entity name="SimpleProductOffline" type="product2">
158170
<data key="sku" unique="suffix">testSku</data>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
<entity name="EavStock1" type="product_extension_attribute">
2121
<requiredEntity type="stock_item">Qty_1</requiredEntity>
2222
</entity>
23+
<entity name="EavStock0" type="product_extension_attribute">
24+
<requiredEntity type="stock_item">Qty_0</requiredEntity>
25+
</entity>
2326
<entity name="EavStock777" type="product_extension_attribute">
2427
<requiredEntity type="stock_item">Qty_777</requiredEntity>
2528
</entity>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
<data key="qty">1</data>
3333
<data key="is_in_stock">true</data>
3434
</entity>
35+
<entity name="Qty_0" type="stock_item">
36+
<data key="qty">0</data>
37+
<data key="is_in_stock">true</data>
38+
</entity>
3539
<entity name="Qty_777" type="stock_item">
3640
<data key="qty">777</data>
3741
<data key="is_in_stock">true</data>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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="AdminBackorderAllowedAddProductToCartTest">
12+
<annotations>
13+
<stories value="Manage products"/>
14+
<title value="Add Product to Cart, Backorder Allowed"/>
15+
<description value="Customer should be able to add products to cart when that products quantity is zero"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="MC-11063"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
21+
<before>
22+
<!-- Create a product that is "In Stock" but has quantity zero -->
23+
<createData entity="SimpleProductInStockQuantityZero" stepKey="createProduct"/>
24+
25+
<!-- Configure Magento to show out of stock products and to allow backorders -->
26+
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockEnable.path}} {{CatalogInventoryOptionsShowOutOfStockEnable.value}}" stepKey="setConfigShowOutOfStockTrue"/>
27+
<magentoCLI command="config:set {{CatalogInventoryItemOptionsBackordersEnable.path}} {{CatalogInventoryItemOptionsBackordersEnable.value}}" stepKey="setConfigAllowBackordersTrue"/>
28+
</before>
29+
30+
<after>
31+
<!-- Set Magento back to default configuration -->
32+
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockDisable.path}} {{CatalogInventoryOptionsShowOutOfStockDisable.value}}" stepKey="setConfigShowOutOfStockFalse"/>
33+
<magentoCLI command="config:set {{CatalogInventoryItemOptionsBackordersDisable.path}} {{CatalogInventoryItemOptionsBackordersDisable.value}}" stepKey="setConfigAllowBackordersFalse"/>
34+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
35+
</after>
36+
37+
<!-- Go to the storefront and add the product to the cart -->
38+
<actionGroup ref="AddSimpleProductToCart" stepKey="gotoAndAddProductToCart">
39+
<argument name="product" value="$$createProduct$$"/>
40+
</actionGroup>
41+
42+
<!-- Go to the cart page and verify we see the product -->
43+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="gotoCart"/>
44+
<waitForPageLoad stepKey="waitForCartLoad"/>
45+
<actionGroup ref="AssertStorefrontCheckoutCartItemsActionGroup" stepKey="assertProductItemInCheckOutCart">
46+
<argument name="productName" value="$$createProduct.name$$"/>
47+
<argument name="productSku" value="$$createProduct.sku$$"/>
48+
<argument name="productPrice" value="$$createProduct.price$$"/>
49+
<argument name="subtotal" value="$$createProduct.price$$" />
50+
<argument name="qty" value="1"/>
51+
</actionGroup>
52+
</test>
53+
</tests>

0 commit comments

Comments
 (0)