|
| 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="AdminCaptureInvoiceForPaypalBillingAgreementTest"> |
| 11 | + <annotations> |
| 12 | + <features value="PayPal"/> |
| 13 | + <stories value="Capture Order with billing agreement"/> |
| 14 | + <title value="Check Capture order placed within Billing Agreement"/> |
| 15 | + <description value="Place an order with billing agreement as payment method and Capture the Order"/> |
| 16 | + <severity value="MAJOR"/> |
| 17 | + <testCaseId value="AC-4942"/> |
| 18 | + <group value="3rd_party_integration"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <!-- Simple product is created --> |
| 22 | + <createData entity="SimpleProduct" stepKey="createProduct"/> |
| 23 | + <!-- US Customer is created --> |
| 24 | + <createData entity="Simple_US_Customer_CA" stepKey="createCustomer"/> |
| 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 | + <actionGroup ref="AdminPayPalExpressCheckoutEnableBillingAgreementActionGroup" stepKey="enableBillingAgreement"> |
| 31 | + <argument name="countryCode" value="us"/> |
| 32 | + </actionGroup> |
| 33 | + <magentoCLI command="config:set payment/paypal_express/allow_ba_signup auto" stepKey="enableAutoBilling"/> |
| 34 | + <actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches"> |
| 35 | + <argument name="tags" value="config full_page"/> |
| 36 | + </actionGroup> |
| 37 | + <actionGroup ref="CliIndexerReindexActionGroup" stepKey="runIndexCronJob"> |
| 38 | + <argument name="indices" value="cataloginventory_stock"/> |
| 39 | + </actionGroup> |
| 40 | + <!-- Login to StoreFront --> |
| 41 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="storefrontCustomerLogin"> |
| 42 | + <argument name="Customer" value="$$createCustomer$$"/> |
| 43 | + </actionGroup> |
| 44 | + <!-- Add product to cart --> |
| 45 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart"> |
| 46 | + <argument name="product" value="$$createProduct$$"/> |
| 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="us"/> |
| 67 | + </actionGroup> |
| 68 | + <magentoCLI command="config:set payment/paypal_express/allow_ba_signup never" stepKey="disableAutoBilling"/> |
| 69 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 70 | + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> |
| 71 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 72 | + </after> |
| 73 | + <!-- I see order successful Page --> |
| 74 | + <actionGroup ref="AssertStorefrontCheckoutSuccessActionGroup" stepKey="assertOrderSuccess"/> |
| 75 | + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="orderNumber"/> |
| 76 | + <waitForElementVisible selector="{{CheckoutSuccessMainSection.billingAgreement}}" stepKey="waitForBillingAgreement"/> |
| 77 | + <grabTextFrom selector="{{CheckoutSuccessMainSection.billingAgreement}}" stepKey="billingAgreement"/> |
| 78 | + <assertNotEmpty stepKey="assertOrderIdIsNotEmpty"> |
| 79 | + <actualResult type="const">$orderNumber</actualResult> |
| 80 | + </assertNotEmpty> |
| 81 | + <assertNotEmpty stepKey="assertBillingAgreementIsNotEmpty"> |
| 82 | + <actualResult type="const">$billingAgreement</actualResult> |
| 83 | + </assertNotEmpty> |
| 84 | + <!--Go to admin sales page and open the order id--> |
| 85 | + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrder"> |
| 86 | + <argument name="orderId" value="{$orderNumber}"/> |
| 87 | + </actionGroup> |
| 88 | + <!--Submit invoice--> |
| 89 | + <actionGroup ref="AdminClickInvoiceButtonOrderViewActionGroup" stepKey="clickInvoiceButton"/> |
| 90 | + <seeOptionIsSelected userInput="Capture Online" selector="{{AdminInvoiceTotalSection.amount}}" stepKey="seeOptionType"/> |
| 91 | + <!--Submit creating invoice into the order and assert the status of the order--> |
| 92 | + <actionGroup ref="SubmitInvoiceActionGroup" stepKey="submitInvoiceIntoOrder"/> |
| 93 | + <actionGroup ref="AdminOrderViewCheckStatusActionGroup" stepKey="checkOrderStatus"> |
| 94 | + <argument name="status" value="Processing"/> |
| 95 | + </actionGroup> |
| 96 | + <waitForElementVisible selector="{{AdminOrderDetailsInformationSection.paymentInformationField('Last Transaction ID')}}" stepKey="waitForLastTransactionIDFieldToBeAppearedAfterSubmittingInvoice"/> |
| 97 | + <grabTextFrom selector="{{AdminOrderDetailsInformationSection.paymentInformationField('Last Transaction ID')}}" stepKey="grabLastTransactionIDForCaptured"/> |
| 98 | + <!--Open the comment history tab and assert the comment--> |
| 99 | + <actionGroup ref="AdminOpenOrderCommentsHistoryActionGroup" stepKey="clickOnCommentsHistoryAfterSubmittingInvoice"/> |
| 100 | + <waitForText selector="{{AdminOrderCommentsTabSection.orderCommentsWithType('Captured amount')}}" userInput="Captured amount of $128.00 online. Transaction ID: "{$grabLastTransactionIDForCaptured}"" stepKey="seeOrderHistoryNotesAfterSubmittingInvoice"/> |
| 101 | + <!-- Check the last transaction of the order and validate the details for Captured and Authorization--> |
| 102 | + <actionGroup ref="AdminViewAuthorizationTransactionsInOrderActionGroup" stepKey="validateAuthTransaction"/> |
| 103 | + <waitForText selector="{{AdminTransactionsGridSection.transactionData('Is Closed')}}" userInput="Yes" stepKey="seeIfClosedHeaderIsSetAsYesForAuthorization"/> |
| 104 | + <waitForElementClickable selector="{{AdminProductFormActionSection.backButton}}" stepKey="waitForBackButtonToBeClicked"/> |
| 105 | + <click selector="{{AdminProductFormActionSection.backButton}}" stepKey="clickBackButton"/> |
| 106 | + <actionGroup ref="AdminAssertCaptureTransactionActionGroup" stepKey="validateCaptureTransaction"/> |
| 107 | + <waitForText selector="{{AdminTransactionsGridSection.transactionData('Is Closed')}}" userInput="No" stepKey="seeIfClosedHeaderIsSetAsNoForCapture"/> |
| 108 | + </test> |
| 109 | +</tests> |
| 110 | + |
0 commit comments