Skip to content

Commit e8e0f04

Browse files
ACQE-6765:Admin create shipping label for usps shipping method with international address
- Resolved conflicts.
2 parents e8dec0b + a429fe9 commit e8e0f04

File tree

5 files changed

+228
-2
lines changed

5 files changed

+228
-2
lines changed

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,4 +658,21 @@
658658
<data key="default_shipping">Yes</data>
659659
<requiredEntity type="region">RegionCA</requiredEntity>
660660
</entity>
661+
<entity name="US_Address_LI" type="address">
662+
<data key="firstname">John</data>
663+
<data key="lastname">Doe</data>
664+
<data key="company">Magento</data>
665+
<array key="street">
666+
<item>1125 Tri-State Parkway</item>
667+
<item>Suite 700</item>
668+
</array>
669+
<data key="city">Gurnee</data>
670+
<data key="state">Illinois</data>
671+
<data key="country_id">US</data>
672+
<data key="country">United States</data>
673+
<data key="postcode">60031</data>
674+
<data key="telephone">3232380670</data>
675+
<data key="default_billing">Yes</data>
676+
<data key="default_shipping">Yes</data>
677+
</entity>
661678
</entities>

app/code/Magento/Shipping/Test/Mftf/Data/USPSShippingMethodData.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,40 @@
7171
<entity name="AdminFillFreeShippingAmountThresholdUSPSConfigData" type="usps_config">
7272
<data key="path">carriers/usps/free_shipping_subtotal</data>
7373
<data key="value">49</data>
74+
=======
75+
<entity name="AdminSetUSPSTypeToUSPSRestAPIUSPSConfigData" type="usps_config">
76+
<data key="path">carriers/usps/usps_type</data>
77+
<data key="value">USPS_REST</data>
78+
</entity>
79+
<entity name="AdminSetUSPSTypeToUSPSWebToolUSPSConfigData" type="usps_config">
80+
<data key="path">carriers/usps/usps_type</data>
81+
<data key="value">USPS_XML</data>
82+
</entity>
83+
<entity name="AdminConsumerKeyUSPSConfigData" type="usps_config">
84+
<data key="path">carriers/usps/client_id</data>
85+
<data key="value">{{_CREDS.magento/carriers_usps_rest_client_id}}</data>
86+
</entity>
87+
<entity name="AdminConsumerSecretUSPSConfigData" type="usps_config">
88+
<data key="path">carriers/usps/client_secret</data>
89+
<data key="value">{{_CREDS.magento/carriers_usps_rest_client_secret}}</data>
90+
</entity>
91+
<entity name="AdminAccountNumberUSPSConfigData" type="usps_config">
92+
<data key="path">carriers/usps/account_number</data>
93+
<data key="value">{{_CREDS.magento/carriers_usps_rest_account_number}}</data>
94+
</entity>
95+
<entity name="AdminCRIDUSPSConfigData" type="usps_config">
96+
<data key="path">carriers/usps/crid</data>
97+
<data key="value">{{_CREDS.magento/carriers_usps_rest_crid}}</data>
98+
</entity>
99+
<entity name="AdminMIDUSPSConfigData" type="usps_config">
100+
<data key="path">carriers/usps/mid</data>
101+
<data key="value">{{_CREDS.magento/carriers_usps_rest_mid}}</data>
102+
</entity>
103+
<entity name="AdminMMIDUSPSConfigData" type="usps_config">
104+
<data key="path">carriers/usps/mmid</data>
105+
<data key="value">{{_CREDS.magento/carriers_usps_rest_mmid}}</data>
106+
</entity>
107+
<entity name="ShippingTypeUSPSConfigData" type="usps_config">
108+
<data key="value">Priority Mail International Flat Rate Envelope</data>
74109
</entity>
75110
</entities>

