|
| 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="productPrice" value="$$createProduct.price$$"/> |
| 48 | + <argument name="subtotal" value="$$createProduct.price$$" /> |
| 49 | + <argument name="qty" value="1"/> |
| 50 | + </actionGroup> |
| 51 | + </test> |
| 52 | +</tests> |
0 commit comments