Skip to content

Commit 393dcae

Browse files
Neil RautNeil Raut
authored andcommitted
ACQE-6361: Notify invalid address for PayPal checkout
Implemented AC-3995, PR raised
1 parent 7cabfb4 commit 393dcae

File tree

6 files changed

+150
-0
lines changed

6 files changed

+150
-0
lines changed

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartMessageSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<element name="emptyCartMessage" type="text" selector=".cart-empty>p"/>
1515
<element name="errorMessageText" type="text" selector="//div[contains(@class, 'message-error')]/div[text()='{{var}}']" parameterized="true"/>
1616
<element name="backorderErrorMessage" type="text" selector=".//*[@class='cart item']//div[@class='cart item message notice']"/>
17+
<element name="invalidAddressError" type="text" selector="//div[contains(text(),'PayPal gateway has rejected request. A match of the Shipping Address City, State, and Postal Code failed (#10736: Shipping Address Invalid City State Postal Code)')]"/>
1718
</section>
1819
</sections>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartSummarySection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@
4242
<element name="fptAmount" type="text" selector="//*[@id='cart-totals']//tr[@class='totals']//td[@class='amount']/span"/>
4343
<element name="canadaTaxAmount" type="text" selector="//span[@data-th='Canada-GST-5%']"/>
4444
<element name="canadaPstTaxAmount" type="text" selector="//span[@data-th='Canada-GST-PST-5%']"/>
45+
<element name="PayPalBtnLessTimeout" type="button" selector=".paypal-button.paypal-button-number-0" timeout="3”/>
4546
</section>
4647
</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="StorefrontAssertInvalidAddressErrorActionGroup">
12+
<annotations>
13+
<description>Storefront assert invalid address error through PayPal checkout on Checkout, Cart and Mini Cart page</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="invalidAddressError" type="string"/>
17+
</arguments>
18+
<waitForElementVisible selector="{{invalidAddressError}}" stepKey="assertErrorMessage"/>
19+
</actionGroup>
20+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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="StorefrontSwitchPayPalGroupBtnWithLessTimeoutActionGroup">
12+
<annotations>
13+
<description>Switch to Paypal group button with less timeout</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="elementNumber" type="string" defaultValue="0"/>
17+
</arguments>
18+
<!--set ID for iframe of PayPal group button-->
19+
<executeJS function="document.getElementsByClassName('component-frame')[{{elementNumber}}].setAttribute('name', 'myFrame');" stepKey="setIDForIframe"/>
20+
<!--switch to iframe of PayPal group button-->
21+
<switchToIFrame userInput="myFrame" stepKey="switchToIframe"/>
22+
<!--click on PayPal button-->
23+
<waitForElementVisible selector="{{CheckoutPaymentSection.PayPalBtnLessTimeout}}" stepKey="waitForPayPalBtn"/>
24+
<click selector="{{CheckoutPaymentSection.PayPalBtnLessTimeout}}" stepKey="clickPayPalBtn"/>
25+
<!--switch back to default iframe-->
26+
<switchToIFrame stepKey="switchBackToMainFrame"/>
27+
</actionGroup>
28+
</actionGroups>

