-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGETWO-91769: Credit Memo - Wrong tax calculation! #10982
- Add automated test
- Loading branch information
Showing
6 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
app/code/Magento/Tax/Test/Mftf/Section/AdminProductTaxClassSection.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> | ||
<section name="AdminProductTaxClassSection"> | ||
<element name="additionalSettings" type="text" selector="#details-summarybase_fieldset"/> | ||
<element name="additionalSettingsCond" type="text" selector="//summary[@id='details-summarybase_fieldset' and @aria-expanded='true']"/> | ||
<element name="productTaxClass" type="button" selector="//div[contains(@class, 'field-tax_product_class')]//span[text()='Add New Tax Class']"/> | ||
<element name="TaxClassName" type="block" selector="//div[contains(@class, 'field-tax_product_class')]//input[@class='mselect-input']"/> | ||
<element name="confirm" type="button" selector="//div[contains(@class, 'field-tax_product_class')]//span[@class='mselect-save']"/> | ||
</section> | ||
</sections> |
144 changes: 144 additions & 0 deletions
144
app/code/Magento/Tax/Test/Mftf/Test/CheckCreditMemoTotalsTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> | ||
<test name="CheckCreditMemoTotalsTest"> | ||
<annotations> | ||
<features value="Tax"/> | ||
<stories value="MAGETWO-91769 - Credit Memo - Wrong tax calculation! #10982"/> | ||
<title value="Checking Credit memo Totals"/> | ||
<description value="Checking Credit memo Totals"/> | ||
<severity value="MAJOR"/> | ||
<testCaseId value="MAGETWO-95175"/> | ||
<group value="creditMemo"/> | ||
<group value="tax"/> | ||
</annotations> | ||
<before> | ||
<!--Create category and product--> | ||
<createData entity="_defaultCategory" stepKey="createCategory"/> | ||
<createData entity="_defaultProduct" stepKey="createSimpleProduct"> | ||
<requiredEntity createDataKey="createCategory"/> | ||
</createData> | ||
<!--Create customer--> | ||
<createData entity="Simple_US_Customer_NY" stepKey="createCustomer"/> | ||
<!--Login as admin--> | ||
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> | ||
<!--Create tax rule and tax rate--> | ||
<amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulePage"/> | ||
<waitForPageLoad stepKey="waitForTaxRatePage"/> | ||
<click stepKey="addNewTaxRate" selector="{{AdminGridMainControls.add}}"/> | ||
<fillField stepKey="fillRuleName" selector="{{AdminTaxRulesSection.ruleName}}" userInput="SampleRule"/> | ||
<actionGroup ref="addCustomTaxRate" stepKey="addCustomTaxRate"> | ||
<argument name="taxCode" value="SimpleTaxNY"/> | ||
</actionGroup> | ||
<click stepKey="expandAdditionalSettings" selector="{{AdminProductTaxClassSection.additionalSettings}}"/> | ||
<waitForPageLoad stepKey="waitForPageLoad"/> | ||
<click selector="{{AdminProductTaxClassSection.productTaxClass}}" stepKey="ClickToAddTaxClass"/> | ||
<fillField selector="{{AdminProductTaxClassSection.TaxClassName}}" userInput="NewTaxClass" stepKey="setName"/> | ||
<click selector="{{AdminProductTaxClassSection.confirm}}" stepKey="ClickToDone"/> | ||
<click stepKey="clickSave" selector="{{AdminStoresMainActionsSection.saveButton}}"/> | ||
<waitForPageLoad stepKey="waitForTaxRatePage1"/> | ||
<see userInput="You saved the tax rule." stepKey="VerifyRuleSaved"/> | ||
<!--Search and edit product to add new created tax rule--> | ||
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct"> | ||
<argument name="product" value="$$createSimpleProduct$$"/> | ||
</actionGroup> | ||
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="OpenEditProductOnBackend"> | ||
<argument name="product" value="$$createSimpleProduct$$"/> | ||
</actionGroup> | ||
<waitForPageLoad stepKey="waitForPageLoad2"/> | ||
<selectOption selector="{{AdminProductFormActionSection.selectTaxClass}}" userInput="NewTaxClass" stepKey="SetNewTaxClass" /> | ||
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> | ||
<!--Set configs--> | ||
<amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToTaxConfigPage"/> | ||
<conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.taxClasses}}" dependentSelector="{{AdminConfigureTaxSection.taxClassesCondition}}" visible="false"/> | ||
<click selector="{{AdminConfigureTaxSection.useSystemValue}}" stepKey="UncheckUseSystemValue"/> | ||
<selectOption selector="{{AdminConfigureTaxSection.productTaxClass}}" userInput="NewTaxClass" stepKey="selectClass"/> | ||
<click selector="{{AdminConfigureTaxSection.save}}" stepKey="saveConfig"/> | ||
<!--flash cache--> | ||
<magentoCLI command="cache:flush" stepKey="flushCache"/> | ||
</before> | ||
<after> | ||
<!--Delete category and product--> | ||
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/> | ||
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> | ||
<!--Delete customer--> | ||
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> | ||
<!--Roll Back configuration--> | ||
<amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToTaxConfigPage"/> | ||
<conditionalClick stepKey="clickOrdersInvoicesCreditSales" selector="{{AdminConfigureTaxSection.taxClasses}}" dependentSelector="{{AdminConfigureTaxSection.taxClassesCondition}}" visible="false"/> | ||
<selectOption selector="{{AdminConfigureTaxSection.productTaxClass}}" userInput="Taxable Goods" stepKey="selectClass"/> | ||
<click selector="{{AdminConfigureTaxSection.useSystemValue}}" stepKey="UncheckUseSystemValue"/> | ||
<click selector="{{AdminConfigureTaxSection.save}}" stepKey="saveConfig"/> | ||
<!-- Go to the tax rule page and delete the row we created--> | ||
<amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRulesPage"/> | ||
<waitForPageLoad stepKey="waitForRulesPage"/> | ||
<actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteRule"> | ||
<argument name="name" value="SampleRule"/> | ||
<argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> | ||
</actionGroup> | ||
<!-- Go to the tax rate page --> | ||
<amOnPage url="{{AdminTaxRateGridPage.url}}" stepKey="goToTaxRatesPage"/> | ||
<waitForPageLoad stepKey="waitForRatesPage"/> | ||
<!-- Delete tax rate that were created --> | ||
<actionGroup ref="deleteEntitySecondaryGrid" stepKey="deleteNYRate"> | ||
<argument name="name" value="{{SimpleTaxNY.state}}"/> | ||
<argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> | ||
</actionGroup> | ||
<actionGroup ref="deleteProductTaxClass" stepKey="deleteFirstProductTaxClass"> | ||
<argument name="taxClassName" value="NewTaxClass"/> | ||
</actionGroup> | ||
<!--logout--> | ||
<actionGroup ref="logout" stepKey="logout"/> | ||
</after> | ||
<!--Create new order--> | ||
<actionGroup stepKey="CreateNewOrder" ref="navigateToNewOrderPageExistingCustomer"> | ||
<argument name="customer" value="Simple_US_Customer_NY"/> | ||
</actionGroup> | ||
<!--Add product to order--> | ||
<click stepKey="clickToAddProduct" selector="{{AdminOrderFormItemsSection.addProducts}}"/> | ||
<waitForPageLoad stepKey="waitForProductsOpened"/> | ||
<checkOption selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="selectProduct"/> | ||
<click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickAddSelectedProducts"/> | ||
<waitForPageLoad stepKey="waitForPageLoad3"/> | ||
<!--Set shipping method--> | ||
<actionGroup stepKey="orderSelectFlatRateShipping" ref="orderSelectFlatRateShipping"/> | ||
<!--Submit order--> | ||
<click stepKey="SubmitOrder" selector="{{AdminOrderFormActionSection.SubmitOrder}}"/> | ||
<waitForPageLoad stepKey="waitForPageLoad4"/> | ||
<grabTextFrom stepKey="getOrderId" selector="|Order # (\d+)|"/> | ||
<!--Open new created order--> | ||
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrders"/> | ||
<waitForPageLoad stepKey="waitForPageLoad5"/> | ||
<actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> | ||
<argument name="orderId" value="$getOrderId"/> | ||
</actionGroup> | ||
<!--Create order invoice--> | ||
<click selector="{{AdminDataGridTableSection.rowViewAction('1')}}" stepKey="clickCreatedOrderInGrid"/> | ||
<click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceAction"/> | ||
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seePageNameNewInvoicePage"/> | ||
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> | ||
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/> | ||
<see selector="{{AdminInvoiceOrderInformationSection.orderStatus}}" userInput="Processing" stepKey="seeOrderProcessing"/> | ||
<!--Create Credit Memo--> | ||
<click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="clickCreditMemoAction"/> | ||
<fillField selector="{{AdminCreditMemoTotalSection.refundShipping}}" userInput="0" stepKey="setRefundShipping"/> | ||
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Memo" stepKey="seeNewMemoInPageTitle"/> | ||
<click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickRefundOffline"/> | ||
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the credit memo." stepKey="seeCreditMemoSuccess"/> | ||
<click selector="{{AdminCreditMemoTotalSection.creditMemoItem}}" stepKey="goToCreatedCreditMemo"/> | ||
<waitForPageLoad stepKey="waitForPageLoad6"/> | ||
<!--View created memo and verify tax for product--> | ||
<click selector="{{AdminCreditMemoTotalSection.viewMemo}}" stepKey="ViewMemo"/> | ||
<waitForPageLoad stepKey="waitForPageLoad7"/> | ||
<grabTextFrom selector="{{AdminCreditMemoTotalSection.grandTotal}}" stepKey="getGrandTotal"/> | ||
<assertEquals expected='$123.00' expectedType="string" actual="($getGrandTotal)" stepKey="assertGrandTotalValue"/> | ||
|
||
</test> | ||
</tests> |