Skip to content

Commit

Permalink
Merge pull request magento#102 from magento-pangolin/MC-11063
Browse files Browse the repository at this point in the history
MC-11063
  • Loading branch information
tomreece authored May 3, 2019
2 parents 06de7e3 + b6fce58 commit 56c8866
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<argument name="product" defaultValue="product"/>
</arguments>
<amOnPage url="{{StorefrontProductPage.url(product.custom_attributes[url_key])}}" stepKey="goToProductPage"/>
<waitForPageLoad stepKey="waitForProductPage"/>
<click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart"/>
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/>
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
<entity name="CatalogInventoryOptionsShowOutOfStockEnable">
<data key="path">cataloginventory/options/show_out_of_stock</data>
<data key="label">Yes</data>
<data key="value">1</data>
</entity>
<entity name="CatalogInventoryOptionsShowOutOfStockDisable">
<!-- Magento default value -->
<data key="path">cataloginventory/options/show_out_of_stock</data>
<data key="label">No</data>
<data key="value">0</data>
</entity>
<entity name="CatalogInventoryItemOptionsBackordersEnable">
<data key="path">cataloginventory/item_options/backorders</data>
<data key="label">Yes</data>
<data key="value">1</data>
</entity>
<entity name="CatalogInventoryItemOptionsBackordersDisable">
<!-- Magento default value -->
<data key="path">cataloginventory/item_options/backorders</data>
<data key="label">No</data>
<data key="value">0</data>
</entity>
</entities>
12 changes: 12 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@
<data key="status">1</data>
<data key="quantity">0</data>
</entity>
<entity name="SimpleProductInStockQuantityZero" type="product">
<data key="sku" unique="suffix">testSku</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="visibility">4</data>
<data key="name" unique="suffix">SimpleProductInStockQuantityZero</data>
<data key="price">123.00</data>
<data key="urlKey" unique="suffix">SimpleProductInStockQuantityZero</data>
<data key="status">1</data>
<data key="quantity">0</data>
<requiredEntity type="product_extension_attribute">EavStock0</requiredEntity>
</entity>
<!-- Simple Product Disabled -->
<entity name="SimpleProductOffline" type="product2">
<data key="sku" unique="suffix">testSku</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<entity name="EavStock1" type="product_extension_attribute">
<requiredEntity type="stock_item">Qty_1</requiredEntity>
</entity>
<entity name="EavStock0" type="product_extension_attribute">
<requiredEntity type="stock_item">Qty_0</requiredEntity>
</entity>
<entity name="EavStock777" type="product_extension_attribute">
<requiredEntity type="stock_item">Qty_777</requiredEntity>
</entity>
Expand Down
4 changes: 4 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/StockItemData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<data key="qty">1</data>
<data key="is_in_stock">true</data>
</entity>
<entity name="Qty_0" type="stock_item">
<data key="qty">0</data>
<data key="is_in_stock">true</data>
</entity>
<entity name="Qty_777" type="stock_item">
<data key="qty">777</data>
<data key="is_in_stock">true</data>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?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="AdminBackorderAllowedAddProductToCartTest">
<annotations>
<stories value="Manage products"/>
<title value="Add Product to Cart, Backorder Allowed"/>
<description value="Customer should be able to add products to cart when that products quantity is zero"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-11063"/>
<group value="mtf_migrated"/>
</annotations>

<before>
<!-- Create a product that is "In Stock" but has quantity zero -->
<createData entity="SimpleProductInStockQuantityZero" stepKey="createProduct"/>

<!-- Configure Magento to show out of stock products and to allow backorders -->
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockEnable.path}} {{CatalogInventoryOptionsShowOutOfStockEnable.value}}" stepKey="setConfigShowOutOfStockTrue"/>
<magentoCLI command="config:set {{CatalogInventoryItemOptionsBackordersEnable.path}} {{CatalogInventoryItemOptionsBackordersEnable.value}}" stepKey="setConfigAllowBackordersTrue"/>
</before>

<after>
<!-- Set Magento back to default configuration -->
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockDisable.path}} {{CatalogInventoryOptionsShowOutOfStockDisable.value}}" stepKey="setConfigShowOutOfStockFalse"/>
<magentoCLI command="config:set {{CatalogInventoryItemOptionsBackordersDisable.path}} {{CatalogInventoryItemOptionsBackordersDisable.value}}" stepKey="setConfigAllowBackordersFalse"/>
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
</after>

<!-- Go to the storefront and add the product to the cart -->
<actionGroup ref="AddSimpleProductToCart" stepKey="gotoAndAddProductToCart">
<argument name="product" value="$$createProduct$$"/>
</actionGroup>

<!-- Go to the cart page and verify we see the product -->
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="gotoCart"/>
<waitForPageLoad stepKey="waitForCartLoad"/>
<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>

0 comments on commit 56c8866

Please sign in to comment.