app/code/Magento/Shipping/Test/Mftf/Section/AdminShippingMethodUSPSSection.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -21,5 +21,6 @@
2121
<element name="usernameUSPS" type="input" selector="//input[@id='carriers_usps_userid']"/>
2222
<element name="USPSshowMethodIfNotApplicableField" type="select" selector="//tr[@id='row_carriers_usps_showmethod']//td//select[@id='carriers_usps_showmethod']"/>
2323
<element name="debugSelectUSPS" type="select" selector="//tr[@id='row_carriers_usps_debug']//td//select[@id='carriers_usps_debug']"/>
24+
<element name="allowedMethodsForRestAPICheckbox" type="checkbox" selector="//tr[@id='row_carriers_usps_rest_allowed_methods']//input[@id='carriers_usps_rest_allowed_methods_inherit']"/>
2425
</section>
2526
</sections>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
<suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Suite/etc/suiteSchema.xsd">
9+
<suite name="USPSShippingForRestAPISuite">
10+
<before>
11+
<!--Login as Admin-->
12+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
13+
<!--Configure USPS shipping method-->
14+
<magentoCLI command="config:set {{AdminEnableUSPSConfigData.path}} {{AdminEnableUSPSConfigData.value}}" stepKey="enableUSPS"/>
15+
<magentoCLI command="config:set {{AdminSetUSPSTypeToUSPSRestAPIUSPSConfigData.path}} {{AdminSetUSPSTypeToUSPSRestAPIUSPSConfigData.value}}" stepKey="changeUSPSTypeToRestAPI"/>
16+
<magentoCLI command="config:set {{AdminConsumerKeyUSPSConfigData.path}} {{AdminConsumerKeyUSPSConfigData.value}}" stepKey="fillConsumerKey"/>
17+
<magentoCLI command="config:set {{AdminConsumerSecretUSPSConfigData.path}} {{AdminConsumerSecretUSPSConfigData.value}}" stepKey="fillConsumerSecret"/>
18+
<magentoCLI command="config:set {{AdminAccountNumberUSPSConfigData.path}} {{AdminAccountNumberUSPSConfigData.value}}" stepKey="fillAccountNumber"/>
19+
<magentoCLI command="config:set {{AdminCRIDUSPSConfigData.path}} {{AdminCRIDUSPSConfigData.value}}" stepKey="fillCustomerRegistrationID"/>
20+
<magentoCLI command="config:set {{AdminMIDUSPSConfigData.path}} {{AdminMIDUSPSConfigData.value}}" stepKey="fillMailerIdentifier"/>
21+
<magentoCLI command="config:set {{AdminMMIDUSPSConfigData.path}} {{AdminMMIDUSPSConfigData.value}}" stepKey="fillManifestMID"/>
22+
<magentoCLI command="config:set {{AdminEnableDebugUSPSConfigData.path}} {{AdminEnableDebugUSPSConfigData.value}}" stepKey="enableDebugUSPS"/>
23+
<magentoCLI command="config:set {{AdminEnableShowMethodUSPSConfigData.path}} {{AdminEnableShowMethodUSPSConfigData.value}}" stepKey="enableShowMethodUSPS"/>
24+
<!--Set shipping allowed for all methods-->
25+
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/>
26+
<conditionalClick selector="{{AdminShippingMethodUSPSSection.USPSTab}}" dependentSelector="{{AdminShippingMethodUSPSSection.carriersUSPSActive}}" visible="false" stepKey="expandUSPSTab"/>
27+
<scrollTo selector="{{AdminShippingMethodUSPSSection.allowedMethodsForRestAPICheckbox}}" stepKey="scrollToAllowedMethodsCheckbox"/>
28+
<checkOption selector="{{AdminShippingMethodUSPSSection.allowedMethodsForRestAPICheckbox}}" stepKey="checkOnAllowedMethodsCheckboxForRestAPIUSPSType"/>
29+
<waitForElementClickable selector="{{AdminConfigSection.saveButton}}" stepKey="waitForShippingMethodSaveButton"/>
30+
<click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/>
31+
<!--Flush cache post configuration-->
32+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCachePostConfiguring">
33+
<argument name="tags" value="config full_page"/>
34+
</actionGroup>
35+
</before>
36+
<after>
37+
<!--Login as Admin-->
38+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
39+
<!--Disable USPS shipping carrier-->
40+
<magentoCLI command="config:set {{AdminDisableUSPSConfigData.path}} {{AdminDisableUSPSConfigData.value}}" stepKey="disableUSPS"/>
41+
<magentoCLI command="config:set {{AdminSetUSPSTypeToUSPSWebToolUSPSConfigData.path}} {{AdminSetUSPSTypeToUSPSWebToolUSPSConfigData.value}}" stepKey="changeUSPSTypeToDeflaut"/>
42+
<magentoCLI command="config:set {{AdminDisableDebugUSPSConfigData.path}} {{AdminDisableDebugUSPSConfigData.value}}" stepKey="disableDebugUSPS"/>
43+
<magentoCLI command="config:set {{AdminDisableShowMethodUSPSConfigData.path}} {{AdminDisableShowMethodUSPSConfigData.value}}" stepKey="disableShowMethodUSPS"/>
44+
<!--Set shipping allowed for all methods-->
45+
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/>
46+
<conditionalClick selector="{{AdminShippingMethodUSPSSection.USPSTab}}" dependentSelector="{{AdminShippingMethodUSPSSection.carriersUSPSActive}}" visible="false" stepKey="expandUSPSTab"/>
47+
<scrollTo selector="{{AdminShippingMethodUSPSSection.carriersUSPSAllowedMethods}}" stepKey="scrollToAllowedMethodsCheckbox"/>
48+
<click selector="{{AdminShippingMethodUSPSSection.carriersUSPSAllowedMethods}}" stepKey="checkOnAllowedMethodsCheckboxForWebToolUSPSType"/>
49+
<waitForElementClickable selector="{{AdminConfigSection.saveButton}}" stepKey="waitForShippingMethodSaveButton"/>
50+
<click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/>
51+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/>
52+
</after>
53+
<include>
54+
<group name="EnableUSPSShippingForRestAPISuite"/>
55+
</include>
56+
</suite>
57+
</suites>
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
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="AdminCreateShippingLabelForUSPSShippingMethodTest">
12+
<annotations>
13+
<features value="Shipping"/>
14+
<stories value="Create Shipping label For USPS Shipment"/>
15+
<title value="Admin create shipping label for usps shipping method"/>
16+
<description value="Verify admin able to create shipping label for usps shipping method with international address"/>
17+
<testCaseId value="AC-14921"/>
18+
<severity value="MAJOR"/>
19+
<group value="3rd_party_integration"/>
20+
<group value="EnableUSPSShippingForRestAPISuite"/>
21+
<group value="pr_exclude"/>
22+
</annotations>
23+
<before>
24+
<!-- Create product -->
25+
<createData entity="SimpleProduct" stepKey="createProduct"/>
26+
<createData entity="Simple_Customer_Without_Address" stepKey="createCustomer"/>
27+
<!-- Login admin -->
28+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
29+
<!--Set Shipping settings origin data-->
30+
<actionGroup ref="AdminSetShippingOriginConfigActionGroup" stepKey="setShippingOriginConfigurationData">
31+
<argument name="country" value="{{US_Address_LI.country_id}}"/>
32+
<argument name="state" value="{{US_Address_LI.state}}"/>
33+
<argument name="postcode" value="{{US_Address_LI.postcode}}"/>
34+
</actionGroup>
35+
<magentoCLI command="config:set {{AdminShippingSettingsOriginCityConfigData.path}} '{{US_Address_LI.city}}'" stepKey="setOriginCity"/>
36+
<magentoCLI command="config:set {{AdminShippingSettingsOriginStreetAddressConfigData.path}} '{{US_Address_LI.street[0]}}'" stepKey="setOriginStreetAddress"/>
37+
<magentoCLI command="config:set {{AdminShippingSettingsOriginStreetAddress2ConfigData.path}} '{{US_Address_LI.street[1]}}'" stepKey="setOriginStreetAddress2"/>
38+
<!--Set StoreInformation configs data-->
39+
<actionGroup ref="AdminSetStoreInformationConfigurationActionGroup" stepKey="setStoreInformationConfigData">
40+
<argument name="telephone" value="{{US_Address_LI.telephone}}"/>
41+
<argument name="country" value="{{US_Address_LI.country_id}}"/>
42+
<argument name="state" value="{{US_Address_LI.state}}"/>
43+
<argument name="city" value="{{US_Address_LI.city}}"/>
44+
<argument name="postcode" value="{{US_Address_LI.postcode}}"/>
45+
<argument name="street" value="{{US_Address_LI.street[0]}}"/>
46+
</actionGroup>
47+
<magentoCLI command="config:set {{AdminGeneralSetStreetAddress2ConfigData.path}} '{{US_Address_LI.street[1]}}'" stepKey="setStoreInformationStreetAddress"/>
48+
</before>
49+
<after>
50+
<!--delete product-->
51+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
52+
<!--delete customer-->
53+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
54+
<!-- Reset shipping origin -->
55+
<actionGroup ref="AdminResetShippingOriginConfigurationActionGroup" stepKey="ResetCaliforniaShippingOrigin"/>
56+
<magentoCLI command="config:set {{AdminShippingSettingsOriginStreetAddress2ConfigData.path}} ''" stepKey="resetOriginStreetAddress2"/>
57+
<!--Reset StoreInformation configs data-->
58+
<actionGroup ref="AdminSetStoreInformationConfigurationActionGroup" stepKey="resetStoreInformationConfig">
59+
<argument name="storeName" value=""/>
60+
<argument name="storeHoursOfOperation" value=""/>
61+
<argument name="vatNumber" value=""/>
62+
<argument name="telephone" value=""/>
63+
<argument name="country" value=""/>
64+
<argument name="state" value=""/>
65+
<argument name="city" value=""/>
66+
<argument name="postcode" value=""/>
67+
<argument name="street" value=""/>
68+
</actionGroup>
69+
<magentoCLI command="config:set {{AdminGeneralSetStreetAddress2ConfigData.path}} ''" stepKey="resetStoreInformationStreetAddress"/>
70+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/>
71+
</after>
72+
<!-- Step 1:Navigate to storefront -->
73+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin">
74+
<argument name="Customer" value="$createCustomer$" />
75+
</actionGroup>
76+
<!-- Step 2:Add product to cart -->
77+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="navigateToProductPage">
78+
<argument name="productUrlKey" value="$createProduct.custom_attributes[url_key]$"/>
79+
</actionGroup>
80+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
81+
<argument name="product" value="$createProduct$" />
82+
<argument name="productCount" value="1" />
83+
</actionGroup>
84+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
85+
<!-- Step 3:Select International Address other than USA -->
86+
<actionGroup ref="CustomerCheckoutFillNewShippingAddressActionGroup" stepKey="fillShippingAddress">
87+
<argument name="address" value="Canada_Address"/>
88+
</actionGroup>
89+
<!-- Step 4:Select Any USPS Shipping method -->
90+
<actionGroup ref="StorefrontSetShippingMethodActionGroup" stepKey="setShippingUSPSShippingMethod">
91+
<argument name="shippingMethodName" value="{{ShippingTypeUSPSConfigData.value}}"/>
92+
</actionGroup>
93+
<!-- Step 5:Place order -->
94+
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="goToPaymentStep"/>
95+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod"/>
96+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
97+
<waitForElement selector="{{CheckoutSuccessMainSection.orderLink}}" stepKey="waitForOrderNumber"/>
98+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderLink}}" stepKey="grabOrderNumber"/>
99+
<!-- Step 6:Open created order in admin-->
100+
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="onOrdersPage"/>
101+
<actionGroup ref="SearchAdminDataGridByKeywordActionGroup" stepKey="searchOrder">
102+
<argument name="keyword" value="$grabOrderNumber"/>
103+
</actionGroup>
104+
<!-- Step 7:Sales >order>View -->
105+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
106+
<!-- Step 8:Create shipping label-->
107+
<actionGroup ref="GoToShipmentIntoOrderActionGroup" stepKey="goToShipmentIntoOrder"/>
108+
<checkOption selector="{{AdminShipmentTotalSection.createShippingLabel}}" stepKey="checkCreateShippingLabel"/>
109+
<!-- Step 9:Click on submit shipment -->
110+
<click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/>
111+
<!-- Step 10:Select type>Add products to package> Select product > Add selected products to Package>Save -->
112+
<actionGroup ref="AdminShipmentCreateShippingLabelActionGroup" stepKey="createPackage">
113+
<argument name="productName" value="$$createProduct.name$$"/>
114+
</actionGroup>
115+
</test>
116+
</tests>

0 commit comments

Comments
 (0)