Skip to content

Commit fb95f31

Browse files
Neil RautNeil Raut
authored andcommitted
ACQE-5765: Place order using USPS Shipping carrier
PR raised - implemented AC-5374
1 parent 995a05c commit fb95f31

10 files changed

+254
-1
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,4 +528,23 @@
528528
<data key="default_shipping">Yes</data>
529529
<requiredEntity type="region">RegionCA</requiredEntity>
530530
</entity>
531+
<entity name="US_Address_TX_With_RegionID" type="address">
532+
<data key="firstname">John</data>
533+
<data key="lastname">Doe</data>
534+
<data key="company">Magento</data>
535+
<array key="street">
536+
<item>7700 West Parmer Lane</item>
537+
</array>
538+
<data key="city">Austin</data>
539+
<data key="state">Texas</data>
540+
<data key="region_id">Texas</data>
541+
<data key="country_id">US</data>
542+
<data key="country">United States</data>
543+
<data key="postcode">78729</data>
544+
<data key="telephone">512-345-6789</data>
545+
<data key="vat_id">47458714</data>
546+
<data key="default_billing">Yes</data>
547+
<data key="default_shipping">Yes</data>
548+
<requiredEntity type="region">RegionTX</requiredEntity>
549+
</entity>
531550
</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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminFillAddressInformationInOrderActionGroup">
12+
<annotations>
13+
<description>Fills in the provided Customer and Address details on the Admin 'Create New Order for' page for Customer not having Select state.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="customer"/>
17+
<argument name="address"/>
18+
</arguments>
19+
<fillField selector="{{AdminOrderFormBillingAddressSection.FirstName}}" userInput="{{customer.firstname}}" stepKey="fillFirstName"/>
20+
<fillField selector="{{AdminOrderFormBillingAddressSection.LastName}}" userInput="{{customer.lastname}}" stepKey="fillLastName"/>
21+
<fillField selector="{{AdminOrderFormBillingAddressSection.StreetLine1}}" userInput="{{address.street[0]}}" stepKey="fillStreetLine1"/>
22+
<fillField selector="{{AdminOrderFormBillingAddressSection.City}}" userInput="{{address.city}}" stepKey="fillCity"/>
23+
<selectOption selector="{{AdminOrderFormBillingAddressSection.Country}}" userInput="{{address.country_id}}" stepKey="fillCountry"/>
24+
<fillField selector="{{AdminOrderFormBillingAddressSection.PostalCode}}" userInput="{{address.postcode}}" stepKey="fillPostalCode"/>
25+
<fillField selector="{{AdminOrderFormBillingAddressSection.Phone}}" userInput="{{address.telephone}}" stepKey="fillPhone"/>
26+
</actionGroup>
27+
</actionGroups>

app/code/Magento/Sales/Test/Mftf/Section/AdminInvoicePaymentShippingSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<element name="shippingMethod" type="button" selector="//label[contains(text(), 'Fixed')]" timeout="60"/>
2020
<element name="fixedPriceShippingMethod" type="button" selector="#s_method_{{methodName}}_{{methodTitle}}" parameterized="true"/>
2121
<element name="getShippingMethod" type="button" selector="#order-shipping-method-summary a"/>
22+
<element name="selectUSPSType" type="radio" selector="//label[contains(text(),'Priority Mail Express International Flat Rate Envelope -')]//ancestor::label[@class='admin__field-label']"/>
2223
</section>
2324
</sections>