app/code/Magento/Paypal/Test/Mftf/Section/PayPalExpressCheckoutConfigSection/CheckoutPaymentSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@
2525
<element name="expirationYear" type="input" selector="//input[@id='expdate_year']" timeout="10"/>
2626
<element name="cvv" type="input" selector="//input[@id='cvv2_number']" timeout="10"/>
2727
<element name="payNowBtn" type="button" selector="//input[@id='btn_pay_cc']" timeout="10"/>
28+
<element name="invalidAddressError" type="text" selector="//div[@data-ui-id='checkout-cart-validationmessages-message-error']" timeout="5"/>
29+
<element name="PayPalBtnLessTimeout" type="button" selector=".paypal-button.paypal-button-number-0" timeout="3"/>
2830
</section>
2931
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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="StorefrontNotifyInvalidAddressToCustomerForPayPalCheckoutTest">
12+
<annotations>
13+
<features value="PayPal"/>
14+
<stories value="Notify invalid address for PayPal checkout"/>
15+
<title value="Customer is notified if address is invalid for PayPal through Checkout flow"/>
16+
<description value="Verify that customer is notified with error message about wrong address for PayPal on all Magento Storefront pages"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-3995"/>
19+
<!--<group value="paypal"/>-->
20+
<!--<group value="paypalExpress"/>-->
21+
<!--<group value="pr_exclude"/>-->
22+
</annotations>
23+
<before>
24+
<!--Login as Admin-->
25+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
26+
<!--Create product-->
27+
<createData entity="SimpleProduct" stepKey="createProduct"/>
28+
</before>
29+
<after>
30+
<!--Delete product-->
31+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
32+
<!--Logout as Admin-->
33+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAsAdmin"/>
34+
</after>
35+
<!--Navigate to storefront home page-->
36+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToStorefrontHomePage"/>
37+
<!--Open product page-->
38+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openCreatedProductPage">
39+
<argument name="product" value="$$createProduct$$"/>
40+
</actionGroup>
41+
<!--Add product to cart-->
42+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
43+
<argument name="product" value="$$createProduct$$"/>
44+
<argument name="productCount" value="1"/>
45+
</actionGroup>
46+
<!--Navigate to shopping cart-->
47+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openShoppingCartPage"/>
48+
<!--Navigate to Shipping details page-->
49+
<actionGroup ref="StorefrontClickProceedToCheckoutActionGroup" stepKey="goToShippingPage"/>
50+
<!--Enter static shipping details with invalid data-->
51+
<fillField selector="{{CheckoutShippingSection.emailAddress}}" userInput="[email protected]" stepKey="setInvalidCustomerEmail"/>
52+
<fillField selector="{{CheckoutShippingSection.firstName}}" userInput="[email protected]" stepKey="SetInvalidCustomerFirstName"/>
53+
<fillField selector="{{CheckoutShippingSection.lastName}}" userInput="[email protected]" stepKey="SetInvalidCustomerLastName"/>
54+
<fillField selector="{{CheckoutShippingSection.street}}" userInput="[email protected]" stepKey="SetInvalidStreetAddress"/>
55+
<waitForElementVisible selector="{{CheckoutShippingSection.country}}" stepKey="waitToSelectCountry"/>
56+
<selectOption selector="{{CheckoutShippingSection.country}}" userInput="United States" stepKey="selectCountryInStorefrontAddressBook"/>
57+
<waitForElementVisible selector="{{CheckoutShippingSection.region}}" stepKey="waitToSelectState"/>
58+
<selectOption selector="{{CheckoutShippingSection.region}}" userInput="California" stepKey="selectStateInStorefrontAddressBook"/>
59+
<fillField selector="{{CheckoutShippingSection.city}}" userInput="[email protected]" stepKey="SetInvalidCity"/>
60+
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="[email protected]" stepKey="SetInvalidZipCode"/>
61+
<fillField selector="{{CheckoutShippingSection.telephone}}" userInput="[email protected]" stepKey="SetInvalidPhoneNumber"/>
62+
<!--Select Flat Rate shipping method-->
63+
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
64+
<!--Navigate to Review and Payments page-->
65+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="goToPaymentPage"/>
66+
<!-- click on PayPal payment radio button -->
67+
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPayPalExpressButton"/>
68+
<click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="clickPayPalExpressButton"/>
69+
<!--Switch to paypal group and click on paypal button-->
70+
<actionGroup ref="StorefrontSwitchPayPalGroupBtnWithLessTimeoutActionGroup" stepKey="clickPayPalButtonFromCheckoutPage"/>
71+
<!--Assert invalid address error from checkout page-->
72+
<actionGroup ref="StorefrontAssertInvalidAddressErrorActionGroup" stepKey="assertInvalidAddressErrorFromCheckoutPage">
73+
<argument name="invalidAddressError" value="{{CheckoutPaymentSection.invalidAddressError}}"/>
74+
</actionGroup>
75+
<!--Navigate to shopping cart-->
76+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openShoppingCartPageForAssertion"/>
77+
<!-- Click on Paypal paypal button on cart page-->
78+
<actionGroup ref="SwitchToPayPalGroupBtnActionGroup" stepKey="clickPayPalBtnFromCartPage">
79+
<argument name="elementNumber" value="1"/>
80+
</actionGroup>
81+
<!--Assert invalid address error from cart page-->
82+
<actionGroup ref="StorefrontAssertInvalidAddressErrorActionGroup" stepKey="assertErrorMessageFromCartPage">
83+
<argument name="invalidAddressError" value="{{CheckoutCartMessageSection.invalidAddressError}}"/>
84+
</actionGroup>
85+
<!-- Open Mini Cart -->
86+
<actionGroup ref="StorefrontOpenMiniCartActionGroup" stepKey="openMiniCart"/>
87+
<!-- Click on Paypal paypal button on mini cart page-->
88+
<actionGroup ref="SwitchToPayPalGroupBtnActionGroup" stepKey="clickPayPalBtnFromMiniCart">
89+
<argument name="elementNumber" value="1"/>
90+
</actionGroup>
91+
<!--Close Mini Cart-->
92+
<click selector="{{StorefrontMinicartSection.minicartclose}}" stepKey="closeMiniCart"/>
93+
<!--Assert invalid address error from mini cart page-->
94+
<actionGroup ref="StorefrontAssertInvalidAddressErrorActionGroup" stepKey="assertErrorMessage2">
95+
<argument name="invalidAddressError" value="{{CheckoutCartMessageSection.invalidAddressError}}"/>
96+
</actionGroup>
97+
</test>
98+
</tests>

0 commit comments

Comments
 (0)