|
| 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 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 9 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 10 | + <test name="StorefrontZeroPriceProductWithDiscountUsingCartPriceRuleTest"> |
| 11 | + <annotations> |
| 12 | + <features value="SalesRule"/> |
| 13 | + <stories value="Create cart price rule"/> |
| 14 | + <title value="Zero price product should not have negative discount amount in order"/> |
| 15 | + <description value="Zero price product should not have negative discount amount in order"/> |
| 16 | + <severity value="MINOR"/> |
| 17 | + <testCaseId value="MC-42802"/> |
| 18 | + <useCaseId value="MC-42612"/> |
| 19 | + <group value="SalesRule"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- log in --> |
| 23 | + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> |
| 24 | + <!--Create 2 simple products--> |
| 25 | + <createData entity="SimpleProduct2" stepKey="simpleProduct1"> |
| 26 | + <field key="price">33.50</field> |
| 27 | + </createData> |
| 28 | + <createData entity="SimpleProduct2" stepKey="simpleProduct2"> |
| 29 | + <field key="price">0.00</field> |
| 30 | + </createData> |
| 31 | + <!--Create the sales rule--> |
| 32 | + <createData entity="SalesRuleSpecificCouponAndByPercent25" stepKey="createSalesRule"/> |
| 33 | + <createData entity="SimpleSalesRuleCoupon" stepKey="createCouponForCartPriceRule"> |
| 34 | + <requiredEntity createDataKey="createSalesRule"/> |
| 35 | + </createData> |
| 36 | + </before> |
| 37 | + <after> |
| 38 | + <deleteData createDataKey="simpleProduct1" stepKey="DeleteSimpleProduct1" /> |
| 39 | + <deleteData createDataKey="simpleProduct2" stepKey="DeleteSimpleProduct2" /> |
| 40 | + <deleteData createDataKey="createSalesRule" stepKey="deleteSalesRule"/> |
| 41 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 42 | + </after> |
| 43 | + |
| 44 | + <!-- Add the first product to the cart --> |
| 45 | + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToProductPage1"> |
| 46 | + <argument name="product" value="$$simpleProduct1$$"/> |
| 47 | + </actionGroup> |
| 48 | + <waitForPageLoad stepKey="waitForProductPageLoad1"/> |
| 49 | + <actionGroup ref="StorefrontClickAddToCartOnProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage"/> |
| 50 | + |
| 51 | + <!-- Add the second product to the cart --> |
| 52 | + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToProductPage2"> |
| 53 | + <argument name="product" value="$$simpleProduct2$$"/> |
| 54 | + </actionGroup> |
| 55 | + <waitForPageLoad stepKey="waitForProductPageLoad2"/> |
| 56 | + <actionGroup ref="StorefrontClickAddToCartOnProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage2"/> |
| 57 | + |
| 58 | + <!-- Go to cart and apply coupon --> |
| 59 | + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart"/> |
| 60 | + <actionGroup ref="StorefrontApplyCouponActionGroup" stepKey="applyDiscount"> |
| 61 | + <argument name="coupon" value="$$createCouponForCartPriceRule$$"/> |
| 62 | + </actionGroup> |
| 63 | + |
| 64 | + <!-- Assert Discount amount in storefront--> |
| 65 | + <actionGroup ref="AssertStorefrontCartDiscountActionGroup" stepKey="seeDiscountTotal"> |
| 66 | + <argument name="discount" value="8.38"/> |
| 67 | + </actionGroup> |
| 68 | + |
| 69 | + <!-- Go to Checkout page --> |
| 70 | + <actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/> |
| 71 | + <actionGroup ref="StorefrontClickProceedToCheckoutActionGroup" stepKey="clickProceedToCheckout"/> |
| 72 | + |
| 73 | + <!-- Fill email field and addresses form and go next --> |
| 74 | + <actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShipping"> |
| 75 | + <argument name="shippingMethod" value="Flat Rate"/> |
| 76 | + </actionGroup> |
| 77 | + |
| 78 | + <!-- Place Order --> |
| 79 | + <actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickOnPlaceOrder"/> |
| 80 | + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> |
| 81 | + |
| 82 | + <!-- Navigate to admin order details page --> |
| 83 | + <actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openOrderById"> |
| 84 | + <argument name="entityId" value="$grabOrderNumber"/> |
| 85 | + </actionGroup> |
| 86 | + |
| 87 | + <!-- Assert Discount amount in admin--> |
| 88 | + <see selector="{{AdminOrderItemsOrderedSection.itemDiscountAmountByProductName($simpleProduct1.name$)}}" userInput="$8.38" stepKey="seeProduct1DiscountAmount"/> |
| 89 | + <see selector="{{AdminOrderItemsOrderedSection.itemDiscountAmountByProductName($simpleProduct2.name$)}}" userInput="$0.00" stepKey="seeProduct2DiscountAmount"/> |
| 90 | + <see selector="{{AdminOrderTotalSection.discount}}" userInput="-$8.38" stepKey="seeDiscountAmount"/> |
| 91 | + |
| 92 | + </test> |
| 93 | +</tests> |
0 commit comments