Skip to content

Commit 6731de8

Browse files
ACQE-5800 : Create partial Refund for Order Paid with PayPal Smart Button
1 parent 03621bb commit 6731de8

File tree

7 files changed

+227
-0
lines changed

7 files changed

+227
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminPayPalExpressCheckoutBasicSettingsActionGroup">
12+
<annotations>
13+
<description>Goes to the 'Configuration' page for 'Payment Methods' and change PayPal Express Checkout basic settings. Clicks on Save.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="countryCode" type="string" defaultValue="us"/>
17+
<argument name="paymentAction" type="string" defaultValue="Sale"/>
18+
</arguments>
19+
<waitForPageLoad stepKey="waitForPageLoad"/>
20+
<click selector="{{PayPalExpressCheckoutConfigSection.configureBtn(countryCode)}}" stepKey="clickPayPalConfigureBtn"/>
21+
<conditionalClick selector="{{PayPalExpressCheckoutConfigSection.basicPayPalSetting(countryCode)}}" dependentSelector="{{PayPalExpressCheckoutConfigSection.basicPayPalSettingOpen(countryCode)}}" visible="false" stepKey="clickBasicSettingPayPalConfigureBtn"/>
22+
<waitForElementVisible selector="{{PayPalExpressCheckoutConfigSection.paymentAction(countryCode)}}" stepKey="waitForPaymentAction"/>
23+
<selectOption selector ="{{PayPalExpressCheckoutConfigSection.paymentAction(countryCode)}}" userInput="{{paymentAction}}" stepKey="changePaymentAction"/>
24+
<click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfig"/>
25+
<waitForPageLoad stepKey="waitForPageLoadAfterSaveConfiguration"/>
26+
</actionGroup>
27+
</actionGroups>

app/code/Magento/Paypal/Test/Mftf/Section/PayPalExpressCheckoutConfigSection/PayPalExpressCheckoutConfigSection.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@
2727
<element name="advancePaypalSettings" type="button" selector="#payment_{{countryCode}}_paypal_alternative_payment_methods_express_checkout_{{countryCode}}_settings_ec_settings_ec_advanced-head" parameterized="true" />
2828
<element name="paypalBillingAgreement" type="button" selector="#payment_{{countryCode}}_paypal_alternative_payment_methods_express_checkout_{{countryCode}}_settings_ec_settings_ec_advanced_express_checkout_billing_agreement-head" parameterized="true" />
2929
<element name="billingDisable" type="input" selector="#payment_{{countryCode}}_paypal_alternative_payment_methods_express_checkout_{{countryCode}}_settings_ec_settings_ec_advanced_express_checkout_billing_agreement_active" parameterized="true" />
30+
<element name="basicPayPalSetting" type="button" selector="#payment_{{countryCode}}_paypal_alternative_payment_methods_express_checkout_{{countryCode}}_settings_ec-head" parameterized="true" />
31+
<element name="basicPayPalSettingOpen" type="button" selector="#payment_{{countryCode}}_paypal_alternative_payment_methods_express_checkout_{{countryCode}}_settings_ec-head.open" parameterized="true" />
32+
<element name="paymentAction" type="input" selector="#payment_{{countryCode}}_paypal_alternative_payment_methods_express_checkout_{{countryCode}}_settings_ec_payment_action" parameterized="true" />
3033
</section>
3134
</sections>
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
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>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminSaleTransactionGridPageActionGroup">
12+
<arguments>
13+
<argument name="orderId" type="string"/>
14+
<argument name="txnType" type="string"/>
15+
<argument name="closed" type="string"/>
16+
</arguments>
17+
<fillField userInput="{{orderId}}" selector="{{AdminSaleTransactionGridSection.searchOrderId}}" stepKey="fillOrderIdField"/>
18+
<selectOption userInput="{{txnType}}" selector="{{AdminSaleTransactionGridSection.selectTxnType}}" stepKey="selectTransactionType"/>
19+
<click selector="{{AdminSaleTransactionGridSection.searchButton}}" stepKey="clickOnSearchButtonForFilter"/>
20+
<waitForPageLoad stepKey="waitForPageLoad"/>
21+
<grabTextFrom selector="{{AdminSaleTransactionGridSection.gridTransactionFirstRowForType}}" stepKey="grabTextFromTxnTypeGrid"/>
22+
<grabTextFrom selector="{{AdminSaleTransactionGridSection.gridTransactionFirstRowForClosed}}" stepKey="grabTextFromClosedGrid"/>
23+
<assertEquals message="compareTxnType" stepKey="assertCompareTxnType">
24+
<actualResult type="variable">grabTextFromTxnTypeGrid</actualResult>
25+
<expectedResult type="string">{{txnType}}</expectedResult>
26+
</assertEquals>
27+
<assertEquals message="compareClosedType" stepKey="assertCompareClosedType">
28+
<actualResult type="variable">grabTextFromClosedGrid</actualResult>
29+
<expectedResult type="string">{{closed}}</expectedResult>
30+
</assertEquals>
31+
</actionGroup>
32+
</actionGroups>

app/code/Magento/Sales/Test/Mftf/Section/AdminCreditMemosGridSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<element name="memoId" type="text" selector="//*[@id='sales_order_view_tabs_order_creditmemos_content']//tbody/tr/td[2]/div"/>
2323
<element name="rowCreditMemos" type="text" selector="div.data-grid-cell-content"/>
2424
<element name="viewButton" type="button" selector="//div[@id='sales_order_view_tabs_order_creditmemos_content']//a[@class='action-menu-item']"/>
25+
<element name="grandTotal" type="text" selector=".admin__data-grid-wrap table>tbody>tr:nth-child(1)>td:nth-child(8)>div"/>
2526
</section>
2627
</sections>
2728

app/code/Magento/Sales/Test/Mftf/Section/AdminInvoiceTotalSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
<element name="itemTotalPrice" type="text" selector=".col-total .price"/>
1919
<element name="totalTax" type="text" selector=".summary-total .price"/>
2020
<element name="backButton" type="button" selector="#back"/>
21+
<element name="creditMemosButton" type="button" selector="#credit-memo"/>
2122
</section>
2223
</sections>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminSaleTransactionGridSection">
12+
<element name="searchOrderId" type="input" selector="#sales_transactions_grid_filter_increment_id" />
13+
<element name="selectTxnType" type="input" selector="#sales_transactions_grid_filter_txn_type"/>
14+
<element name="searchButton" type="button" selector="#sales_transactions_grid .admin__filter-actions [data-action='grid-filter-apply']"/>
15+
<element name="gridTransactionFirstRowForType" type="text" selector="#sales_transactions_grid table#sales_transactions_grid_table tbody tr:nth-child(1) td.col-txn_type"/>
16+
<element name="gridTransactionFirstRowForClosed" type="text" selector="#sales_transactions_grid table#sales_transactions_grid_table tbody tr:nth-child(1) td.col-is_closed"/>
17+
</section>
18+
</sections>
19+

0 commit comments

Comments
 (0)