|
| 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 | + |
| 9 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 10 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 11 | + <test name="AdminCreatePartialRefundOrderPaidThroughPayPalSmartButtonTest"> |
| 12 | + <annotations> |
| 13 | + <features value="PayPal"/> |
| 14 | + <stories value="Admin Create Partial Refund"/> |
| 15 | + <title value="Create partial Refund for Order Paid with PayPal Smart Button"/> |
| 16 | + <description value="Generate a partial refund for an order and verifying the transaction status after submit the credit memos."/> |
| 17 | + <severity value="MAJOR"/> |
| 18 | + <testCaseId value="AC-5181"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/> |
| 22 | + <!-- Create Category and Product --> |
| 23 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 24 | + <createData entity="_defaultProduct" stepKey="createProduct"> |
| 25 | + <field key="price">10</field> |
| 26 | + <requiredEntity createDataKey="createCategory"/> |
| 27 | + </createData> |
| 28 | + <!-- Admin Login --> |
| 29 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 30 | + <!-- Enabling PayPal Express Checkout --> |
| 31 | + <actionGroup ref="AdminPayPalExpressCheckoutEnableActionGroup" stepKey="configPayPalExpress"> |
| 32 | + <argument name="credentials" value="SamplePaypalExpressConfig2"/> |
| 33 | + </actionGroup> |
| 34 | + <!-- Changing PayPal Express Checkout Basic Settings --> |
| 35 | + <actionGroup ref="AdminPayPalExpressCheckoutBasicSettingsActionGroup" stepKey="configBasicSettingPayPalExpress"/> |
| 36 | + <actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches"> |
| 37 | + <argument name="tags" value="config full_page"/> |
| 38 | + </actionGroup> |
| 39 | + <actionGroup ref="CliIndexerReindexActionGroup" stepKey="runIndexCronJob"> |
| 40 | + <argument name="indices" value="cataloginventory_stock"/> |
| 41 | + </actionGroup> |
| 42 | + <!-- Open Product Page to add product in the cart --> |
| 43 | + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="amOnProductPage"> |
| 44 | + <argument name="product" value="$createProduct$"/> |
| 45 | + </actionGroup> |
| 46 | + <scrollTo selector="{{StorefrontProductActionSection.quantity}}" stepKey="scrollToQuantityField"/> |
| 47 | + <actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart"> |
| 48 | + <argument name="productName" value="$$createProduct.name$$"/> |
| 49 | + <argument name="productQty" value="2"/> |
| 50 | + </actionGroup> |
| 51 | + <!-- Go to Checkout --> |
| 52 | + <actionGroup ref="OpenStoreFrontCheckoutShippingPageActionGroup" stepKey="goToShippingPage"/> |
| 53 | + <!-- Filling shipping information and click next --> |
| 54 | + <actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShipping"> |
| 55 | + <argument name="shippingMethod" value="Flat Rate"/> |
| 56 | + <argument name="customerVar" value="Simple_US_Customer_CA"/> |
| 57 | + <argument name="customerAddressVar" value="US_Address_California"/> |
| 58 | + </actionGroup> |
| 59 | + <!-- Click on PayPal payment radio button --> |
| 60 | + <waitForElementClickable selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="waitForPayPalRadioButton"/> |
| 61 | + <click selector="{{CheckoutPaymentSection.PayPalPaymentRadio}}" stepKey="selectPaypalPayment"/> |
| 62 | + <actionGroup ref="SwitchToPayPalGroupBtnActionGroup" stepKey="clickPayPalBtn"/> |
| 63 | + <!-- Login to PayPal in-context and verify order total on PayPal page--> |
| 64 | + <actionGroup ref="StorefrontLoginToPayPalPaymentAccountTwoStepActionGroup" stepKey="loginToPayPal"/> |
| 65 | + <!-- Click PayPal button and go back to Magento site --> |
| 66 | + <actionGroup ref="StorefrontPaypalSwitchBackToMagentoFromCheckoutPageActionGroup" stepKey="confirmPaymentAndGoBackToMagento"/> |
| 67 | + <!-- I see order successful Page --> |
| 68 | + <waitForElementVisible selector="{{CheckoutSuccessMainSection.successTitle}}" stepKey="waitForLoadSuccessPageTitle"/> |
| 69 | + <waitForElementVisible selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="waitForOrderNumberVisible"/> |
| 70 | + </before> |
| 71 | + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> |
| 72 | + <assertNotEmpty stepKey="assertOrderIdIsNotEmpty"> |
| 73 | + <actualResult type="const">$grabOrderNumber</actualResult> |
| 74 | + </assertNotEmpty> |
| 75 | + <!-- Go to Admin and check order information --> |
| 76 | + <actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGrid"> |
| 77 | + <argument name="orderId" value="{$grabOrderNumber}"/> |
| 78 | + </actionGroup> |
| 79 | + <waitForLoadingMaskToDisappear stepKey="waitForSearchingOrder"/> |
| 80 | + <actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/> |
| 81 | + <!-- Filter invoice in invoices grid based on the order id --> |
| 82 | + <actionGroup ref="FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup" stepKey="filterInvoiceGridByOrderId"> |
| 83 | + <argument name="orderId" value="{$grabOrderNumber}"/> |
| 84 | + </actionGroup> |
| 85 | + <waitForElementVisible selector="{{AdminInvoicesGridSection.firstRow}}" stepKey="waitForInvoiceGrid"/> |
| 86 | + <click selector="{{AdminInvoicesGridSection.firstRow}}" stepKey="openInvoice"/> |
| 87 | + <waitForPageLoad stepKey="waitForInvoiceDetailsPageToLoad"/> |
| 88 | + <!-- Creating Credit Memos from the invoice view page --> |
| 89 | + <waitForElementVisible selector="{{AdminInvoiceTotalSection.creditMemosButton}}" stepKey="waitForElementToClickCreditMemos"/> |
| 90 | + <click selector="{{AdminInvoiceTotalSection.creditMemosButton}}" stepKey="clickCreditMemosButton"/> |
| 91 | + <actionGroup ref="AdminFillQtyToInvoiceOnCreateInvoicePageActionGroup" stepKey="fillQtyInCreditMemo"/> |
| 92 | + <actionGroup ref="AdminClickUpdateQtysButtonOnCreateInvoicePageActionGroup" stepKey="clickOnUpdateButtonToCreateMemo"/> |
| 93 | + <grabTextFrom selector="{{AdminInvoiceTotalSection.grandTotal}}" stepKey="grabGrandTotal"/> |
| 94 | + <assertEquals message="ExpectedPrice" stepKey="assertBundleProductPrice"> |
| 95 | + <actualResult type="variable">$grabGrandTotal</actualResult> |
| 96 | + <expectedResult type="string">$20.00</expectedResult> |
| 97 | + </assertEquals> |
| 98 | + <!-- Click on the Refund button to generate the credit memo --> |
| 99 | + <actionGroup ref="AdminClickRefundOfflineOnCreditMemoDetailPageActionGroup" stepKey="clickSubmitInvoice"/> |
| 100 | + <waitForText selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the credit memo." stepKey="seeSuccessMessage"/> |
| 101 | + <waitForText selector="{{AdminCreditMemoOrderInformationSection.orderStatus}}" userInput="Processing" stepKey="waitForTextOrderStatus"/> |
| 102 | + <grabTextFrom selector="{{AdminCreditMemosGridSection.memoId}}" stepKey="grabMemoId"/> |
| 103 | + <actionGroup ref="AdminAssertRefundInRefundsGridActionGroup" stepKey="assertRefund"> |
| 104 | + <argument name="orderId" value="{$grabOrderNumber}"/> |
| 105 | + <argument name="memoId" value="{$grabMemoId}"/> |
| 106 | + <argument name="refundStatus" value="Refunded"/> |
| 107 | + <argument name="refundedTotal" value="$20.00"/> |
| 108 | + </actionGroup> |
| 109 | + <grabTextFrom selector="{{AdminCreditMemosGridSection.grandTotal}}" stepKey="creditMemoGrandTotal"/> |
| 110 | + <assertEquals message="ComparePrice" stepKey="assertCreditMemoGrandTotal"> |
| 111 | + <actualResult type="variable">creditMemoGrandTotal</actualResult> |
| 112 | + <expectedResult type="string">$20.00</expectedResult> |
| 113 | + </assertEquals> |
| 114 | + <!-- Navigate to the Transaction tab to compare the result --> |
| 115 | + <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSalesTransactionsPage"> |
| 116 | + <argument name="menuUiId" value="{{AdminMenuSales.dataUiId}}"/> |
| 117 | + <argument name="submenuUiId" value="{{AdminMenuSalesTransactions.dataUiId}}"/> |
| 118 | + </actionGroup> |
| 119 | + <waitForElementVisible selector="{{AdminSaleTransactionGridSection.searchOrderId}}" stepKey="waitForOrderIdFieldVisible"/> |
| 120 | + <actionGroup ref="AdminSaleTransactionGridPageActionGroup" stepKey="checkCaptureTxnType"> |
| 121 | + <argument name="orderId" value="{$grabOrderNumber}"/> |
| 122 | + <argument name="txnType" value="Capture"/> |
| 123 | + <argument name="closed" value="No"/> |
| 124 | + </actionGroup> |
| 125 | + <actionGroup ref="AdminSaleTransactionGridPageActionGroup" stepKey="checkRefundTxnType"> |
| 126 | + <argument name="orderId" value="{$grabOrderNumber}"/> |
| 127 | + <argument name="txnType" value="Refund"/> |
| 128 | + <argument name="closed" value="Yes"/> |
| 129 | + </actionGroup> |
| 130 | + <after> |
| 131 | + <!-- Disable flat rate method --> |
| 132 | + <magentoCLI command="config:set {{DisableFlatRateConfigData.path}} {{DisableFlatRateConfigData.value}}" stepKey="disableFlatRate"/> |
| 133 | + <!-- delete category and product --> |
| 134 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 135 | + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> |
| 136 | + <!-- Disable PayPal Express Checkout and Basic setting change --> |
| 137 | + <actionGroup ref="AdminPayPalExpressCheckoutDisableActionGroup" stepKey="configPaypalExpressCheckoutDisable"/> |
| 138 | + <actionGroup ref="AdminPayPalExpressCheckoutBasicSettingsActionGroup" stepKey="disableBasicSettingPayPalExpress"> |
| 139 | + <argument name="paymentAction" value="Authorization"/> |
| 140 | + </actionGroup> |
| 141 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> |
| 142 | + </after> |
| 143 | + </test> |
| 144 | +</tests> |
0 commit comments