|
| 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="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> |
| 11 | + <test name="CreditMemoTotalAfterShippingDiscountTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Credit memo"/> |
| 14 | + <title value="Verify credit memo grand total after shipping discount is applied via Cart Price Rule"/> |
| 15 | + <description value="Verify credit memo grand total after shipping discount is applied via Cart Price Rule"/> |
| 16 | + <severity value="MAJOR"/> |
| 17 | + <testCaseId value="MAGETWO-92924"/> |
| 18 | + <group value="sales"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 22 | + <createData entity="_defaultProduct" stepKey="createProduct"> |
| 23 | + <requiredEntity createDataKey="createCategory"/> |
| 24 | + </createData> |
| 25 | + <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> |
| 26 | + <actionGroup ref="SetTaxClassForShipping" stepKey="setShippingTaxClass"/> |
| 27 | + </before> |
| 28 | + <after> |
| 29 | + <actionGroup ref="ResetTaxClassForShipping" stepKey="resetTaxClassForShipping"/> |
| 30 | + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteSalesRule"> |
| 31 | + <argument name="ruleName" value="{{ApiSalesRule.name}}"/> |
| 32 | + </actionGroup> |
| 33 | + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> |
| 34 | + <deleteData createDataKey="createCategory" stepKey="deleteProduct1"/> |
| 35 | + <deleteData createDataKey="createProduct" stepKey="deleteCategory1"/> |
| 36 | + </after> |
| 37 | + |
| 38 | + <!-- Create a cart price rule for $10 Fixed amount discount --> |
| 39 | + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> |
| 40 | + <waitForPageLoad stepKey="waitForRulesPage"/> |
| 41 | + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> |
| 42 | + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{ApiSalesRule.name}}" stepKey="fillRuleName"/> |
| 43 | + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsite"/> |
| 44 | + <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="chooseNotLoggedInCustomerGroup"/> |
| 45 | + <!--<selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/>--> |
| 46 | + |
| 47 | + <!-- Open the Actions Tab in the Rules Edit page --> |
| 48 | + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> |
| 49 | + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.applyDiscountToShippingLabel}}" stepKey="waitForElementToBeVisible"/> |
| 50 | + <click selector="{{AdminCartPriceRulesFormSection.applyDiscountToShippingLabel}}" stepKey="enableApplyDiscountToShiping"/> |
| 51 | + <seeCheckboxIsChecked selector="{{AdminCartPriceRulesFormSection.applyDiscountToShipping}}" stepKey="DiscountIsAppliedToShiping"/> |
| 52 | + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount" stepKey="selectActionType"/> |
| 53 | + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="10" stepKey="fillDiscountAmount"/> |
| 54 | + |
| 55 | + <!--<scrollTo selector="{{AdminCartPriceRulesFormSection.applyDiscountToShippingLabel}}" stepKey="scrollToShippingLabel"/>--> |
| 56 | + <!--<click selector="{{AdminCartPriceRulesFormSection.applyDiscountToShippingLabel}}" stepKey="enableApplyDiscountToShiping"/>--> |
| 57 | + <!--<seeCheckboxIsChecked selector="{{AdminCartPriceRulesFormSection.applyDiscountToShipping}}" stepKey="DiscountIsAppliedToShiping"/>--> |
| 58 | + <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> |
| 59 | + <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> |
| 60 | + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> |
| 61 | + |
| 62 | + <!-- Place an order from Storefront as a Guest --> |
| 63 | + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> |
| 64 | + <waitForPageLoad stepKey="waitForPageLoad1"/> |
| 65 | + <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverOverProduct"/> |
| 66 | + <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> |
| 67 | + <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductToAdd"/> |
| 68 | + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> |
| 69 | + <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> |
| 70 | + <waitForPageLoad stepKey="waitForPageLoad2"/> |
| 71 | + <!-- fill out customer information --> |
| 72 | + <fillField selector="{{CheckoutShippingGuestInfoSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/> |
| 73 | + <fillField selector="{{CheckoutShippingGuestInfoSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/> |
| 74 | + <fillField selector="{{CheckoutShippingGuestInfoSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/> |
| 75 | + <fillField selector="{{CheckoutShippingGuestInfoSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/> |
| 76 | + <fillField selector="{{CheckoutShippingGuestInfoSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/> |
| 77 | + <selectOption selector="{{CheckoutShippingGuestInfoSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/> |
| 78 | + <fillField selector="{{CheckoutShippingGuestInfoSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/> |
| 79 | + <fillField selector="{{CheckoutShippingGuestInfoSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/> |
| 80 | + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> |
| 81 | + |
| 82 | + <!-- Choose Shippping - Flat Rate Shipping --> |
| 83 | + <click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> |
| 84 | + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> |
| 85 | + <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/> |
| 86 | + <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/> |
| 87 | + <waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> |
| 88 | + <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> |
| 89 | + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> |
| 90 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> |
| 91 | + |
| 92 | + <!-- Search for Order in the order grid --> |
| 93 | + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> |
| 94 | + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask3"/> |
| 95 | + <fillField selector="{{AdminOrdersGridSection.search}}" userInput="{$grabOrderNumber}" stepKey="searchOrderNum"/> |
| 96 | + <click selector="{{AdminOrdersGridSection.submitSearch}}" stepKey="submitSearch"/> |
| 97 | + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask4"/> |
| 98 | + |
| 99 | + <!-- Create invoice --> |
| 100 | + <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> |
| 101 | + <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/> |
| 102 | + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoiceInPageTitle" after="clickInvoiceButton"/> |
| 103 | + |
| 104 | + <!-- Verify Invoice Totals including subTotal Shipping Discount and GrandTotal --> |
| 105 | + <see selector="{{AdminInvoiceTotalSection.total('Subtotal')}}" userInput="${{AdminOrderSimpleProduct.subtotal}}" stepKey="seeInvoiceSubTotal"/> |
| 106 | + <comment userInput="Shipping and Handling" stepKey="commentViewShippingAndHandling" after="seeInvoiceSubTotal"/> |
| 107 | + <see selector="{{AdminInvoiceTotalSection.total('Shipping')}}" userInput="${{AdminOrderSimpleProduct.shipping}}" stepKey="seeShippingAndHandling"/> |
| 108 | + <scrollTo selector="{{AdminInvoiceTotalSection.total('Shipping')}}" stepKey="scrollToInvoiceTotals"/> |
| 109 | + <grabTextFrom selector="{{AdminInvoiceTotalSection.total('Shipping')}}" stepKey="grabShippingCost"/> |
| 110 | + <assertEquals expected='$5.00' expectedType="string" actual="($grabShippingCost)" message="ExpectedShipping" stepKey="assertShippingAndHandling"/> |
| 111 | + |
| 112 | + <see selector="{{AdminInvoiceTotalSection.total('Discount')}}" userInput="-$15.00" stepKey="seeShippingAndHandling2"/> |
| 113 | + <grabTextFrom selector="{{AdminInvoiceTotalSection.total('Discount')}}" stepKey="grabInvoiceDiscount"/> |
| 114 | + <assertEquals expected='-$15.00' expectedType="string" actual="($grabInvoiceDiscount)" message="ExpectedDiscount" stepKey="assertDiscountValue"/> |
| 115 | + |
| 116 | + <see selector="{{AdminInvoiceTotalSection.grandTotal}}" userInput="$113.00" stepKey="seeCorrectGrandTotal"/> |
| 117 | + <grabTextFrom selector="{{AdminInvoiceTotalSection.grandTotal}}" stepKey="grabInvoiceGrandTotal" after="seeCorrectGrandTotal"/> |
| 118 | + |
| 119 | + <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> |
| 120 | + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessMessage1"/> |
| 121 | + |
| 122 | + <!--Create Credit Memo--> |
| 123 | + <comment userInput="Admin creates credit memo" stepKey="createCreditMemoComment"/> |
| 124 | + <click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="clickCreateCreditMemo" after="createCreditMemoComment"/> |
| 125 | + <seeInCurrentUrl url="{{AdminCreditMemoNewPage.url}}" stepKey="seeNewCreditMemoPage" after="clickCreateCreditMemo"/> |
| 126 | + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Memo" stepKey="seeNewMemoInPageTitle" after="seeNewCreditMemoPage"/> |
| 127 | + |
| 128 | + <!-- Verify Refund Totals --> |
| 129 | + <see selector="{{AdminCreditMemoTotalSection.total('Subtotal')}}" userInput="${{AdminOrderSimpleProduct.subtotal}}" stepKey="seeRefundSubTotal"/> |
| 130 | + <grabTextFrom selector="{{AdminCreditMemoTotalSection.total('Discount')}}" stepKey="grabRefundDiscountValue"/> |
| 131 | + <assertEquals expected='-$15.00' expectedType="string" actual="($grabRefundDiscountValue)" message="notExpectedDiscountOnRefundPage" stepKey="assertDiscountValue1"/> |
| 132 | + <grabTextFrom selector="{{AdminInvoiceTotalSection.grandTotal}}" stepKey="grabRefundGrandTotal"/> |
| 133 | + <assertEquals expected="($grabInvoiceGrandTotal)" actual="($grabRefundGrandTotal)" message="RefundGrandTotalMatchesWithInvoiceGrandTotal" stepKey="compareRefundGrandTotalAndInvoiceGrandTotal"/> |
| 134 | + </test> |
| 135 | +</tests> |
| 136 | + |
0 commit comments