|
| 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="StorefrontApplyPromoCodeDuringCheckoutTest"> |
| 12 | + <annotations> |
| 13 | + <features value="OnePageCheckout"/> |
| 14 | + <stories value="OnePageCheckout with Promo Code"/> |
| 15 | + <title value="Storefront apply promo code during checkout test"/> |
| 16 | + <description value="Apply promo code during checkout for physical product"/> |
| 17 | + <severity value="CRITICAL"/> |
| 18 | + <testCaseId value="MC-13212"/> |
| 19 | + <group value="checkout"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Create simple product --> |
| 23 | + <createData entity="SimpleProduct2" stepKey="createProduct"> |
| 24 | + <field key="price">10.00</field> |
| 25 | + </createData> |
| 26 | + |
| 27 | + <!-- Create cart price rule --> |
| 28 | + <createData entity="ActiveSalesRuleForNotLoggedIn" stepKey="createCartPriceRule"/> |
| 29 | + <createData entity="SimpleSalesRuleCoupon" stepKey="createCouponForCartPriceRule"> |
| 30 | + <requiredEntity createDataKey="createCartPriceRule"/> |
| 31 | + </createData> |
| 32 | + </before> |
| 33 | + <after> |
| 34 | + <!-- Delete simple product --> |
| 35 | + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> |
| 36 | + |
| 37 | + <!-- Delete sales rule --> |
| 38 | + <deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/> |
| 39 | + |
| 40 | + <!-- Admin log out --> |
| 41 | + <actionGroup ref="logout" stepKey="logout"/> |
| 42 | + </after> |
| 43 | + |
| 44 | + <!-- Go to Storefront as Guest and add simple product to cart --> |
| 45 | + <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> |
| 46 | + <argument name="product" value="$$createProduct$$"/> |
| 47 | + </actionGroup> |
| 48 | + |
| 49 | + <!-- Go to Checkout --> |
| 50 | + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> |
| 51 | + |
| 52 | + <!-- Fill all required fields with valid data and select Flat Rate, price = 5, shipping --> |
| 53 | + <actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShipping"> |
| 54 | + <argument name="shippingMethod" value="Flat Rate"/> |
| 55 | + </actionGroup> |
| 56 | + |
| 57 | + <!-- Click Apply Discount Code: section is expanded. Input promo code, apply and see success message --> |
| 58 | + <actionGroup ref="StorefrontApplyDiscountCodeActionGroup" stepKey="applyCoupon"> |
| 59 | + <argument name="discountCode" value="$$createCouponForCartPriceRule.code$$"/> |
| 60 | + </actionGroup> |
| 61 | + |
| 62 | + <!-- Apply button is disappeared --> |
| 63 | + <dontSeeElement selector="{{DiscountSection.ApplyCodeBtn}}" stepKey="dontSeeApplyButton"/> |
| 64 | + |
| 65 | + <!-- Cancel coupon button is appeared --> |
| 66 | + <seeElement selector="{{DiscountSection.CancelCouponBtn}}" stepKey="seeCancelCouponButton"/> |
| 67 | + |
| 68 | + <!-- Order summary contains information about applied code --> |
| 69 | + <seeElement selector="{{CheckoutPaymentSection.discount}}" stepKey="seeDiscountCouponInSummaryBlock"/> |
| 70 | + <see selector="{{CheckoutPaymentSection.discountPrice}}" userInput="-$5.00" stepKey="seeDiscountPrice"/> |
| 71 | + |
| 72 | + <!-- Select payment solution --> |
| 73 | + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="clickCheckMoneyOrderPayment"/> |
| 74 | + |
| 75 | + <!-- Place Order: order is successfully placed --> |
| 76 | + <actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/> |
| 77 | + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> |
| 78 | + |
| 79 | + <!-- Login as admin --> |
| 80 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 81 | + |
| 82 | + <!-- Verify total on order page --> |
| 83 | + <actionGroup ref="filterOrderGridById" stepKey="filterOrderById"> |
| 84 | + <argument name="orderId" value="$grabOrderNumber"/> |
| 85 | + </actionGroup> |
| 86 | + <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> |
| 87 | + <waitForPageLoad stepKey="waitForAdminOrderPageLoad"/> |
| 88 | + <scrollTo selector="{{AdminOrderTotalSection.grandTotal}}" stepKey="scrollToOrderTotalSection"/> |
| 89 | + <see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$$createProduct.price$$" stepKey="checkTotal"/> |
| 90 | + </test> |
| 91 | +</tests> |
0 commit comments