|
| 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="CheckCreditMemoTotalsTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Tax"/> |
| 14 | + <stories value="MAGETWO-91769 - Credit Memo - Wrong tax calculation! #10982"/> |
| 15 | + <title value="Checking Credit memo Totals"/> |
| 16 | + <description value="Checking Credit memo Totals"/> |
| 17 | + <severity value="MAJOR"/> |
| 18 | + <testCaseId value="MAGETWO-95175"/> |
| 19 | + <group value="creditMemo"/> |
| 20 | + <group value="tax"/> |
| 21 | + </annotations> |
| 22 | + <before> |
| 23 | + <!--Create category and product--> |
| 24 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 25 | + <createData entity="_defaultProduct" stepKey="createSimpleProduct"> |
| 26 | + <requiredEntity createDataKey="createCategory"/> |
| 27 | + </createData> |
| 28 | + <!--Create customer--> |
| 29 | + <createData entity="Simple_US_Customer_NY" stepKey="createCustomer"/> |
| 30 | + <!--Login as admin--> |
| 31 | + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> |
| 32 | + <!--Create tax rule and tax rate--> |
| 33 | + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> |
| 34 | + <waitForPageLoad stepKey="waitForTaxRatePage"/> |
| 35 | + <click stepKey="addNewTaxRate" selector="{{AdminGridMainControls.add}}"/> |
| 36 | + <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="SampleRule"/> |
| 37 | + <actionGroup ref="addCustomTaxRate" stepKey="addCustomTaxRate"> |
| 38 | + <argument name="taxCode" value="SimpleTaxNY"/> |
| 39 | + </actionGroup> |
| 40 | + <click stepKey="expandAdditionalSettings" selector="{{AdminProductTaxClassSection.additionalSettings}}"/> |
| 41 | + <waitForPageLoad stepKey="waitForPageLoad"/> |
| 42 | + <click selector="{{AdminProductTaxClassSection.productTaxClass}}" stepKey="ClickToAddTaxClass"/> |
| 43 | + <fillField selector="{{AdminProductTaxClassSection.TaxClassName}}" userInput="NewTaxClass" stepKey="setName"/> |
| 44 | + <click selector="{{AdminProductTaxClassSection.confirm}}" stepKey="ClickToDone"/> |
| 45 | + <click stepKey="clickSave" selector="{{AdminStoresMainActionsSection.saveButton}}"/> |
| 46 | + <waitForPageLoad stepKey="waitForTaxRatePage1"/> |
| 47 | + <see userInput="You saved the tax rule." stepKey="VerifyRuleSaved"/> |
| 48 | + <!--Search and edit product to add new created tax rule--> |
| 49 | + <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct"> |
| 50 | + <argument name="product" value="$$createSimpleProduct$$"/> |
| 51 | + </actionGroup> |
| 52 | + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="OpenEditProductOnBackend"> |
| 53 | + <argument name="product" value="$$createSimpleProduct$$"/> |
| 54 | + </actionGroup> |
| 55 | + <waitForPageLoad stepKey="waitForPageLoad2"/> |
| 56 | + <selectOption selector="{{AdminProductFormActionSection.selectTaxClass}}" userInput="NewTaxClass" stepKey="SetNewTaxClass" /> |
| 57 | + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> |
| 58 | + <!--Set configs--> |
| 59 | + <amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToTaxConfigPage"/> |
| 60 | + <conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.taxClasses}}" dependentSelector="{{AdminConfigureTaxSection.taxClassesCondition}}" visible="false"/> |
| 61 | + <click selector="{{AdminConfigureTaxSection.useSystemValue}}" stepKey="UncheckUseSystemValue"/> |
| 62 | + <selectOption selector="{{AdminConfigureTaxSection.productTaxClass}}" userInput="NewTaxClass" stepKey="selectClass"/> |
| 63 | + <click selector="{{AdminConfigureTaxSection.save}}" stepKey="saveConfig"/> |
| 64 | + <!--flash cache--> |
| 65 | + <magentoCLI command="cache:flush" stepKey="flushCache"/> |
| 66 | + </before> |
| 67 | + <after> |
| 68 | + <!--Delete category and product--> |
| 69 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 70 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> |
| 71 | + <!--Delete customer--> |
| 72 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 73 | + <!-- Reset admin order filter --> |
| 74 | + <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/> |
| 75 | + <!--Roll Back configuration--> |
| 76 | + <amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToTaxConfigPage"/> |
| 77 | + <conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.taxClasses}}" dependentSelector="{{AdminConfigureTaxSection.taxClassesCondition}}" visible="false"/> |
| 78 | + <selectOption selector="{{AdminConfigureTaxSection.productTaxClass}}" userInput="Taxable Goods" stepKey="selectClass"/> |
| 79 | + <click selector="{{AdminConfigureTaxSection.save}}" stepKey="saveConfig"/> |
| 80 | + <!-- Go to the tax rule page and delete the row we created--> |
| 81 | + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulesPage"/> |
| 82 | + <waitForPageLoad stepKey="waitForRulesPage"/> |
| 83 | + <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteRule"> |
| 84 | + <argument name="name" value="SampleRule"/> |
| 85 | + <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> |
| 86 | + </actionGroup> |
| 87 | + <!-- Go to the tax rate page --> |
| 88 | + <amOnPage url="{{AdminTaxRateGridPage.url}}" stepKey="goToTaxRatesPage"/> |
| 89 | + <waitForPageLoad stepKey="waitForRatesPage"/> |
| 90 | + <!-- Delete tax rate that were created --> |
| 91 | + <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteNYRate"> |
| 92 | + <argument name="name" value="{{SimpleTaxNY.state}}"/> |
| 93 | + <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> |
| 94 | + </actionGroup> |
| 95 | + <actionGroup ref="deleteProductTaxClass" stepKey="deleteFirstProductTaxClass"> |
| 96 | + <argument name="taxClassName" value="NewTaxClass"/> |
| 97 | + </actionGroup> |
| 98 | + <!--logout--> |
| 99 | + <actionGroup ref="logout" stepKey="logout"/> |
| 100 | + </after> |
| 101 | + <!--Create new order--> |
| 102 | + <actionGroup stepKey="CreateNewOrder" ref="navigateToNewOrderPageExistingCustomer"> |
| 103 | + <argument name="customer" value="Simple_US_Customer_NY"/> |
| 104 | + </actionGroup> |
| 105 | + <!--Add product to order--> |
| 106 | + <click stepKey="clickToAddProduct" selector="{{AdminOrderFormItemsSection.addProducts}}"/> |
| 107 | + <waitForPageLoad stepKey="waitForProductsOpened"/> |
| 108 | + <checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectProduct"/> |
| 109 | + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> |
| 110 | + <waitForPageLoad stepKey="waitForPageLoad3"/> |
| 111 | + <!--Set shipping method--> |
| 112 | + <actionGroup stepKey="orderSelectFlatRateShipping" ref="orderSelectFlatRateShipping"/> |
| 113 | + <!--Submit order--> |
| 114 | + <click stepKey="SubmitOrder" selector="{{AdminOrderFormActionSection.SubmitOrder}}"/> |
| 115 | + <waitForPageLoad stepKey="waitForPageLoad4"/> |
| 116 | + <grabTextFrom stepKey="getOrderId" selector="|Order # (\d+)|"/> |
| 117 | + <!--Open new created order--> |
| 118 | + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrders"/> |
| 119 | + <waitForPageLoad stepKey="waitForPageLoad5"/> |
| 120 | + <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> |
| 121 | + <argument name="orderId" value="$getOrderId"/> |
| 122 | + </actionGroup> |
| 123 | + <!--Create order invoice--> |
| 124 | + <click selector="{{AdminDataGridTableSection.rowViewAction('1')}}" stepKey="clickCreatedOrderInGrid"/> |
| 125 | + <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceAction"/> |
| 126 | + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seePageNameNewInvoicePage"/> |
| 127 | + <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> |
| 128 | + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/> |
| 129 | + <see selector="{{AdminInvoiceOrderInformationSection.orderStatus}}" userInput="Processing" stepKey="seeOrderProcessing"/> |
| 130 | + <!--Create Credit Memo--> |
| 131 | + <click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="clickCreditMemoAction"/> |
| 132 | + <fillField selector="{{AdminCreditMemoTotalSection.refundShipping}}" userInput="0" stepKey="setRefundShipping"/> |
| 133 | + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Memo" stepKey="seeNewMemoInPageTitle"/> |
| 134 | + <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickRefundOffline"/> |
| 135 | + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the credit memo." stepKey="seeCreditMemoSuccess"/> |
| 136 | + <click selector="{{AdminCreditMemoTotalSection.creditMemoItem}}" stepKey="goToCreatedCreditMemo"/> |
| 137 | + <waitForPageLoad stepKey="waitForPageLoad6"/> |
| 138 | + <!--View created memo and verify tax for product--> |
| 139 | + <click selector="{{AdminCreditMemoTotalSection.viewMemo}}" stepKey="ViewMemo"/> |
| 140 | + <waitForPageLoad stepKey="waitForPageLoad7"/> |
| 141 | + <grabTextFrom selector="{{AdminCreditMemoTotalSection.grandTotal}}" stepKey="getGrandTotal"/> |
| 142 | + <assertEquals expected='$123.00' expectedType="string" actual="($getGrandTotal)" stepKey="assertGrandTotalValue"/> |
| 143 | + |
| 144 | + </test> |
| 145 | +</tests> |
0 commit comments