|
| 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 | + |
0 commit comments