Skip to content

Commit 8ef8a47

Browse files
Merge branch 'ACQE-8545' into ACQE-functional-deployment-v4-5
2 parents 7015570 + 010542b commit 8ef8a47

File tree

3 files changed

+133
-0
lines changed

3 files changed

+133
-0
lines changed

app/code/Magento/Paypal/Test/Mftf/Data/PaypalData.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,5 +324,7 @@
324324
<data key="status">void</data>
325325
<data key="label">Voided</data>
326326
<data key="cancelled_note">Canceled order online Amount: $15.00.</data>
327+
<data key="refund_status">Refunded</data>
328+
<data key="refund_note">We refunded $25.00 offline.</data>
327329
</entity>
328330
</entities>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,7 @@
7676
<element name="productCharged" type="text" selector="//tr[@class='grand totals']//span[@class='price' and contains(text(),'HK$')]"/>
7777
<element name="reviewOrder" type="button" selector="//button[.//span[normalize-space(text())='Review Order']]"/>
7878
<element name="checkoutWithPaypal" type="button" selector="(//div[@class='cart-container']//input[@data-action='checkout-form-submit'])[1]" timeout="30"/>
79+
<element name="status" type="input" selector="//*[@class='admin__table-secondary creditmemo-information-table']//*[text()='{{action}}']" parameterized="true"/>
80+
<element name="creditMemoView" type="text" selector="#sales_order_view_tabs_order_creditmemos_content > div > div.admin__data-grid-wrap > table > tbody > tr > td.data-grid-actions-cell > a"/>
7981
</section>
8082
</sections>
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
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="AdminRefundSalesOrderPartiallyWithPaypalBillingAgreementTest">
12+
<annotations>
13+
<features value="PayPal"/>
14+
<stories value="Partial Refund Order with billing agreement"/>
15+
<title value="Partial Refund order placed within Billing Agreement"/>
16+
<description value="Place an order with billing agreement as payment method and refund partially the order"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-5289"/>
19+
<group value="3rd_party_integration"/>
20+
<group value="pr_exclude"/>
21+
</annotations>
22+
<before>
23+
<!-- Simple product is created -->
24+
<createData entity="SimpleProduct" stepKey="createProduct">
25+
<field key="price">15</field>
26+
</createData>
27+
<!-- US Customer is created -->
28+
<createData entity="Simple_US_Customer_CA" stepKey="createCustomer"/>
29+
<!-- Set Billing Agreement value to Auto -->
30+
<magentoCLI command="config:set {{BillingAgreement.path}} {{BillingAgreement.value}}" stepKey="enableAutoBilling"/>
31+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
32+
<!-- Configure PayPal Express Checkout -->
33+
<actionGroup ref="AdminPayPalExpressCheckoutEnableActionGroup" stepKey="ConfigPayPalExpress">
34+
<argument name="credentials" value="SamplePaypalExpressConfig2"/>
35+
</actionGroup>
36+
<actionGroup ref="AdminPayPalExpressCheckoutEnableBillingAgreementActionGroup" stepKey="enableBillingAgreement">
37+
<argument name="countryCode" value="{{MerchantUnitedStates.value}}"/>
38+
</actionGroup>
39+
<!-- Precondition Step 1: Order is placed within PayPal Billing Agreement -->
40+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="storefrontCustomerLogin">
41+
<argument name="Customer" value="$$createCustomer$$"/>
42+
</actionGroup>
43+
<!-- Add product to cart -->
44+
<actionGroup ref="StorefrontAddSimpleProductWithQtyActionGroup" stepKey="addProductToCart">
45+
<argument name="product" value="$$createProduct$$"/>
46+
<argument name="quantity" value="2"/>
47+
</actionGroup>
48+
<!-- Go to Checkout Page -->
49+
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goToCheckout"/>
50+
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShipping"/>
51+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
52+
<!-- Click on PayPal payment radio button -->
53+
<waitForElementClickable selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="waitForPayPalRadioButton"/>
54+
<click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="selectPaypalPayment"/>
55+
<actionGroup ref="SwitchToPayPalGroupBtnActionGroup" stepKey="clickPayPalBtn"/>
56+
<!-- Login to Paypal in-context-->
57+
<actionGroup ref="StorefrontLoginToPayPalPaymentAccountTwoStepActionGroup" stepKey="loginToPayPal"/>
58+
<!-- Click PayPal button and go back to Magento site -->
59+
<actionGroup ref="StorefrontPaypalSwitchBackToMagentoFromCheckoutPageActionGroup" stepKey="confirmPaymentAndGoBackToMagento"/>
60+
</before>
61+
<after>
62+
<actionGroup ref="AdminPayPalExpressCheckoutDisableActionGroup" stepKey="disablePaypalExpressCheckout"/>
63+
<!-- Login to Paypal in-context-->
64+
<actionGroup ref="AdminClearPayPalExpressCheckoutDataActionGroup" stepKey="clearPaypalExpressCheckoutFields"/>
65+
<actionGroup ref="AdminPayPalExpressCheckoutDisableBillingAgreementActionGroup" stepKey="disableBillingAgreement">
66+
<argument name="countryCode" value="{{MerchantUnitedStates.value}}"/>
67+
</actionGroup>
68+
<!-- Set Billing Agreement value to default -->
69+
<magentoCLI command="config:set {{BillingAgreement.path}} {{BillingAgreement.default}}" stepKey="disableAutoBilling"/>
70+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
71+
<!-- Delete Data -->
72+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
73+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
74+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
75+
</after>
76+
<actionGroup ref="AssertStorefrontCheckoutSuccessActionGroup" stepKey="assertOrderSuccess"/>
77+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="orderNumber"/>
78+
<waitForElementVisible selector="{{CheckoutSuccessMainSection.billingAgreement}}" stepKey="waitForBillingAgreement"/>
79+
<grabTextFrom selector="{{CheckoutSuccessMainSection.billingAgreement}}" stepKey="billingAgreement"/>
80+
<assertNotEmpty stepKey="assertOrderIdIsNotEmpty">
81+
<actualResult type="const">$orderNumber</actualResult>
82+
</assertNotEmpty>
83+
<assertNotEmpty stepKey="assertBillingAgreementIsNotEmpty">
84+
<actualResult type="const">$billingAgreement</actualResult>
85+
</assertNotEmpty>
86+
<!-- Step 2&3: Go to Sales > Orders & Open the Order from preconditions -->
87+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrder">
88+
<argument name="orderId" value="{$orderNumber}"/>
89+
</actionGroup>
90+
<!-- Step 4&5: Refund created order & Click OK button-->
91+
<actionGroup ref="AdminCreateInvoiceActionGroup" stepKey="createInvoice"/>
92+
<!--Create Credit Memo-->
93+
<click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="clickCreditMemo"/>
94+
<waitForElementClickable selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForOkButtonToBeClicked"/>
95+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmCreditMemo"/>
96+
<waitForElementVisible selector="{{AdminCreditMemoItemsSection.itemQtyToRefund('1')}}" stepKey="waitToItemToRefundTextField"/>
97+
<fillField selector="{{AdminCreditMemoItemsSection.itemQtyToRefund('1')}}" userInput="1" stepKey="partialRefund"/>
98+
<waitForElementClickable selector="{{AdminCreditMemoItemsSection.updateQty}}" stepKey="waitToClickUpdateQuantity"/>
99+
<click selector="{{AdminCreditMemoItemsSection.updateQty}}" stepKey="updateQuantityToRefund"/>
100+
<!--Step 6: Create Refund Button -->
101+
<waitForElementVisible selector="{{AdminCreditMemoItemsSection.refundbtn}}" stepKey="waitForSuccesMessagea"/>
102+
<click selector="{{AdminCreditMemoItemsSection.refundbtn}}" stepKey="clickRefundOffline"/>
103+
<actionGroup ref="AdminOrderViewCheckStatusActionGroup" stepKey="checkOrderStatus">
104+
<argument name="status" value="Processing"/>
105+
</actionGroup>
106+
<actionGroup ref="AdminOpenOrderCommentsHistoryActionGroup" stepKey="clickOnCommentsHistoryTab"/>
107+
<waitForText selector="{{AdminOrderCommentsTabSection.orderComments}}" userInput="{{BillingAgreement.refund_note}}" stepKey="seeOrderHistoryPrice"/>
108+
<!--Step 7: Go to Credit Memo Tab -->
109+
<click selector="{{AdminOrderDetailsOrderViewSection.creditMemos}}" stepKey="clickCreditMemoTab"/>
110+
<waitForElementVisible selector="{{CheckoutPaymentSection.creditMemoView}}" stepKey="seeCreditMemoViewButton"/>
111+
<click selector="{{CheckoutPaymentSection.creditMemoView}}" stepKey="clickCreditMemoViewButton"/>
112+
<waitForElementVisible selector="{{CheckoutPaymentSection.status(BillingAgreement.refund_status)}}" stepKey="waitForStatusInCreditMemo"/>
113+
<waitForText selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$25.00" stepKey="checkOrderTotalInBackend"/>
114+
<waitForElementClickable selector="{{AdminProductFormActionSection.backButton}}" stepKey="waitForBackButtonToBeClicked"/>
115+
<click selector="{{AdminProductFormActionSection.backButton}}" stepKey="clickBackButton"/>
116+
<!--Step 8: Go to Transaction Tab -->
117+
<waitForElementClickable selector="{{AdminTransactionsGridSection.transactionsSectionBtn}}" stepKey="waitForTransactionsTabToBeClicked"/>
118+
<click selector="{{AdminTransactionsGridSection.transactionsSectionBtn}}" stepKey="clickTransactionsTab"/>
119+
<actionGroup ref="AdminAssertTransitionTypeStatusNewActionGroup" stepKey="assertTransactionTypeStatusForAuthorization">
120+
<argument name="transactionType" value="authorization"/>
121+
<argument name="transitionTypeStatus" value="Yes"/>
122+
</actionGroup>
123+
<actionGroup ref="AdminAssertTransitionTypeStatusNewActionGroup" stepKey="assertTransactionTypeStatusForCapture">
124+
<argument name="transactionType" value="capture"/>
125+
<argument name="transitionTypeStatus" value="No"/>
126+
</actionGroup>
127+
</test>
128+
</tests>
129+

0 commit comments

Comments
 (0)