Skip to content

Commit 3f37841

Browse files
committed
AC-6116 :Cancel an order with paypal express checkout as payment method
paypal
1 parent a98a64a commit 3f37841

File tree

2 files changed

+80
-15
lines changed

2 files changed

+80
-15
lines changed

app/code/Magento/Paypal/Test/Mftf/ActionGroup/SwitchToPayPalGroupBtnActionGroup.xml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11-
<actionGroup name="SwitchToPayPalGroupBtnActionGroup">
12-
<annotations>
13-
<description>Switch to Paypal group button</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-
<waitForElementVisible selector="{{CheckoutPaymentSection.PayPalBtn}}" stepKey="waitForPayPalBtn"/>
23-
<click selector="{{CheckoutPaymentSection.PayPalBtn}}" stepKey="clickPayPalBtn"/>
24-
<switchToIFrame stepKey="switchBackToMainFrame"/>
25-
</actionGroup>
11+
<actionGroup name="SwitchToPayPalGroupBtnActionGroup">
12+
<annotations>
13+
<description>Switch to Paypal group button</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="elementNumber" type="string" defaultValue="0"/>
17+
<argument name="frameName" type="string" defaultValue="myFrame"/>
18+
</arguments>
19+
<!--set ID for iframe of PayPal group button-->
20+
<executeJS function="document.getElementsByClassName('component-frame')[{{elementNumber}}].setAttribute('name', '{{frameName}}');" stepKey="setIDForIframe"/>
21+
<!--switch to iframe of PayPal group button-->
22+
<switchToIFrame userInput="{{frameName}}" stepKey="switchToIframe"/>
23+
<waitForElementClickable selector="{{CheckoutPaymentSection.PayPalBtn}}" stepKey="waitForPayPalBtn"/>
24+
<click selector="{{CheckoutPaymentSection.PayPalBtn}}" stepKey="clickPayPalBtn"/>
25+
<switchToIFrame stepKey="switchBackToMainFrame"/>
26+
</actionGroup>
2627
</actionGroups>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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="AdminCancelPaypalExpressCheckoutTest">
11+
<annotations>
12+
<features value="PayPal"/>
13+
<stories value="Cancel an order with paypal express checkout"/>
14+
<title value="Cancel an order with paypal express checkout with valid credentials"/>
15+
<description value="Cancel an order with paypal express checkout as payment method"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-6116"/>
18+
<group value="3rd_party_integration"/>
19+
</annotations>
20+
<before>
21+
<!-- Create Product -->
22+
<createData entity="_defaultProduct" stepKey="createSimpleProduct">
23+
<field key="price">10</field>
24+
</createData>
25+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
26+
<!-- Configure Paypal Express Checkout -->
27+
<actionGroup ref="AdminPayPalExpressCheckoutEnableActionGroup" stepKey="ConfigPayPalExpress">
28+
<argument name="credentials" value="SamplePaypalExpressConfig2"/>
29+
</actionGroup>
30+
</before>
31+
<after>
32+
<magentoCLI command="config:set payment/paypal_express/active 0" stepKey="disablePayPalExpress"/>
33+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
34+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
35+
</after>
36+
<!-- Go to storefront home page -->
37+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToStoreFront"/>
38+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductPage">
39+
<argument name="product" value="$createSimpleProduct$"/>
40+
</actionGroup>
41+
<!-- Click on PayPal payment button -->
42+
<actionGroup ref="SwitchToPayPalGroupBtnActionGroup" stepKey="clickPayPalBtn"/>
43+
<!-- display PayPal popup and close the PayPal popup-->
44+
<switchToNextTab stepKey="switchToDownloadedLinkTab"/>
45+
<waitForPageLoad stepKey="waitForPageLoad"/>
46+
<closeTab stepKey="closeStorefrontTab"/>
47+
<waitForPageLoad stepKey="waitForPageLoadAgain" time="30"/>
48+
<!-- Goes to Shopping Cart page and Product is added to cart -->
49+
<seeInCurrentUrl url="{{CheckoutCartPage.url}}" stepKey="assertUrl"/>
50+
<seeInField userInput="1" selector="{{CheckoutCartProductSection.ProductQuantityByName($$createSimpleProduct.name$$)}}" stepKey="seeInQtyField20"/>
51+
<!-- Again Click on PayPal payment button -->
52+
<actionGroup ref="SwitchToPayPalGroupBtnActionGroup" stepKey="clickPayPalBtnAgain">
53+
<argument name="elementNumber" value="1"/>
54+
<argument name="frameName" value="myFrame2"/>
55+
</actionGroup>
56+
<!-- Login to Paypal in-context-->
57+
<actionGroup ref="StorefrontLoginToPayPalPaymentAccountTwoStepActionGroup" stepKey="loginToPayPal"/>
58+
<actionGroup ref="StorefrontPaypalSwitchBackToMagentoFromCheckoutPageActionGroup" stepKey="confirmPaymentAndGoBackToMagento"/>
59+
<actionGroup ref="StorefrontPlaceOrderOnOrderReviewPageActionGroup" stepKey="clickPlaceOrderBtn"/>
60+
<!-- I see order successful Page -->
61+
<waitForElementVisible selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="waitForOrderNumberToBeGrabbed"/>
62+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/>
63+
</test>
64+
</tests>

0 commit comments

Comments
 (0)