|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | + /** |
| 4 | + * Copyright 2025 Adobe |
| 5 | + * All Rights Reserved. |
| 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="AdminCreatePartialCaptureForOrderPaidWithPayPalPaymentsAdvancedTest"> |
| 11 | + <annotations> |
| 12 | + <features value="PayPal"/> |
| 13 | + <stories value="PayPal Payments Advanced"/> |
| 14 | + <title value="Create partial capture for order paid with PayPal Payments Advanced"/> |
| 15 | + <description value="Admin creates partial capture for order paid with PayPal Payments Advanced and verifies refund transaction"/> |
| 16 | + <severity value="MAJOR"/> |
| 17 | + <testCaseId value="AC-5129"/> |
| 18 | + <group value="paypalPaymentsAdvanced"/> |
| 19 | + <group value="3rd_party_integration"/> |
| 20 | + <group value="pr_exclude"/> |
| 21 | + </annotations> |
| 22 | + <before> |
| 23 | + <!-- Create category --> |
| 24 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 25 | + <!-- Create customer --> |
| 26 | + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> |
| 27 | + <!-- Create configurable product attribute --> |
| 28 | + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> |
| 29 | + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> |
| 30 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 31 | + </createData> |
| 32 | + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> |
| 33 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 34 | + </createData> |
| 35 | + <!-- Add attribute to default attribute set --> |
| 36 | + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> |
| 37 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 38 | + </createData> |
| 39 | + <!-- Get attribute options --> |
| 40 | + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> |
| 41 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 42 | + </getData> |
| 43 | + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> |
| 44 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 45 | + </getData> |
| 46 | + <!-- Create configurable product --> |
| 47 | + <createData entity="BaseConfigurableProduct" stepKey="createConfigProduct"> |
| 48 | + <requiredEntity createDataKey="createCategory"/> |
| 49 | + <field key="price">134.07</field> |
| 50 | + </createData> |
| 51 | + <!-- Create child products --> |
| 52 | + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> |
| 53 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 54 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 55 | + <field key="price">134.07</field> |
| 56 | + </createData> |
| 57 | + <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2"> |
| 58 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 59 | + <requiredEntity createDataKey="getConfigAttributeOption2"/> |
| 60 | + <field key="price">134.07</field> |
| 61 | + </createData> |
| 62 | + <!-- Create configurable product options --> |
| 63 | + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> |
| 64 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 65 | + <requiredEntity createDataKey="createConfigProductAttribute"/> |
| 66 | + <requiredEntity createDataKey="getConfigAttributeOption1"/> |
| 67 | + <requiredEntity createDataKey="getConfigAttributeOption2"/> |
| 68 | + </createData> |
| 69 | + <!-- Add child products to configurable product --> |
| 70 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> |
| 71 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 72 | + <requiredEntity createDataKey="createConfigChildProduct1"/> |
| 73 | + </createData> |
| 74 | + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> |
| 75 | + <requiredEntity createDataKey="createConfigProduct"/> |
| 76 | + <requiredEntity createDataKey="createConfigChildProduct2"/> |
| 77 | + </createData> |
| 78 | + <!-- Login to admin --> |
| 79 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 80 | + <!-- Configure PayPal Payments Advanced --> |
| 81 | + <actionGroup ref="AdminConfigPaymentsAdvancedActionGroup" stepKey="configurePayPalPaymentsAdvanced"> |
| 82 | + <argument name="credentials" value="SamplePaypalPaymentsAdvancedConfig"/> |
| 83 | + </actionGroup> |
| 84 | + <!--Save Configuration--> |
| 85 | + <actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfigs"/> |
| 86 | + <!-- clean cache --> |
| 87 | + <actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache"> |
| 88 | + <argument name="tags" value="config full_page"/> |
| 89 | + </actionGroup> |
| 90 | + <!-- Login to storefront --> |
| 91 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin"> |
| 92 | + <argument name="Customer" value="$createCustomer$"/> |
| 93 | + </actionGroup> |
| 94 | + <!-- Navigate to configurable product page --> |
| 95 | + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToProductOnStorefront"> |
| 96 | + <argument name="product" value="$$createConfigProduct$$"/> |
| 97 | + </actionGroup> |
| 98 | + <!-- Select configurable product option --> |
| 99 | + <selectOption selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="selectOption1"/> |
| 100 | + <!-- Add product to cart with qty 1 --> |
| 101 | + <fillField userInput="1" selector="{{StorefrontProductPageSection.qtyInput}}" stepKey="fillProductQty"/> |
| 102 | + <actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCartFromStorefrontProductPage"> |
| 103 | + <argument name="productName" value="$createConfigProduct.name$"/> |
| 104 | + </actionGroup> |
| 105 | + <!-- Go to checkout --> |
| 106 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToCheckoutCartPage"/> |
| 107 | + <actionGroup ref="StorefrontClickProceedToCheckoutActionGroup" stepKey="clickProceedToCheckout"/> |
| 108 | + <actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickOnNextButton"/> |
| 109 | + <!-- Select PayPal Payments Advanced payment method --> |
| 110 | + <waitForElementClickable selector="{{AdminConfigurepaymentsAdvancedSection.payflowEdition}}" stepKey="waitForPayPalRadioButton"/> |
| 111 | + <click selector="{{AdminConfigurepaymentsAdvancedSection.payflowEdition}}" stepKey="selectPaypalPayment"/> |
| 112 | + <waitForElementClickable selector="{{CheckoutPaymentSection.ContinuePayPalBtn}}" stepKey="waitForPayPalBtn"/> |
| 113 | + <click selector="{{CheckoutPaymentSection.ContinuePayPalBtn}}" stepKey="clickPayPalBtn"/> |
| 114 | + <actionGroup ref="StorefrontLoginToPayPalExpressCheckoutPayFlowEditionActionGroup" stepKey="loginToPayPal"/> |
| 115 | + <!-- Submit payment on PayPal site --> |
| 116 | + <actionGroup ref="StorefrontPaypalSwitchBackToMagentoFromCheckoutPageActionGroup" stepKey="submitAdvancedPayment"/> |
| 117 | + <!-- Assert Order success --> |
| 118 | + <actionGroup ref="AssertStorefrontCheckoutSuccessActionGroup" stepKey="assertCheckoutSuccessPayPalAdvanced"/> |
| 119 | + </before> |
| 120 | + <after> |
| 121 | + <magentoCLI command="config:set {{DisablePaymentAdvancedSolution.path}} {{DisablePaymentAdvancedSolution.value}}" stepKey="disablePaymentAdvanced"/> |
| 122 | + <!-- Cleanup --> |
| 123 | + <actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="navigateToSalesOrderPage"/> |
| 124 | + <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> |
| 125 | + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> |
| 126 | + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> |
| 127 | + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> |
| 128 | + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> |
| 129 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 130 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 131 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 132 | + </after> |
| 133 | + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/> |
| 134 | + <!-- Step 1,2: Go to Sales > Orders and open Order from Preconditions --> |
| 135 | + <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrder"> |
| 136 | + <argument name="orderId" value="{$grabOrderNumber}"/> |
| 137 | + </actionGroup> |
| 138 | + <!-- Step 3: Go to Invoices tab and open created invoice --> |
| 139 | + <actionGroup ref="GoToInvoiceIntoOrderActionGroup" stepKey="goToInvoiceIntoOrderPage"/> |
| 140 | + <actionGroup ref="SubmitInvoiceActionGroup" stepKey="submitInvoiceIntoOrder"/> |
| 141 | + <actionGroup ref="AdminOpenInvoiceTabFromOrderPageActionGroup" stepKey="openInvoiceTab"/> |
| 142 | + <waitForElementClickable selector="{{AdminOrderInvoicesTabSection.viewInvoice}}" stepKey="waitForInvoicesTabOpened"/> |
| 143 | + <click selector="{{AdminOrderInvoicesTabSection.viewInvoice}}" stepKey="clickViewInvoice"/> |
| 144 | + <waitForPageLoad stepKey="waitForInvoicePageToBeLoaded"/> |
| 145 | + <!-- Step 4: Click Credit Memo button --> |
| 146 | + <actionGroup ref="AdminStartToCreateCreditMemoFromInvoicePageActionGroup" stepKey="clickOnCreditMemoFromInvoiceTab"/> |
| 147 | + <!-- Step 5: Reduce the qty to invoice of configurable product 1 from 1 to 0 and click Update Qty's button --> |
| 148 | + <waitForElementVisible selector="{{AdminCreditMemoItemsSection.itemQtyToRefund('1')}}" stepKey="waitToItemToRefundTextField"/> |
| 149 | + <fillField selector="{{AdminCreditMemoItemsSection.itemQtyToRefund('1')}}" userInput="0" stepKey="reduceRefundQuantity"/> |
| 150 | + <waitForElementClickable selector="{{AdminCreditMemoItemsSection.updateQty}}" stepKey="waitToClickUpdateQuantity"/> |
| 151 | + <click selector="{{AdminCreditMemoItemsSection.updateQty}}" stepKey="updateQuantityToRefund"/> |
| 152 | + <waitForPageLoad stepKey="waitForQuantityApplied"/> |
| 153 | + <!-- Step 6: Click Refund button --> |
| 154 | + <actionGroup ref="SubmitCreditMemoActionGroup" stepKey="submitCreditMemo"> |
| 155 | + <argument name="refundButton" value="{{AdminInvoiceMainActionsSection.submitNewRefundFromInvoice}}"/> |
| 156 | + </actionGroup> |
| 157 | + <!-- Verify "You created the credit memo" message is displayed --> |
| 158 | + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/> |
| 159 | + <waitForText selector="{{AdminMessagesSection.success}}" userInput="You created the credit memo" stepKey="seeSuccessMessage"/> |
| 160 | + <!-- Verify Order status = Processing --> |
| 161 | + <waitForText selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Processing" stepKey="seeOrderStatus"/> |
| 162 | + <!-- Grab transaction ID for refund and verify refund message in comments history tab --> |
| 163 | + <waitForElementVisible selector="{{AdminOrderPaymentInformationSection.paymentInformationField('Last Transaction ID')}}" stepKey="waitForTransactionID"/> |
| 164 | + <grabTextFrom selector="{{AdminOrderPaymentInformationSection.paymentInformationField('Last Transaction ID')}}" stepKey="grabTransactionID"/> |
| 165 | + <actionGroup ref="AdminOpenOrderCommentsHistoryActionGroup" stepKey="clickOnCommentsHistory"/> |
| 166 | + <waitForText selector="{{AdminOrderCommentsTabSection.orderCommentsWithType('refunded')}}" userInput="We refunded $5.00 online. Transaction ID: "{$grabTransactionID}"" stepKey="seeOrderHistoryNotesForRefund"/> |
| 167 | + <!-- Step 7: Go to Credit Memos tab --> |
| 168 | + <waitForElementClickable selector="{{AdminOrderDetailsOrderViewSection.creditMemos}}" stepKey="waitToClickCreditMemoTab"/> |
| 169 | + <click selector="{{AdminOrderDetailsOrderViewSection.creditMemos}}" stepKey="clickCreditMemoTab"/> |
| 170 | + <actionGroup ref="AdminOpenCreditMemoFromOrderPageActionGroup" stepKey="clickOnCreditMemosTab"/> |
| 171 | + <!-- Verify Credit Memo is present in grid and Grand Total = $5.00 --> |
| 172 | + <actionGroup ref="AssertAdminCreditMemoGrandTotalActionGroup" stepKey="assertGrandTotal"> |
| 173 | + <argument name="expectedGrandTotal" value="$5.00"/> |
| 174 | + </actionGroup> |
| 175 | + <waitForElementClickable selector="{{AdminProductFormActionSection.backButton}}" stepKey="waitToClickBackButtonFromCreditMemo"/> |
| 176 | + <click selector="{{AdminProductFormActionSection.backButton}}" stepKey="clickBackButtonFromCreditMemo"/> |
| 177 | + <!-- Step 8: Go to Transactions tab --> |
| 178 | + <!-- Verify Authorization transaction is present, Closed = Yes --> |
| 179 | + <actionGroup ref="AdminAssertTransactionTypeInTransactionTabActionGroup" stepKey="assertAuthorizationTransactionType"> |
| 180 | + <argument name="transactionType" value="authorization"/> |
| 181 | + </actionGroup> |
| 182 | + <waitForText selector="{{AdminTransactionsGridSection.transactionData('Is Closed')}}" userInput="Yes" stepKey="seeIfClosedHeaderIsSetAsYesForAuthorization"/> |
| 183 | + <waitForElementClickable selector="{{AdminProductFormActionSection.backButton}}" stepKey="waitForBackButtonToBeClickedFromAuthorization"/> |
| 184 | + <click selector="{{AdminProductFormActionSection.backButton}}" stepKey="clickBackButtonFromAuthorization"/> |
| 185 | + <!-- Verify Capture transaction is present, Closed = No --> |
| 186 | + <actionGroup ref="AdminAssertTransactionTypeInTransactionTabActionGroup" stepKey="assertCaptureTransactionType"> |
| 187 | + <argument name="transactionType" value="capture"/> |
| 188 | + </actionGroup> |
| 189 | + <waitForText selector="{{AdminTransactionsGridSection.transactionData('Is Closed')}}" userInput="No" stepKey="seeIfClosedHeaderIsSetAsNoForCapture"/> |
| 190 | + <waitForElementClickable selector="{{AdminProductFormActionSection.backButton}}" stepKey="waitForBackButtonToBeClickedFromCapture"/> |
| 191 | + <click selector="{{AdminProductFormActionSection.backButton}}" stepKey="clickBackButtonFromCapture"/> |
| 192 | + <!-- Verify Refund transaction is present, Closed = Yes --> |
| 193 | + <actionGroup ref="AdminAssertTransactionTypeInTransactionTabActionGroup" stepKey="assertRefundTransactionType"> |
| 194 | + <argument name="transactionType" value="refund"/> |
| 195 | + </actionGroup> |
| 196 | + <waitForText selector="{{AdminTransactionsGridSection.transactionData('Is Closed')}}" userInput="Yes" stepKey="seeIfClosedHeaderIsSetAsYesForRefund"/> |
| 197 | + </test> |
| 198 | +</tests> |
0 commit comments