Skip to content

Commit eba8c02

Browse files
committed
ACQE-8546: Void a Sales Order placed within Billing Agreement
- New automation testfile has been updated
1 parent a1c57b2 commit eba8c02

File tree

4 files changed

+138
-4
lines changed

4 files changed

+138
-4
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,13 @@
315315
<data key="path">payment/wps_express/active</data>
316316
<data key="value">0</data>
317317
</entity>
318+
<entity name="BillingAgreement" type="paypal">
319+
<data key="path">payment/paypal_express/allow_ba_signup</data>
320+
<data key="default">never</data>
321+
<data key="value">Auto</data>
322+
<data key="comment">Created billing agreement</data>
323+
<data key="amount_note">Voided authorization. Amount: $15.00.</data>
324+
<data key="status">void</data>
325+
<data key="label">Voided</data>
326+
</entity>
318327
</entities>
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
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="AdminVoidSalesOrderWithPaypalBillingAgreementTest">
12+
<annotations>
13+
<features value="PayPal"/>
14+
<stories value="Void Order with billing agreement"/>
15+
<title value="Void order placed within Billing Agreement"/>
16+
<description value="Place an order with billing agreement as payment method and Void the Order"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-5004"/>
19+
<group value="3rd_party_integration"/>
20+
</annotations>
21+
<before>
22+
<!-- Simple product is created -->
23+
<createData entity="SimpleProduct" stepKey="createProduct">
24+
<field key="price">10</field>
25+
</createData>
26+
<!-- US Customer is created -->
27+
<createData entity="Simple_US_Customer_CA" stepKey="createCustomer"/>
28+
<!-- Set Billing Agreement value to Auto -->
29+
<magentoCLI command="config:set {{BillingAgreement.path}} {{BillingAgreement.value}}" stepKey="enableAutoBilling"/>
30+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
31+
<!-- Configure PayPal Express Checkout -->
32+
<actionGroup ref="AdminPayPalExpressCheckoutEnableActionGroup" stepKey="ConfigPayPalExpress">
33+
<argument name="credentials" value="SamplePaypalExpressConfig2"/>
34+
</actionGroup>
35+
<actionGroup ref="AdminPayPalExpressCheckoutEnableBillingAgreementActionGroup" stepKey="enableBillingAgreement">
36+
<argument name="countryCode" value="{{MerchantUnitedStates.value}}"/>
37+
</actionGroup>
38+
<!-- Precondition Step 1: Order is placed within PayPal Billing Agreement -->
39+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="storefrontCustomerLogin">
40+
<argument name="Customer" value="$$createCustomer$$"/>
41+
</actionGroup>
42+
<!-- Add product to cart -->
43+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart">
44+
<argument name="product" value="$$createProduct$$"/>
45+
</actionGroup>
46+
<!-- Go to Checkout Page -->
47+
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goToCheckout"/>
48+
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShipping"/>
49+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
50+
<!-- Click on PayPal payment radio button -->
51+
<waitForElementClickable selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="waitForPayPalRadioButton"/>
52+
<click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="selectPaypalPayment"/>
53+
<actionGroup ref="SwitchToPayPalGroupBtnActionGroup" stepKey="clickPayPalBtn"/>
54+
<!-- Login to Paypal in-context-->
55+
<actionGroup ref="StorefrontLoginToPayPalPaymentAccountTwoStepActionGroup" stepKey="loginToPayPal"/>
56+
<!-- Click PayPal button and go back to Magento site -->
57+
<actionGroup ref="StorefrontPaypalSwitchBackToMagentoFromCheckoutPageActionGroup" stepKey="confirmPaymentAndGoBackToMagento"/>
58+
</before>
59+
<after>
60+
<actionGroup ref="AdminPayPalExpressCheckoutDisableActionGroup" stepKey="disablePaypalExpressCheckout"/>
61+
<!-- Login to Paypal in-context-->
62+
<actionGroup ref="AdminClearPayPalExpressCheckoutDataActionGroup" stepKey="clearPaypalExpressCheckoutFields"/>
63+
<actionGroup ref="AdminPayPalExpressCheckoutDisableBillingAgreementActionGroup" stepKey="disableBillingAgreement">
64+
<argument name="countryCode" value="{{MerchantUnitedStates.value}}"/>
65+
</actionGroup>
66+
<!-- Set Billing Agreement value to default -->
67+
<magentoCLI command="config:set {{BillingAgreement.path}} {{BillingAgreement.default}}" stepKey="disableAutoBilling"/>
68+
<!-- Delete Data -->
69+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
70+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
71+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
72+
</after>
73+
<actionGroup ref="AssertStorefrontCheckoutSuccessActionGroup" stepKey="assertOrderSuccess"/>
74+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="orderNumber"/>
75+
<waitForElementVisible selector="{{CheckoutSuccessMainSection.billingAgreement}}" stepKey="waitForBillingAgreement"/>
76+
<grabTextFrom selector="{{CheckoutSuccessMainSection.billingAgreement}}" stepKey="billingAgreement"/>
77+
<assertNotEmpty stepKey="assertOrderIdIsNotEmpty">
78+
<actualResult type="const">$orderNumber</actualResult>
79+
</assertNotEmpty>
80+
<assertNotEmpty stepKey="assertBillingAgreementIsNotEmpty">
81+
<actualResult type="const">$billingAgreement</actualResult>
82+
</assertNotEmpty>
83+
<!-- Step 2&3: Go to Sales > Orders & Open the Order from preconditions -->
84+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrder">
85+
<argument name="orderId" value="{$orderNumber}"/>
86+
</actionGroup>
87+
<!-- Step 4&5: Void created order & Click OK button-->
88+
<actionGroup ref="AdminVoidPendingOrderActionGroup" stepKey="voidPendingOrder"/>
89+
<actionGroup ref="AdminOrderViewCheckStatusActionGroup" stepKey="checkOrderStatus">
90+
<argument name="status" value="{{OrderStatus.processing}}"/>
91+
</actionGroup>
92+
<!-- Step 6: Observe order data -->
93+
<waitForElementVisible selector="{{AdminOrderDetailsInformationSection.paymentInformationField('Last Transaction ID')}}" stepKey="waitForGrabLastTransactionID"/>
94+
<grabTextFrom selector="{{AdminOrderDetailsInformationSection.paymentInformationField('Last Transaction ID')}}" stepKey="grabLastTransactionID"/>
95+
<waitForElementVisible selector="{{AdminOrderNotesSection.voidAuthorizationId('$grabLastTransactionID')}}" stepKey="waitForVoidAuthorizationNotesWithID"/>
96+
<grabTextFrom selector="{{AdminOrderNotesSection.voidAuthorizationId('$grabLastTransactionID')}}" stepKey="getVoidAuthorizationNotesWithID"/>
97+
<actionGroup ref="AdminOpenOrderCommentsHistoryActionGroup" stepKey="clickOnCommentsHistoryTab"/>
98+
<grabTextFrom selector="{{AdminOrderCommentsTabSection.orderCommentsWithType(BillingAgreement.comment)}}" stepKey="grabOrderStatus"/>
99+
<waitForText selector="{{AdminOrderCommentsTabSection.authorizationNotes(BillingAgreement.label)}}" userInput="$getVoidAuthorizationNotesWithID" stepKey="seeOrderHistoryNotes"/>
100+
<waitForText selector="{{AdminOrderCommentsTabSection.orderComments}}" userInput="{{BillingAgreement.amount_note}}" stepKey="seeOrderHistoryPrice"/>
101+
<!-- Check the last transaction of the order and validate the details for Void and Authorization-->
102+
<waitForElementClickable selector="{{AdminTransactionsGridSection.transactionsSectionBtn}}" stepKey="waitForTransactionsTabToBeClicked"/>
103+
<click selector="{{AdminTransactionsGridSection.transactionsSectionBtn}}" stepKey="clickTransactionsTab"/>
104+
<waitForElementVisible selector="{{AdminTransactionsGridSection.orderTxnTable}}" stepKey="orderTransactionsTableIsVisible"/>
105+
<selectOption selector="{{AdminTransactionsGridSection.orderTxnTableTypeFilter}}" userInput="{{BillingAgreement.status}}" stepKey="selectVoidTypeTxn"/>
106+
<waitForElementClickable selector="{{AdminTransactionsGridSection.orderTxnTableSearchBtn}}" stepKey="waitToClickSearch"/>
107+
<click selector="{{AdminTransactionsGridSection.orderTxnTableSearchBtn}}" stepKey="clickSearch"/>
108+
<waitForPageLoad stepKey="waitForFilterToLoad"/>
109+
<waitForElementClickable selector="{{AdminTransactionsGridSection.orderTxnTableFirstRow}}" stepKey="clickOnVoidTransaction"/>
110+
<click selector="{{AdminTransactionsGridSection.orderTxnTableFirstRow}}" stepKey="clickVoidTxn"/>
111+
<waitForPageLoad stepKey="waitForTxnToLoad"/>
112+
<assertStringContainsString stepKey="assertEquals">
113+
<expectedResult type="string">{{BillingAgreement.comment}}</expectedResult>
114+
<actualResult type="variable">$grabOrderStatus</actualResult>
115+
</assertStringContainsString>
116+
<waitForText selector="{{AdminTransactionsGridSection.transactionData(AdminMenuPaypalTransaction.status)}}" userInput="{{StorefrontPaypalEnableSkipOrderReviewStepConfigData.label}}" stepKey="seeIfClosedHeaderIsSetAsYesForVoid"/>
117+
<waitForElementClickable selector="{{AdminProductFormActionSection.backButton}}" stepKey="waitForBackButtonToBeClicked"/>
118+
<click selector="{{AdminProductFormActionSection.backButton}}" stepKey="clickBackButton"/>
119+
<actionGroup ref="AdminViewAuthorizationTransactionsInOrderActionGroup" stepKey="validateAuthTransaction"/>
120+
<waitForText selector="{{AdminTransactionsGridSection.transactionData(AdminMenuPaypalTransaction.status)}}" userInput="{{StorefrontPaypalEnableSkipOrderReviewStepConfigData.label}}" stepKey="seeIfClosedHeaderIsSetAsYesForAuthorization"/>
121+
</test>
122+
</tests>
123+
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -11,5 +11,6 @@
1111
<section name="AdminOrderNotesSection">
1212
<element name="customerNotifiedStatusOfOrderNoteByText" type="text" selector="//div[@class='note-list-comment' and contains(text(),'{{text}}')]//preceding-sibling::span[@class='note-list-customer']/span" parameterized="true"/>
1313
<element name="voidAuthorizationNotes" type="text" selector=".//*[@class='note-list-comment'and contains(text(),'{{transactionID}}')]" parameterized="true"/>
14+
<element name="voidAuthorizationId" type="text" selector=".//*[@class='note-list-comment']//a[text()='{{transactionID}}']" parameterized="true"/>
1415
</section>
1516
</sections>

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -18,5 +18,6 @@
1818
<element name="transactionData" type="text" selector="//th[text()='{{transactionData}}']/following-sibling::td" parameterized="true"/>
1919
<element name="transitionStatus" type="text" selector="//div[@class='admin__data-grid-wrap admin__data-grid-wrap-static']" />
2020
<element name="transitionsStatus" type="text" selector="//tr[@data-role='row']//td[@data-column='{{transactionStatus}}']" parameterized="true" />
21+
<element name="voidTransactionData" type="text" selector="//*[text()='{{transactionData}}']" parameterized="true"/>
2122
</section>
2223
</sections>

0 commit comments

Comments
 (0)