Skip to content

Commit f01aa1f

Browse files
Pavan-bjmohit-adobe
authored andcommitted
ACQE-6765:Admin create shipping label for usps shipping method with international address
- Add new test file, suite, data and section
1 parent a1c57b2 commit f01aa1f

File tree

5 files changed

+226
-0
lines changed

5 files changed

+226
-0
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: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,36 @@
5252
<data key="label">No</data>
5353
<data key="value">0</data>
5454
</entity>
55+
<entity name="AdminSetUSPSTypeToUSPSRestAPIUSPSConfigData" type="usps_config">
56+
<data key="path">carriers/usps/usps_type</data>
57+
<data key="value">USPS_REST</data>
58+
</entity>
59+
<entity name="AdminSetUSPSTypeToUSPSWebToolUSPSConfigData" type="usps_config">
60+
<data key="path">carriers/usps/usps_type</data>
61+
<data key="value">USPS_XML</data>
62+
</entity>
63+
<entity name="AdminConsumerKeyUSPSConfigData" type="usps_config">
64+
<data key="path">carriers/usps/client_id</data>
65+
<data key="value">D71qxI00jx1m9xNqFVigpqrh4eBdqY6Y</data>
66+
</entity>
67+
<entity name="AdminConsumerSecretUSPSConfigData" type="usps_config">
68+
<data key="path">carriers/usps/client_secret</data>
69+
<data key="value">sDy3Q4lHk6T9AMwP</data>
70+
</entity>
71+
<entity name="AdminAccountNumberUSPSConfigData" type="usps_config">
72+
<data key="path">carriers/usps/account_number</data>
73+
<data key="value">1000236554</data>
74+
</entity>
75+
<entity name="AdminCRIDUSPSConfigData" type="usps_config">
76+
<data key="path">carriers/usps/crid</data>
77+
<data key="value">49547560</data>
78+
</entity>
79+
<entity name="AdminMIDUSPSConfigData" type="usps_config">
80+
<data key="path">carriers/usps/mid</data>
81+
<data key="value">903764662</data>
82+
</entity>
83+
<entity name="AdminMMIDUSPSConfigData" type="usps_config">
84+
<data key="path">carriers/usps/mmid</data>
85+
<data key="value">903764661</data>
86+
</entity>
5587
</entities>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
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+
<waitForElementVisible 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+
<waitForElementVisible 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: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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="United States"/>
32+
<argument name="state" value="Illinois"/>
33+
<argument name="postcode" value="60031"/>
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+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="runIndexCronJobs">
49+
<argument name="indices" value=""/>
50+
</actionGroup>
51+
</before>
52+
<after>
53+
<!--delete product-->
54+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
55+
<!--delete customer-->
56+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
57+
<!-- Reset shipping origin -->
58+
<actionGroup ref="AdminResetShippingOriginConfigurationActionGroup" stepKey="ResetCaliforniaShippingOrigin"/>
59+
<magentoCLI command="config:set {{AdminShippingSettingsOriginStreetAddress2ConfigData.path}} ''" stepKey="resetOriginStreetAddress2"/>
60+
<!--Reset StoreInformation configs data-->
61+
<actionGroup ref="AdminSetStoreInformationConfigurationActionGroup" stepKey="resetStoreInformationConfig">
62+
<argument name="storeName" value=""/>
63+
<argument name="storeHoursOfOperation" value=""/>
64+
<argument name="vatNumber" value=""/>
65+
<argument name="telephone" value=""/>
66+
<argument name="country" value=""/>
67+
<argument name="state" value=""/>
68+
<argument name="city" value=""/>
69+
<argument name="postcode" value=""/>
70+
<argument name="street" value=""/>
71+
</actionGroup>
72+
<magentoCLI command="config:set {{AdminGeneralSetStreetAddress2ConfigData.path}} ''" stepKey="resetStoreInformationStreetAddress"/>
73+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/>
74+
</after>
75+
<!-- Step 1:Navigate to storefront -->
76+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin">
77+
<argument name="Customer" value="$createCustomer$" />
78+
</actionGroup>
79+
<!-- Step 2:Add produuct to cart -->
80+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="navigateToProductPage">
81+
<argument name="productUrlKey" value="$createProduct.custom_attributes[url_key]$"/>
82+
</actionGroup>
83+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
84+
<argument name="product" value="$createProduct$" />
85+
<argument name="productCount" value="1" />
86+
</actionGroup>
87+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
88+
<!-- Step 3:Select International Address other than USA -->
89+
<actionGroup ref="CustomerCheckoutFillNewShippingAddressActionGroup" stepKey="fillShippingAddress">
90+
<argument name="address" value="Canada_Address"/>
91+
</actionGroup>
92+
<!-- Step 4:Select Any USPS Shipping method -->
93+
<actionGroup ref="StorefrontSetShippingMethodActionGroup" stepKey="setShippingMethodFlatRate">
94+
<argument name="shippingMethodName" value="Priority Mail International Flat Rate Envelope"/>
95+
</actionGroup>
96+
<!-- Step 5:Place order -->
97+
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="goToPaymentStep"/>
98+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod"/>
99+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
100+
<waitForElement selector="{{CheckoutSuccessMainSection.orderLink}}" stepKey="waitForOrderNumber"/>
101+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderLink}}" stepKey="grabOrderNumber"/>
102+
<!-- Step 6:Open created order in admin-->
103+
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="onOrdersPage"/>
104+
<actionGroup ref="SearchAdminDataGridByKeywordActionGroup" stepKey="searchOrder">
105+
<argument name="keyword" value="$grabOrderNumber"/>
106+
</actionGroup>
107+
<!-- Step 7:Sales >order>View -->
108+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
109+
<!-- Step 8:Create shipping label-->
110+
<actionGroup ref="GoToShipmentIntoOrderActionGroup" stepKey="goToShipmentIntoOrder"/>
111+
<checkOption selector="{{AdminShipmentTotalSection.createShippingLabel}}" stepKey="checkCreateShippingLabel"/>
112+
<!-- Step 9:Click on submit shipment -->
113+
<click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/>
114+
<!-- Step 10:Select type>Add products to package> Select product > Add selected products to Package>Save -->
115+
<actionGroup ref="AdminShipmentCreateShippingLabelActionGroup" stepKey="createPackage">
116+
<argument name="productName" value="$$createProduct.name$$"/>
117+
</actionGroup>
118+
</test>
119+
</tests>

0 commit comments

Comments
 (0)