Skip to content

Commit 6c3263b

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-86649' into 2.2-develop-pr64
2 parents 6f49a27 + ca8c862 commit 6c3263b

File tree

16 files changed

+385
-2
lines changed

16 files changed

+385
-2
lines changed

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<element name="productStatusUseDefault" type="checkbox" selector="input[name='use_default[status]']"/>
2222
<element name="productPrice" type="input" selector=".admin__field[data-index=price] input"/>
2323
<element name="advancedPricingLink" type="button" selector="button[data-index='advanced_pricing_button']"/>
24+
<element name="productTaxClass" type="select" selector="select[name='product[tax_class_id]']"/>
2425
<element name="productTaxClassUseDefault" type="checkbox" selector="input[name='use_default[tax_class_id]']"/>
2526
<element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']"/>
2627
<element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/>

app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ protected function _prepareColumns()
123123
[
124124
'header' => __('Orders'),
125125
'index' => 'orders_count',
126-
'total' => 'sum',
127126
'type' => 'number',
128127
'sortable' => false,
129128
'header_css_class' => 'col-qty',
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminReportSalesTaxPage" url="reports/report_sales/tax/" module="Magento_Reports" area="admin">
12+
<section name="AdminReportMainActionSection"/>
13+
<section name="AdminReportTaxSection"/>
14+
</page>
15+
</pages>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminReportMainActionSection">
12+
<element name="showReport" type="button" selector="#filter_form_submit" timeout="30"/>
13+
</section>
14+
</sections>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminReportTaxSection">
12+
<element name="refreshStatistics" type="button" selector="//*[@id='messages']//a[text()='here']" timeout="30"/>
13+
<element name="dataPickerFrom" type="button" selector="#sales_report_from + button.ui-datepicker-trigger"/>
14+
<element name="dataPickerTo" type="button" selector="#sales_report_to + button.ui-datepicker-trigger"/>
15+
<element name="goTodayButton" type="button" selector="#ui-datepicker-div [data-handler='today']"/>
16+
<element name="closeButton" type="button" selector="#ui-datepicker-div [data-handler='hide']"/>
17+
<element name="row" type="button" selector="//td[contains(text(),'{{var1}}')]/..//td[last()]" parameterized="true"/>
18+
</section>
19+
</sections>
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
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="AdminTaxReportGridTest">
12+
<annotations>
13+
<stories value="MAGETWO-86649: Reports / Sales / Tax report show incorrect amount"/>
14+
<title value="Checking Tax Report grid"/>
15+
<description value="Checking Tax Report grid with tax rates and same zip code"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MAGETWO-97018"/>
18+
<group value="tax_report"/>
19+
<group value="reports"/>
20+
</annotations>
21+
<before>
22+
<!--Log in as Admin-->
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
<!--Create Customer-->
25+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
26+
<!--Create Product-->
27+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
28+
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
29+
<requiredEntity createDataKey="createCategory"/>
30+
</createData>
31+
<!--Create product Tax Class and Tax Rates-->
32+
<createData entity="ProductTaxClass" stepKey="createProductTaxClass"/>
33+
<createData entity="TexasTaxRate" stepKey="createStateTaxRate"/>
34+
<createData entity="AustinTaxRate" stepKey="createCityTaxRate"/>
35+
<!--Get Data from product Tax Class-->
36+
<getData entity="ProductTaxClassGetter" stepKey="getProductTaxClass">
37+
<requiredEntity createDataKey="createProductTaxClass"/>
38+
</getData>
39+
</before>
40+
<after>
41+
<!--Delete Tax Rules-->
42+
<actionGroup ref="DeleteTaxRule" stepKey="deleteCityTaxRule">
43+
<argument name="taxRuleName" value="CityTaxRule"/>
44+
</actionGroup>
45+
<actionGroup ref="DeleteTaxRule" stepKey="deleteStateTaxRule">
46+
<argument name="taxRuleName" value="StateTaxRule"/>
47+
</actionGroup>
48+
<!--Delete Customer-->
49+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
50+
<!--Delete Product-->
51+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
52+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
53+
<!--Delete Tax Rates and product Tax Class-->
54+
<deleteData createDataKey="createStateTaxRate" stepKey="deleteTaxClass1"/>
55+
<deleteData createDataKey="createCityTaxRate" stepKey="deleteTaxClass2"/>
56+
<deleteData createDataKey="createProductTaxClass" stepKey="deleteProductTaxClass"/>
57+
<actionGroup ref="logout" stepKey="logout"/>
58+
</after>
59+
60+
<!--Adding Tax Rule with all (*) zip code-->
61+
<actionGroup ref="AddTaxRule" stepKey="addStateTaxRule">
62+
<argument name="taxRuleName" value="StateTaxRule"/>
63+
<argument name="taxRate" value="$$createStateTaxRate$$"/>
64+
<argument name="productTaxClass" value="$$getProductTaxClass$$"/>
65+
</actionGroup>
66+
<!--Adding Tax Rule with zip code-->
67+
<actionGroup ref="AddTaxRule" stepKey="addCityTaxRule">
68+
<argument name="taxRuleName" value="CityTaxRule"/>
69+
<argument name="taxRate" value="$$createCityTaxRate$$"/>
70+
<argument name="productTaxClass" value="$$getProductTaxClass$$"/>
71+
</actionGroup>
72+
<!-- Open Product Edit -->
73+
<amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToEditPage"/>
74+
<selectOption selector="{{AdminProductFormSection.productTaxClass}}" userInput="$$getProductTaxClass.class_name$$" stepKey="selectCustomTaxClass"/>
75+
<actionGroup ref="saveProductForm" stepKey="saveProduct"/>
76+
<!--Create new order with existing Customer -->
77+
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="createNewOrder">
78+
<argument name="customer" value="$$createCustomer$$"/>
79+
</actionGroup>
80+
<!--Select default store view (in multi-store website)-->
81+
<conditionalClick selector="{{AdminOrderStoreScopeTreeSection.storeForOrder(_defaultStore.name)}}" dependentSelector="{{AdminOrderStoreScopeTreeSection.storeForOrder(_defaultStore.name)}}" visible="true" stepKey="chooseStoreView" />
82+
<!--Add product to order-->
83+
<actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder">
84+
<argument name="product" value="$$createSimpleProduct$$"/>
85+
</actionGroup>
86+
<!--Select shipping-->
87+
<actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping"/>
88+
<!--Select payment-->
89+
<actionGroup ref="SelectCheckMoneyPaymentMethod" stepKey="selectCheckMoneyPayment"/>
90+
<!--Submit order-->
91+
<click selector="{{AdminOrderFormActionSection.submitOrder}}" stepKey="clickSubmitOrder"/>
92+
<see selector="{{AdminMessagesSection.success}}" userInput="You created the order." stepKey="seeOrderSuccessMessage"/>
93+
<!--Create and submit Invoice-->
94+
<actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="createInvoice"/>
95+
<actionGroup ref="SubmitInvoice" stepKey="submitInvoice"/>
96+
<!--Create and submit Shipment -->
97+
<actionGroup ref="StartCreateShipmentFromOrderPage" stepKey="createShipment"/>
98+
<actionGroup ref="SubmitShipment" stepKey="submitShipment"/>
99+
<!--Go to Report -> Tax -->
100+
<amOnPage url="{{AdminReportSalesTaxPage.url}}" stepKey="goToReportTax"/>
101+
<click selector="{{AdminReportTaxSection.refreshStatistics}}" stepKey="clickRefreshStatistics"/>
102+
<see selector="{{AdminMessagesSection.success}}" userInput="Recent statistics have been updated." stepKey="seeReportSuccessMessage"/>
103+
<!--Select Date From-->
104+
<click selector="{{AdminReportTaxSection.dataPickerFrom}}" stepKey="clickOnDatePickerFrom"/>
105+
<waitForElementVisible selector="{{AdminReportTaxSection.goTodayButton}}" stepKey="waitForGoTodayButton1"/>
106+
<click selector="{{AdminReportTaxSection.goTodayButton}}" stepKey="selectToday1"/>
107+
<click selector="{{AdminReportTaxSection.closeButton}}" stepKey="selectClose1"/>
108+
<!--Select Date To-->
109+
<click selector="{{AdminReportTaxSection.dataPickerTo}}" stepKey="clickOnDatePickerTo"/>
110+
<waitForElementVisible selector="{{AdminReportTaxSection.goTodayButton}}" stepKey="waitForGoTodayButton2"/>
111+
<click selector="{{AdminReportTaxSection.goTodayButton}}" stepKey="selectToday2"/>
112+
<click selector="{{AdminReportTaxSection.closeButton}}" stepKey="selectClose2"/>
113+
<click selector="{{AdminReportMainActionSection.showReport}}" stepKey="clickOnShowReportButton"/>
114+
<!--Assert taxes-->
115+
<grabTextFrom selector="{{AdminReportTaxSection.row($$createStateTaxRate.code$$)}}" stepKey="grabStateTax"/>
116+
<assertEquals stepKey="checkStateTaxForProduct">
117+
<expectedResult type="string">$2.00</expectedResult>
118+
<actualResult type="variable">$grabStateTax</actualResult>
119+
</assertEquals>
120+
<grabTextFrom selector="{{AdminReportTaxSection.row($$createCityTaxRate.code$$)}}" stepKey="grabCityTax"/>
121+
<assertEquals stepKey="checkCityTaxForProduct">
122+
<expectedResult type="string">$10.00</expectedResult>
123+
<actualResult type="variable">$grabCityTax</actualResult>
124+
</assertEquals>
125+
<!--Assert total-->
126+
<grabTextFrom selector="{{AdminReportTaxSection.row('Subtotal')}}" stepKey="grabTotalTax"/>
127+
<assertEquals stepKey="checkTotalTaxForProduct">
128+
<expectedResult type="string">$12.00</expectedResult>
129+
<actualResult type="variable">$grabTotalTax</actualResult>
130+
</assertEquals>
131+
</test>
132+
</tests>

app/code/Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
*/
1212
namespace Magento\Tax\Model\ResourceModel\Report\Tax;
1313

14+
/**
15+
* Class for tax report resource model with aggregation by created at.
16+
*/
1417
class Createdat extends \Magento\Reports\Model\ResourceModel\Report\AbstractReport
1518
{
1619
/**
@@ -84,7 +87,7 @@ protected function _aggregateByOrder($aggregationField, $from, $to)
8487
'order_status' => 'e.status',
8588
'percent' => 'MAX(tax.' . $connection->quoteIdentifier('percent') . ')',
8689
'orders_count' => 'COUNT(DISTINCT e.entity_id)',
87-
'tax_base_amount_sum' => 'SUM(tax.base_amount * e.base_to_global_rate)',
90+
'tax_base_amount_sum' => 'SUM(tax.base_real_amount * e.base_to_global_rate)',
8891
];
8992

9093
$select = $connection->select()->from(
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<!-- Add new Tax Rule with custom tax Rate and product Tax Class -->
12+
<actionGroup name="AddTaxRule">
13+
<arguments>
14+
<argument name="taxRuleName" type="string"/>
15+
<argument name="taxRate"/>
16+
<argument name="productTaxClass"/>
17+
</arguments>
18+
<amOnPage url="{{AdminTaxRuleNewPage.url}}" stepKey="goToTaxRulePage"/>
19+
<fillField selector="{{AdminTaxRuleEditFormSection.ruleName}}" userInput="{{taxRuleName}}" stepKey="fillTaxRuleName"/>
20+
<click selector="{{AdminTaxRuleEditFormSection.selectTaxRate(taxRate.code)}}" stepKey="selectTaxRate"/>
21+
<conditionalClick selector="{{AdminTaxRuleEditFormSection.additionalSettings}}" dependentSelector="{{AdminTaxRuleEditFormSection.additionalSettings}}" visible="true" stepKey="clickAdditionalSettings"/>
22+
<scrollTo selector="{{AdminTaxRuleEditFormSection.selectProductTaxClass(productTaxClass.class_name)}}" stepKey="scrollToProductTaxClass"/>
23+
<click selector="{{AdminTaxRuleEditFormSection.selectProductTaxClass(productTaxClass.class_name)}}" stepKey="selectProductTaxClass"/>
24+
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveTaxRule"/>
25+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the tax rule." stepKey="seeSuccessMessage"/>
26+
</actionGroup>
27+
28+
<actionGroup name="DeleteTaxRule">
29+
<arguments>
30+
<argument name="taxRuleName" type="string"/>
31+
</arguments>
32+
<amOnPage url="{{AdminTaxRulesGridPage.url}}" stepKey="loadTaxRulePage"/>
33+
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clearFilterBefore"/>
34+
<fillField selector="{{AdminTaxRulesGridHeaderSection.taxRuleCodeFilter}}" userInput="{{taxRuleName}}" stepKey="fillTaxRuleName"/>
35+
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickSearchButton"/>
36+
<click selector="{{AdminGridTableSection.row('1')}}" stepKey="openTaxRule"/>
37+
<waitForPageLoad stepKey="waitForTaxRulePage"/>
38+
<click selector="{{AdminMainActionsSection.delete}}" stepKey="clickDeleteTaxRule"/>
39+
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForPageLoadAfterClickingDelete"/>
40+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="acceptDelete"/>
41+
<see selector="{{AdminMessagesSection.success}}" userInput="The tax rule has been deleted." stepKey="seeDeleteSuccessMessage"/>
42+
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clearFilterAfter"/>
43+
</actionGroup>
44+
45+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="ProductTaxClass" type="taxClass">
12+
<data key="class_name" unique="suffix">TaxClass</data>
13+
<data key="class_type">PRODUCT</data>
14+
</entity>
15+
<entity name="ProductTaxClassGetter" type="taxClass">
16+
<var key="class_id" entityKey="return" entityType="taxClass"/>
17+
</entity>
18+
</entities>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="TexasTaxRate" type="taxRate">
12+
<data key="code" unique="suffix">USTEXAS</data>
13+
<data key="tax_country_id">US</data>
14+
<data key="tax_region_id">57</data>
15+
<data key="region_name">TX</data>
16+
<data key="tax_postcode">*</data>
17+
<data key="rate">1</data>
18+
</entity>
19+
<entity name="AustinTaxRate" type="taxRate">
20+
<data key="code" unique="suffix">USTEXASAUSTIN</data>
21+
<data key="tax_country_id">US</data>
22+
<data key="tax_region_id">57</data>
23+
<data key="region_name">TX</data>
24+
<data key="tax_postcode">78729</data>
25+
<data key="rate">5</data>
26+
</entity>
27+
</entities>

0 commit comments

Comments
 (0)