Skip to content

Commit c957469

Browse files
committed
Merge remote-tracking branch 'magento-l3/ACP2E-1580' into FEB132023_PR_arul
2 parents 39b7809 + 3064fdc commit c957469

File tree

4 files changed

+109
-2
lines changed

4 files changed

+109
-2
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
<actionGroup name="AdminAssertDefaultTaxDestinationActionGroup">
12+
<annotations>
13+
<description>Assert admin settings (country, state, postcode) for default tax destination calculation</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="country" type="string" defaultValue="{{US_Address_TX.country}}"/>
17+
<argument name="state" type="string" defaultValue="*"/>
18+
<argument name="postcode" type="string" defaultValue=""/>
19+
</arguments>
20+
21+
<!-- Navigate to the tax configuration page -->
22+
<amOnPage url="{{AdminTaxConfigurationPage.url}}" stepKey="goToAdminTaxPage"/>
23+
<waitForPageLoad stepKey="waitForTaxConfigLoad"/>
24+
<!-- Verify default tax destination calculation settings-->
25+
<conditionalClick selector="{{AdminConfigureTaxSection.defaultDestination}}" dependentSelector="#tax_defaults" visible="false" stepKey="clickCalculationSettings"/>
26+
<seeOptionIsSelected selector="{{AdminConfigureTaxSection.dropdownDefaultCountry}}" userInput="{{country}}" stepKey="assertDefaultCountry"/>
27+
<seeOptionIsSelected selector="{{AdminConfigureTaxSection.dropdownDefaultState}}" userInput="{{state}}" stepKey="assertDefaultRegion"/>
28+
<seeInField selector="{{AdminConfigureTaxSection.defaultPostCode}}" userInput="{{postcode}}" stepKey="assertDefaultPostCode"/>
29+
</actionGroup>
30+
</actionGroups>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="StorefrontEstimateShippingTaxTest">
11+
<annotations>
12+
<features value="Checkout"/>
13+
<stories value="Estimate Shipping Tax"/>
14+
<title value="Tax and Shipping Estimator in the Cart not reflecting default destination configuration."/>
15+
<description value="Tax and Shipping Estimator in the Cart not reflecting default destination configuration."/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-7922"/>
18+
<useCaseId value="ACP2E-1580"/>
19+
<group value="checkout"/>
20+
</annotations>
21+
22+
<before>
23+
<!--Change default tax destination calculation settings-->
24+
<magentoCLI command="config:set {{DefaultTaxDestinationCountry.path}} {{US_Address_NY.country_id}}" stepKey="selectDefaultCountry"/>
25+
<magentoCLI command="config:set {{DefaultTaxDestinationRegion.path}} {{RegionNY.region_id}}" stepKey="selectDefaultState"/>
26+
<magentoCLI command="config:set {{DefaultTaxDestinationPostcode.path}} {{US_Address_NY.postcode}}" stepKey="fillDefaultPostCode"/>
27+
28+
<!-- Create simple product -->
29+
<createData entity="SimpleProduct2" stepKey="createProduct"/>
30+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
31+
</before>
32+
33+
<after>
34+
<!--Reset default tax destination calculation settings-->
35+
<magentoCLI command="config:set {{DefaultTaxDestinationCountry.path}} {{DefaultTaxDestinationCountry.value}}" stepKey="resetDefaultCountry"/>
36+
<magentoCLI command="config:set {{DefaultTaxDestinationRegion.path}} {{DefaultTaxDestinationRegion.value}}" stepKey="resetDefaultState"/>
37+
<magentoCLI command="config:set {{DefaultTaxDestinationPostcode.path}} {{DefaultTaxDestinationPostcode.value}}" stepKey="resetDefaultPostCode"/>
38+
39+
<!-- Delete simple product -->
40+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
41+
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
42+
</after>
43+
44+
<!--Verify the admin setting for default tac and destination calculation-->
45+
<actionGroup ref="AdminAssertDefaultTaxDestinationActionGroup" stepKey="sssertDefaultTaxDestination">
46+
<argument name="country" value="{{US_Address_NY.country}}"/>
47+
<argument name="state" value="{{RegionNY.region}}"/>
48+
<argument name="postcode" value="{{US_Address_NY.postcode}}"/>
49+
</actionGroup>
50+
51+
<!-- Add simple product to cart as Guest -->
52+
<amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/>
53+
<waitForPageLoad stepKey="waitForPageLoad"/>
54+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddSimpleProductToCart">
55+
<argument name="product" value="$$createProduct$$"/>
56+
<argument name="productCount" value="1"/>
57+
</actionGroup>
58+
59+
<!-- Go to Checkout page -->
60+
<actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/>
61+
<actionGroup ref="AssertStorefrontCheckoutCartEstimateShippingAndTaxAddressActionGroup" stepKey="checkAddress">
62+
<argument name="country" value="{{US_Address_NY.country}}"/>
63+
<argument name="state" value="{{US_Address_NY.state}}"/>
64+
<argument name="postcode" value="{{US_Address_NY.postcode}}"/>
65+
</actionGroup>
66+
</test>
67+
</tests>

app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ define([
2222

2323
if (addressData.region && addressData.region['region_id']) {
2424
regionId = addressData.region['region_id'];
25-
} else if (!addressData['region_id']) {
26-
regionId = undefined;
2725
} else if (
2826
/* eslint-disable */
2927
addressData['country_id'] && addressData['country_id'] == window.checkoutConfig.defaultCountryId ||

app/code/Magento/Sales/Test/Mftf/Data/ConfigData.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,16 @@
3232
<data key="path">payment/checkmo/title</data>
3333
<data key="value">Test</data>
3434
</entity>
35+
<entity name="DefaultTaxDestinationCountry">
36+
<data key="path">tax/defaults/country</data>
37+
<data key="value">US</data>
38+
</entity>
39+
<entity name="DefaultTaxDestinationRegion">
40+
<data key="path">tax/defaults/region</data>
41+
<data key="value">*</data>
42+
</entity>
43+
<entity name="DefaultTaxDestinationPostcode">
44+
<data key="path">tax/defaults/postcode</data>
45+
<data key="value">''</data>
46+
</entity>
3547
</entities>

0 commit comments

Comments
 (0)