Skip to content

Commit e1f6ad1

Browse files
committed
ACQE-8554: Create partial capture for order paid with PayPal Payments Advanced
- Created test file
1 parent 3026734 commit e1f6ad1

File tree

1 file changed

+196
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)