app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormPaymentSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,7 @@
3232
<element name="paymentLabelWithRadioButton" type="text" selector="#order-billing_method_form .admin__field-option input[title='{{paymentMethodName}}'] + label" parameterized="true"/>
3333
<element name="checkoutPaymentMethod" type="radio" selector="//div[@class='payment-method _active']/div/input[@id= '{{methodName}}']" parameterized="true"/>
3434
<element name="storedCard" type="radio" selector="#p_method_payflowpro_cc_vault" timeout="30"/>
35+
<element name="selectPaymentMethod" type="radio" selector="//div[@id='order-billing_method_form']//input[@title='Check / Money order']"/>
36+
<element name="checkMoneyOrderText" type="text" selector="//div[@id='order-billing_method_form']//dl//dt//label[contains(text(),'Check / Money order')]"/>
3537
</section>
3638
</sections>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="AdminDisableUSPSActionGroup">
12+
<annotations>
13+
<description>Disable USPS shipping method</description>
14+
</annotations>
15+
<conditionalClick selector="{{AdminShippingMethodUSPSSection.USPSTab}}" dependentSelector="{{AdminShippingMethodUSPSSection.handlingFeeUSPS}}" visible="false" stepKey="openUSPSTab"/>
16+
<checkOption selector="{{AdminShippingMethodUSPSSection.enableCheckoutCheckboxUSPS}}" stepKey="checkEnableForCheckout"/>
17+
<click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/>
18+
<waitForText selector="{{AdminMessagesSection.success}}" userInput="You saved the configuration." stepKey="assertConfigurationSaved"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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="AdminEnableUSPSActionGroup">
12+
<annotations>
13+
<description>Enable United States Postal Service shipping method in backend</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="shipping" defaultValue="USPSShippingMethodConfig"/>
17+
</arguments>
18+
<conditionalClick selector="{{AdminShippingMethodUSPSSection.USPSTab}}" dependentSelector="{{AdminShippingMethodUSPSSection.handlingFeeUSPS}}" visible="false" stepKey="openUSPSTab"/>
19+
<uncheckOption selector="{{AdminShippingMethodUSPSSection.enableCheckoutCheckboxUSPS}}" stepKey="unCheckEnableForCheckout"/>
20+
<selectOption selector="{{AdminShippingMethodUSPSSection.enableCheckoutSelectUSPS}}" userInput="{{shipping.enableCheckoutSelectUSPS}}" stepKey="selectEnableForCheckoutToYes"/>
21+
<uncheckOption selector="{{AdminShippingMethodUSPSSection.gatewayURLCheckboxUSPS}}" stepKey="unCheckGatewayURL"/>
22+
<fillField selector="{{AdminShippingMethodUSPSSection.gatewayURLInputUSPS}}" userInput="{{shipping.gatewayURLInputUSPS}}" stepKey="enterGatewayURL"/>
23+
<uncheckOption selector="{{AdminShippingMethodUSPSSection.secureGatewayURLCheckboxUSPS}}" stepKey="unCheckSecureGatewayURL"/>
24+
<fillField selector="{{AdminShippingMethodUSPSSection.secureGatewayURLInputUSPS}}" userInput="{{shipping.secureGatewayURLInputUSPS}}" stepKey="enterSecureGatewayURL"/>
25+
<fillField selector="{{AdminShippingMethodUSPSSection.usernameUSPS}}" userInput="{{_CREDS.magento/carriers_usps_userid}}" stepKey="enterUsername"/>
26+
<fillField selector="{{AdminShippingMethodUSPSSection.passwordUSPS}}" userInput="{{_CREDS.magento/carriers_usps_password}}" stepKey="enterPassword"/>
27+
<selectOption selector="{{AdminShippingMethodUSPSSection.USPSshowMethodIfNotApplicableField}}" userInput="{{shipping.USPSshowMethodIfNotApplicableField}}" stepKey="selectShowMethodIfNotApplicableToYes"/>
28+
<selectOption selector="{{AdminShippingMethodUSPSSection.debugSelectUSPS}}" userInput="{{shipping.debugSelectUSPS}}" stepKey="selectDebugToYes"/>
29+
<click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/>
30+
<waitForText selector="{{AdminMessagesSection.success}}" userInput="You saved the configuration." stepKey="assertConfigurationSaved"/>
31+
</actionGroup>
32+
</actionGroups>

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,11 @@
2020
<data key="applicableCountries">All Allowed Countries</data>
2121
<data key="showIfNotApplicable">No</data>
2222
</entity>
23-
</entities>
23+
<entity name="USPSShippingMethodConfig" type="shipping">
24+
<data key="enableCheckoutSelectUSPS">Yes</data>
25+
<data key="gatewayURLInputUSPS">http://production.shippingapis.com/ShippingAPI.dll</data>
26+
<data key="secureGatewayURLInputUSPS">https://secure.shippingapis.com/ShippingAPI.dll</data>
27+
<data key="USPSshowMethodIfNotApplicableField">Yes</data>
28+
<data key="debugSelectUSPS">Yes</data>
29+
</entity>
30+
</entities>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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="AdminShippingMethodUSPSSection">
12+
<element name="USPSTab" type="button" selector="//div[@class='section-config']//div[@class='entry-edit-head admin__collapsible-block']//a[@id='carriers_usps-head']"/>
13+
<element name="handlingFeeUSPS" type="input" selector="//tr[@id='row_carriers_usps_handling_fee']//td//input[@id='carriers_usps_handling_fee']"/>
14+
<element name="enableCheckoutCheckboxUSPS" type="checkbox" selector="//tr[@id='row_carriers_usps_active']//td//input[@id='carriers_usps_active_inherit']"/>
15+
<element name="enableCheckoutSelectUSPS" type="select" selector="//tr[@id='row_carriers_usps_active']//td//select[@id='carriers_usps_active']"/>
16+
<element name="gatewayURLCheckboxUSPS" type="checkbox" selector="//tr[@id='row_carriers_usps_gateway_url']//td//input[@id='carriers_usps_gateway_url_inherit']"/>
17+
<element name="gatewayURLInputUSPS" type="input" selector="//tr[@id='row_carriers_usps_gateway_url']//td//input[@id='carriers_usps_gateway_url']"/>
18+
<element name="secureGatewayURLCheckboxUSPS" type="checkbox" selector="//tr[@id='row_carriers_usps_gateway_secure_url']//td//input[@id='carriers_usps_gateway_secure_url_inherit']"/>
19+
<element name="secureGatewayURLInputUSPS" type="input" selector="//tr[@id='row_carriers_usps_gateway_secure_url']//td//input[@id='carriers_usps_gateway_secure_url']"/>
20+
<element name="passwordUSPS" type="input" selector="//input[@id='carriers_usps_password']"/>
21+
<element name="usernameUSPS" type="input" selector="//input[@id='carriers_usps_userid']"/>
22+
<element name="USPSshowMethodIfNotApplicableField" type="select" selector="//tr[@id='row_carriers_usps_showmethod']//td//select[@id='carriers_usps_showmethod']"/>
23+
<element name="debugSelectUSPS" type="select" selector="//tr[@id='row_carriers_usps_debug']//td//select[@id='carriers_usps_debug']"/>
24+
</section>
25+
</sections>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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="USPSShippingSuite">
10+
<before>
11+
<!--Login as Admin-->
12+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
13+
<!--Navigate to shipping method configuration-->
14+
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPageToEnableUSPS"/>
15+
<!--Configure USPS shipping method-->
16+
<actionGroup ref="AdminEnableUSPSActionGroup" stepKey="configureUSPSShippingMethod">
17+
<argument name="shipping" value="USPSShippingMethodConfig"/>
18+
</actionGroup>
19+
<!--Cache flush-->
20+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCachePostConfiguring">
21+
<argument name="tags" value="config full_page"/>
22+
</actionGroup>
23+
</before>
24+
<after>
25+
<!--Navigate to shipping method configuration-->
26+
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPageToDisableUSPS"/>
27+
<!--Disable USPS shipping carrier-->
28+
<actionGroup ref="AdminDisableUSPSActionGroup" stepKey="disableUSPS"/>
29+
</after>
30+
<include>
31+
<group name="EnableUSPSShippingSuite"/>
32+
</include>
33+
</suite>
34+
</suites>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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="AdminPlaceOrderWithUSPSOnlineShippingCarrierTest">
12+
<annotations>
13+
<stories value="Place order using USPS Shipping carrier"/>
14+
<title value="Use USPS online shipping carrier during order placement in admin for registered customer Test"/>
15+
<description value="Select USPS online shipping method while order placement from backend for a registered customer"/>
16+
<testCaseId value="AC-5374"/>
17+
<severity value="MAJOR"/>
18+
<features value="Shipping"/>
19+
<group value="3rd_party_integration"/>
20+
<group value="EnableUSPSShippingSuite"/>
21+
<!-- <group value="pr_exclude"/>-->
22+
</annotations>
23+
<before>
24+
<!--Login as Admin-->
25+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdminToConfig"/>
26+
<!-- Create product -->
27+
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
28+
<field key="price">100.00</field>
29+
</createData>
30+
<!--Create UK customer-->
31+
<createData entity="UKCustomer" stepKey="createUKCustomer"/>
32+
<!-- Enabling Check/Money Order Payment Method -->
33+
<magentoCLI command="config:set {{EnableCheckMoneyOrderPaymentMethod.path}} {{EnableCheckMoneyOrderPaymentMethod.value}}" stepKey="enableCheckMoneyOrderPaymentMethod"/>
34+
<!--Set US Shipping settings origin data-->
35+
<actionGroup ref="AdminSetShippingOriginConfigActionGroup" stepKey="setShippingOriginConfigurationData">
36+
<argument name="country" value="United States"/>
37+
<argument name="state" value="Texas"/>
38+
<argument name="postcode" value="78729"/>
39+
</actionGroup>
40+
<!--Cache flush-->
41+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCachePostConfiguring">
42+
<argument name="tags" value="config full_page"/>
43+
</actionGroup>
44+
</before>
45+
<after>
46+
<!--Reset Shipping Origin configurations to default | default address - US California-->
47+
<actionGroup ref="AdminResetShippingOriginConfigurationActionGroup" stepKey="resetShippingOriginConfig"/>
48+
<!--delete UK customer-->
49+
<deleteData createDataKey="createUKCustomer" stepKey="deleteCustomer"/>
50+
<!--delete product-->
51+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
52+
<!--Logout Admin-->
53+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdminToRollBackConfig"/>
54+
</after>
55+
<!--Navigate to create new order with existing customer-->
56+
<actionGroup ref="AdminNavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer">
57+
<argument name="customer" value="$$createUKCustomer$$"/>
58+
</actionGroup>
59+
<!--Admin add simple product to order-->
60+
<actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder">
61+
<argument name="product" value="$$createSimpleProduct$$"/>
62+
</actionGroup>
63+
<!--Admin add new UK billing address while creating order-->
64+
<selectOption userInput="Add New Address" selector="{{AdminOrderFormBillingAddressSection.selectAddress}}" stepKey="addNewBillingAddress" />
65+
<actionGroup ref="AdminFillAddressInformationInOrderActionGroup" stepKey="FillOrderNewShippingAddress">
66+
<argument name="customer" value="$$createUKCustomer$$"/>
67+
<argument name="address" value="UK_Not_Default_Address"/>
68+
</actionGroup>
69+
<!--Scroll to element & click to reflect details as per defined address & customer-->
70+
<scrollTo selector="{{AdminOrderFormBillingAddressSection.Phone}}" stepKey="scrollToElementInteractable"/>
71+
<click selector="{{AdminOrderFormPaymentSection.linkPaymentOptions}}" stepKey="clickToReflectDetailsAccordingToInputData"/>
72+
<!--click on get available payment methods link-->
73+
<click selector="{{AdminOrderFormPaymentSection.linkPaymentOptions}}" stepKey="clickGetAvailablePaymentMethods"/>
74+
<!--select Check/Money order payment method-->
75+
<conditionalClick selector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" dependentSelector="{{AdminOrderFormPaymentSection.checkMoneyOrderText}}" visible="false" stepKey="selectCheckMoneyOrder"/>
76+
<!--click on get shipping methods link-->
77+
<click selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="clickGetAvailableShippingMethods"/>
78+
<!--select Priority Mail Express International Flat Rate USPS shipping method-->
79+
<click selector="{{AdminInvoicePaymentShippingSection.selectUSPSType}}" stepKey="selectUSPSMethod"/>
80+
<waitForAjaxLoad stepKey="waitForAjaxLoadPostSelectingUSPSShippingMethod"/>
81+
<!--click submit order-->
82+
<actionGroup ref="AdminOrderClickSubmitOrderActionGroup" stepKey="clickSubmitOrder" />
83+
<!--Assert order created-->
84+
<actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="checkOrderSuccessfullyCreated"/>
85+
</test>
86+
</tests>

0 commit comments

Comments
 (0)