|
| 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="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> |
| 11 | + <test name="AdminTaxReportGridTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Tax"/> |
| 14 | + <stories value="MAGETWO-91521: Reports / Sales / Tax report show incorrect amount"/> |
| 15 | + <title value="Checking Tax Report grid"/> |
| 16 | + <description value="Tax Report Grid displays Tax amount in rows 'Total' and 'Subtotal' is a sum of all tax amounts"/> |
| 17 | + <severity value="MAJOR"/> |
| 18 | + <testCaseId value="MAGETWO-94338"/> |
| 19 | + <group value="Tax"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 23 | + |
| 24 | + <!-- Go to tax rule page --> |
| 25 | + <actionGroup ref="addNewTaxRuleActionGroup" stepKey="addFirstTaxRuleActionGroup"/> |
| 26 | + <fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="TaxRule1"/> |
| 27 | + |
| 28 | + <!-- Add NY and CA tax rules --> |
| 29 | + <actionGroup ref="addNewTaxRateNoZip" stepKey="addNYTaxRate"> |
| 30 | + <argument name="taxCode" value="SimpleTaxWithZipCode"/> |
| 31 | + </actionGroup> |
| 32 | + |
| 33 | + <actionGroup ref="addProductTaxClass" stepKey="addProductTaxClass"> |
| 34 | + <argument name="prodTaxClassName" value="TaxClasses1"/> |
| 35 | + </actionGroup> |
| 36 | + |
| 37 | + <click stepKey="disableDefaultProdTaxClass" selector="{{AdminTaxRulesSection.defaultTaxClass}}"/> |
| 38 | + |
| 39 | + <click stepKey="clickSave" selector="{{AdminStoresMainActionsSection.saveButton}}"/> |
| 40 | + <waitForPageLoad stepKey="waitForNewTaxRuleCreated"/> |
| 41 | + |
| 42 | + <!-- Go to tax rule page to create second Tax Rule--> |
| 43 | + <actionGroup ref="addNewTaxRuleActionGroup" stepKey="addSecondTaxRuleActionGroup"/> |
| 44 | + <fillField stepKey="fillSecondRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="TaxRule2"/> |
| 45 | + |
| 46 | + <actionGroup ref="addNewTaxRateNoZip" stepKey="addCATaxRate"> |
| 47 | + <argument name="taxCode" value="SimpleSecondTaxWithZipCode"/> |
| 48 | + </actionGroup> |
| 49 | + |
| 50 | + <actionGroup ref="addProductTaxClass" stepKey="addSecondProductTaxClass"> |
| 51 | + <argument name="prodTaxClassName" value="TaxClasses2"/> |
| 52 | + </actionGroup> |
| 53 | + |
| 54 | + <click stepKey="disableSecondProdTaxClass" selector="{{AdminTaxRulesSection.defaultTaxClass}}"/> |
| 55 | + <click stepKey="clickSaveBtn" selector="{{AdminStoresMainActionsSection.saveButton}}"/> |
| 56 | + <waitForPageLoad stepKey="waitForSecondTaxRuleCreated"/> |
| 57 | + |
| 58 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 59 | + <createData entity="_defaultProduct" stepKey="firstProduct"> |
| 60 | + <requiredEntity createDataKey="createCategory"/> |
| 61 | + </createData> |
| 62 | + |
| 63 | + <createData entity="_defaultProduct" stepKey="secondProduct"> |
| 64 | + <requiredEntity createDataKey="createCategory"/> |
| 65 | + </createData> |
| 66 | + </before> |
| 67 | + |
| 68 | + <!--Open Created products. In Tax Class select new created Product Tax classes.--> |
| 69 | + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/> |
| 70 | + <waitForPageLoad stepKey="wait1"/> |
| 71 | + <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGrid"/> |
| 72 | + <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku"> |
| 73 | + <argument name="product" value="$$firstProduct$$"/> |
| 74 | + </actionGroup> |
| 75 | + <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openFirstProductForEdit"/> |
| 76 | + <selectOption selector="{{AdminProductFormSection.productTaxClass}}" stepKey="selectTexClassForFirstProduct" userInput="TaxClasses1"/> |
| 77 | + <!-- Save the second product --> |
| 78 | + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveFirstProduct"/> |
| 79 | + <waitForPageLoad stepKey="waitForFirstProductSaved"/> |
| 80 | + |
| 81 | + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="againGoToProductIndex"/> |
| 82 | + <waitForPageLoad stepKey="wait2"/> |
| 83 | + <actionGroup ref="resetProductGridToDefaultView" stepKey="resetSecondProductGrid"/> |
| 84 | + <actionGroup ref="filterProductGridBySku" stepKey="filterSecondProductGridBySku"> |
| 85 | + <argument name="product" value="$$secondProduct$$"/> |
| 86 | + </actionGroup> |
| 87 | + <actionGroup ref="openProducForEditByClickingRowXColumnYInProductGrid" stepKey="openSecondProductForEdit"/> |
| 88 | + <selectOption selector="{{AdminProductFormSection.productTaxClass}}" stepKey="selectTexClassForSecondProduct" userInput="TaxClasses2"/> |
| 89 | + <!-- Save the second product --> |
| 90 | + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveSecondProduct"/> |
| 91 | + <waitForPageLoad stepKey="waitForSecondProductSaved"/> |
| 92 | + |
| 93 | + <!--Create an order with these 2 products in that zip code.--> |
| 94 | + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> |
| 95 | + <waitForPageLoad stepKey="waitForIndexPageLoad"/> |
| 96 | + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> |
| 97 | + <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> |
| 98 | + <click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/> |
| 99 | + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> |
| 100 | + |
| 101 | + <!--Check if order can be submitted without the required fields including email address--> |
| 102 | + <scrollToTopOfPage stepKey="scrollToTopOfOrderFormPage" after="seeNewOrderPageTitle"/> |
| 103 | + <actionGroup ref="addSimpleProductToOrder" stepKey="addFirstProductToOrder" after="scrollToTopOfOrderFormPage"> |
| 104 | + <argument name="product" value="$$firstProduct$$"/> |
| 105 | + </actionGroup> |
| 106 | + <actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProductToOrder" after="addFirstProductToOrder"> |
| 107 | + <argument name="product" value="$$secondProduct$$"/> |
| 108 | + </actionGroup> |
| 109 | + |
| 110 | + <!--Fill customer group and customer email--> |
| 111 | + <selectOption selector="{{AdminOrderFormAccountSection.group}}" userInput="{{GeneralCustomerGroup.code}}" stepKey="selectCustomerGroup" after="addSecondProductToOrder"/> |
| 112 | + <fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer.email}}" stepKey="fillCustomerEmail" after="selectCustomerGroup"/> |
| 113 | + |
| 114 | + <!--Fill customer address information--> |
| 115 | + <actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress" after="fillCustomerEmail"> |
| 116 | + <argument name="customer" value="Simple_US_Customer"/> |
| 117 | + <argument name="address" value="US_Address_TX"/> |
| 118 | + </actionGroup> |
| 119 | + |
| 120 | + <!-- Select shipping --> |
| 121 | + <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/> |
| 122 | + |
| 123 | + <!--Submit Order and verify information--> |
| 124 | + <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="clickSubmitOrder" after="selectFlatRateShipping"/> |
| 125 | + <seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}" stepKey="seeViewOrderPage" after="clickSubmitOrder"/> |
| 126 | + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeSuccessMessage" after="seeViewOrderPage"/> |
| 127 | + |
| 128 | + <!--Create Invoice and Shipment for this Order.--> |
| 129 | + <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/> |
| 130 | + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoiceInPageTitle" after="clickInvoiceButton"/> |
| 131 | + <waitForPageLoad stepKey="waitForInvoicePageOpened"/> |
| 132 | + |
| 133 | + <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> |
| 134 | + <waitForPageLoad stepKey="waitForInvoiceSaved"/> |
| 135 | + |
| 136 | + <click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction" after="waitForInvoiceSaved"/> |
| 137 | + <seeInCurrentUrl url="{{AdminShipmentNewPage.url}}" stepKey="seeOrderShipmentUrl" after="clickShipAction"/> |
| 138 | + <!--Submit Shipment--> |
| 139 | + <click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment" after="seeOrderShipmentUrl"/> |
| 140 | + <waitForPageLoad stepKey="waitForShipmentSaved"/> |
| 141 | + |
| 142 | + <!--Go to "Reports" -> "Sales" -> "Tax"--> |
| 143 | + <amOnPage url="/admin/reports/report_sales/tax/" stepKey="navigateToReportsTaxPage"/> |
| 144 | + <waitForPageLoad stepKey="waitForReportsTaxPageLoad"/> |
| 145 | + |
| 146 | + <!--click "here" to refresh last day's statistics --> |
| 147 | + <click stepKey="clickRefrashStatisticsHere" selector="{{AdminTaxReportsSection.refreshStatistics}}"/> |
| 148 | + <waitForPageLoad stepKey="waitForRefrash"/> |
| 149 | + |
| 150 | + <!--Select Dates--> |
| 151 | + <fillField selector="{{AdminTaxReportsSection.fromDate}}" userInput="05/16/2018" stepKey="fillDateFrom"/> |
| 152 | + <click selector="{{AdminTaxReportsSection.toDate}}" stepKey="clickDateTo"/> |
| 153 | + <click selector="{{AdminTaxReportsSection.goTodayButton}}" stepKey="clickGoTodayDate"/> |
| 154 | + <!--Click "Show report" in the upper right corner.--> |
| 155 | + <click selector="{{AdminTaxReportsSection.showReportButton}}" stepKey="clickShowReportButton"/> |
| 156 | + |
| 157 | + <!--Tax Report Grid displays Tax amount in rows. "Total" and "Subtotal" is a sum of all tax amounts--> |
| 158 | + <grabTextFrom selector="{{AdminTaxReportsSection.taxRuleAmount('TaxRate1')}}" stepKey="amountOfFirstTaxRate"/> |
| 159 | + <grabTextFrom selector="{{AdminTaxReportsSection.taxRuleAmount('TaxRate2')}}" stepKey="amountOfSecondTaxRate"/> |
| 160 | + <grabTextFrom selector="{{AdminTaxReportsSection.taxRuleAmount('Subtotal')}}" stepKey="amountOfSubtotalTaxRate"/> |
| 161 | + <assertEquals stepKey="assertSubtotalFirstField"> |
| 162 | + <expectedResult type="string">$0.87</expectedResult> |
| 163 | + <actualResult type="variable">amountOfFirstTaxRate</actualResult> |
| 164 | + </assertEquals> |
| 165 | + |
| 166 | + <assertEquals stepKey="assertSubtotalSecondField"> |
| 167 | + <expectedResult type="string">$0.02</expectedResult> |
| 168 | + <actualResult type="variable">amountOfSecondTaxRate</actualResult> |
| 169 | + </assertEquals> |
| 170 | + |
| 171 | + <assertEquals stepKey="assertSubtotalField"> |
| 172 | + <expectedResult type="string">$0.89</expectedResult> |
| 173 | + <actualResult type="variable">amountOfSubtotalTaxRate</actualResult> |
| 174 | + </assertEquals> |
| 175 | + |
| 176 | + <after> |
| 177 | + <!-- Go to the tax rule page and delete the row we created--> |
| 178 | + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulesPage"/> |
| 179 | + <waitForPageLoad stepKey="waitForRulesPage"/> |
| 180 | + |
| 181 | + <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteRule"> |
| 182 | + <argument name="name" value="TaxRule1"/> |
| 183 | + <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> |
| 184 | + </actionGroup> |
| 185 | + |
| 186 | + <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteSecondRule"> |
| 187 | + <argument name="name" value="TaxRule2"/> |
| 188 | + <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> |
| 189 | + </actionGroup> |
| 190 | + |
| 191 | + <!-- Go to the tax rate page --> |
| 192 | + <amOnPage url="{{AdminTaxRateGridPage.url}}" stepKey="goToTaxRatesPage"/> |
| 193 | + <waitForPageLoad stepKey="waitForRatesPage"/> |
| 194 | + |
| 195 | + <!-- Delete the two tax rates that were created --> |
| 196 | + <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteNYRate"> |
| 197 | + <argument name="name" value="{{SimpleTaxWithZipCode.state}}-{{SimpleTaxWithZipCode.rate}}"/> |
| 198 | + <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> |
| 199 | + </actionGroup> |
| 200 | + |
| 201 | + <actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteCARate"> |
| 202 | + <argument name="name" value="{{SimpleSecondTaxWithZipCode.state}}-{{SimpleSecondTaxWithZipCode.rate}}"/> |
| 203 | + <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> |
| 204 | + </actionGroup> |
| 205 | + |
| 206 | + <deleteData createDataKey="firstProduct" stepKey="deleteFirstProduct"/> |
| 207 | + <deleteData createDataKey="secondProduct" stepKey="deleteSecondProduct"/> |
| 208 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 209 | + |
| 210 | + <actionGroup ref="deleteProductTaxClass" stepKey="deleteFirstProductTaxClass"> |
| 211 | + <argument name="taxClassName" value="TaxClasses1"/> |
| 212 | + </actionGroup> |
| 213 | + |
| 214 | + <actionGroup ref="deleteProductTaxClass" stepKey="deleteSecondProductTaxClass"> |
| 215 | + <argument name="taxClassName" value="TaxClasses2"/> |
| 216 | + </actionGroup> |
| 217 | + |
| 218 | + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> |
| 219 | + </after> |
| 220 | + </test> |
| 221 | +</tests> |
0 commit comments