Skip to content

Commit 10d5f73

Browse files
committed
#23440 add MFTF test
1 parent b88d88e commit 10d5f73

File tree

3 files changed

+201
-0
lines changed

3 files changed

+201
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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="AdminOpenAndFillCreditMemoRefundBundleWithQtyActionGroup">
12+
<annotations>
13+
<description>Clicks on the 'Credit Memos' section on the Admin Orders edit page. Fills in the provided Refund details (child item qty, Shipping Refund, Adjustment Refund, Adjustment Fee and Row number).</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="itemQtyToRefund" type="string" defaultValue="0"/>
17+
<argument name="shippingRefund" type="string" defaultValue="0"/>
18+
<argument name="adjustmentRefund" type="string" defaultValue="0"/>
19+
<argument name="adjustmentFee" type="string" defaultValue="0"/>
20+
<argument name="rowNumberItemOne" type="string" defaultValue="3"/>
21+
<argument name="rowNumberItemTwo" type="string" defaultValue="5"/>
22+
<argument name="rowNumberItemThree" type="string" defaultValue="6"/>
23+
</arguments>
24+
25+
<!-- Click 'Credit Memo' button -->
26+
<click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="clickCreateCreditMemo"/>
27+
<seeInCurrentUrl url="{{AdminCreditMemoNewPage.url}}" stepKey="seeNewCreditMemoPage"/>
28+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Memo" stepKey="seeNewMemoInPageTitle"/>
29+
30+
<!-- Fill data from dataset: refund -->
31+
<scrollTo selector="{{AdminCreditMemoItemsSection.header}}" stepKey="scrollToItemsToRefund"/>
32+
<fillField selector="{{AdminCreditMemoItemsSection.childItemQtyToRefund(rowNumberItemOne)}}" userInput="{{itemQtyToRefund}}" stepKey="fillQtyToRefundItemOne"/>
33+
<fillField selector="{{AdminCreditMemoItemsSection.childItemQtyToRefund(rowNumberItemTwo)}}" userInput="{{itemQtyToRefund}}" stepKey="fillQtyToRefundItemTwo"/>
34+
<fillField selector="{{AdminCreditMemoItemsSection.childItemQtyToRefund(rowNumberItemThree)}}" userInput="{{itemQtyToRefund}}" stepKey="fillQtyToRefundItemThree"/>
35+
<waitForLoadingMaskToDisappear stepKey="waitForActivateButton"/>
36+
<conditionalClick selector="{{AdminCreditMemoItemsSection.updateQty}}" dependentSelector="{{AdminCreditMemoItemsSection.disabledUpdateQty}}" visible="false" stepKey="clickUpdateButton"/>
37+
<waitForLoadingMaskToDisappear stepKey="waitForUpdate"/>
38+
<fillField userInput="{{shippingRefund}}" selector="{{AdminCreditMemoTotalSection.refundShipping}}" stepKey="fillShipping"/>
39+
<fillField userInput="{{adjustmentRefund}}" selector="{{AdminCreditMemoTotalSection.adjustmentRefund}}" stepKey="fillAdjustmentRefund"/>
40+
<fillField userInput="{{adjustmentFee}}" selector="{{AdminCreditMemoTotalSection.adjustmentFee}}" stepKey="fillAdjustmentFee"/>
41+
<waitForElementVisible selector="{{AdminCreditMemoTotalSection.updateTotals}}" stepKey="waitForUpdateTotalsButton"/>
42+
<click selector="{{AdminCreditMemoTotalSection.updateTotals}}" stepKey="clickUpdateTotals"/>
43+
<checkOption selector="{{AdminCreditMemoTotalSection.emailCopy}}" stepKey="checkSendEmailCopy"/>
44+
</actionGroup>
45+
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
<element name="disabledUpdateQty" type="button" selector=".order-creditmemo-tables tfoot button[data-ui-id='order-items-update-button'].disabled" timeout="30"/>
2525
<element name="nameColumn" type="text" selector=".order-creditmemo-tables .product-title"/>
2626
<element name="skuColumn" type="text" selector=".order-creditmemo-tables .product-sku-block"/>
27+
<element name="childItemQtyToRefund" type="input" selector=".order-creditmemo-tables tr:nth-child({{row}}) td .qty-input" parameterized="true"/>
2728
</section>
2829
</sections>
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
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="AdminCreateCreditmemoWithBundleProductTest">
12+
<annotations>
13+
<title value="Create Creditmemo in Admin with bundle product"/>
14+
<stories value="Github issue: #23440 fix Refund for bundle product without receiving product back"/>
15+
<description value="Create Creditmemo for bundle product with without receiving product back(all child item qty = 0)"/>
16+
<features value="Sales"/>
17+
<severity value="AVERAGE"/>
18+
<group value="Sales"/>
19+
</annotations>
20+
21+
<before>
22+
<!--Set default flat rate shipping method settings-->
23+
<createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/>
24+
25+
<!--Create simple customer-->
26+
<createData entity="Simple_US_Customer_CA" stepKey="simpleCustomer"/>
27+
28+
<!--Create simple product 1-->
29+
<createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/>
30+
31+
<!--Create simple product 2-->
32+
<createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/>
33+
34+
<!--Create bundle product with checkbox bundle option-->
35+
<createData entity="ApiBundleProduct" stepKey="product"/>
36+
<createData entity="CheckboxOption" stepKey="checkboxBundleOption">
37+
<requiredEntity createDataKey="product"/>
38+
</createData>
39+
40+
<!--Link simple product 1 to bundle option with default quantity 2-->
41+
<createData entity="ApiBundleLink" stepKey="createBundleLink1">
42+
<requiredEntity createDataKey="product"/>
43+
<requiredEntity createDataKey="checkboxBundleOption"/>
44+
<requiredEntity createDataKey="simple1"/>
45+
<field key="qty">2</field>
46+
<field key="is_default">1</field>
47+
</createData>
48+
49+
<!--Link simple product 2 to bundle option with default quantity 2-->
50+
<createData entity="ApiBundleLink" stepKey="createBundleLink2">
51+
<requiredEntity createDataKey="product"/>
52+
<requiredEntity createDataKey="checkboxBundleOption"/>
53+
<requiredEntity createDataKey="simple2"/>
54+
<field key="qty">2</field>
55+
<field key="is_default">1</field>
56+
</createData>
57+
58+
<!--Add drop-down bundle option-->
59+
<createData entity="DropDownBundleOption" stepKey="dropDownBundleOption">
60+
<requiredEntity createDataKey="product"/>
61+
</createData>
62+
63+
<!--Link simple product 1 to drop-down bundle option with default quantity 2-->
64+
<createData entity="ApiBundleLink" stepKey="createBundleLink3">
65+
<requiredEntity createDataKey="product"/>
66+
<requiredEntity createDataKey="dropDownBundleOption"/>
67+
<requiredEntity createDataKey="simple1"/>
68+
<field key="qty">2</field>
69+
<field key="is_default">1</field>
70+
</createData>
71+
72+
<!--Link simple product 2 to drop-down bundle option with default quantity 2-->
73+
<createData entity="ApiBundleLink" stepKey="createBundleLink4">
74+
<requiredEntity createDataKey="product"/>
75+
<requiredEntity createDataKey="dropDownBundleOption"/>
76+
<requiredEntity createDataKey="simple2"/>
77+
<field key="qty">2</field>
78+
</createData>
79+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
80+
</before>
81+
82+
<!--Create new customer order-->
83+
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer">
84+
<argument name="customer" value="$$simpleCustomer$$"/>
85+
</actionGroup>
86+
87+
<!--Add bundle product to order and check product price in grid-->
88+
<actionGroup ref="addBundleProductToOrderAndCheckPriceInGrid" stepKey="addBundleProductToOrder">
89+
<argument name="product" value="$$product$$"/>
90+
<argument name="quantity" value="1"/>
91+
<argument name="price" value="$738.00"/>
92+
</actionGroup>
93+
94+
<!--Select FlatRate shipping method-->
95+
<actionGroup ref="orderSelectFlatRateShipping" stepKey="orderSelectFlatRateShippingMethod"/>
96+
97+
<!--Submit order-->
98+
<click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/>
99+
100+
<!--Verify order information-->
101+
<actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/>
102+
103+
104+
<!-- Create Invoice -->
105+
<actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startInvoice"/>
106+
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>
107+
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/>
108+
<see selector="{{AdminMessagesSection.success}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/>
109+
110+
<!-- Go to Sales > Orders > find out placed order and open -->
111+
<grabTextFrom selector="|Order # (\d+)|" stepKey="grabOrderId" />
112+
<assertNotEmpty actual="$grabOrderId" stepKey="assertOrderIdIsNotEmpty" after="grabOrderId"/>
113+
<actionGroup ref="OpenOrderById" stepKey="openOrder">
114+
<argument name="orderId" value="{$grabOrderId}"/>
115+
</actionGroup>
116+
117+
<!-- Click 'Credit Memo' button and fill data from dataset: partial refund -->
118+
<actionGroup ref="AdminOpenAndFillCreditMemoRefundBundleWithQtyActionGroup" stepKey="fillCreditMemoRefund">
119+
<argument name="itemQtyToRefund" value="0"/>
120+
<argument name="rowNumberItemOne" value="3"/>
121+
<argument name="rowNumberItemTwo" value="5"/>
122+
<argument name="rowNumberItemThree" value="6"/>
123+
<argument name="adjustmentRefund" value="10"/>
124+
</actionGroup>
125+
126+
<!-- On order's page click 'Refund offline' button -->
127+
<click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickRefundOffline"/>
128+
<waitForPageLoad stepKey="waitForResultPage"/>
129+
130+
<!-- Perform all assertions: assert refund success create message -->
131+
<see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You created the credit memo." stepKey="assertRefundSuccessCreateMessage"/>
132+
133+
<!--Assert refund in Credit Memo Tab -->
134+
<click selector="{{AdminOrderDetailsOrderViewSection.creditMemos}}" stepKey="clickCreditMemoTab"/>
135+
<waitForPageLoad stepKey="waitForTabLoad"/>
136+
<grabTextFrom selector="{{AdminCreditMemosGridSection.memoId}}" stepKey="grabMemoId"/>
137+
<assertNotEmpty actual="$grabMemoId" stepKey="assertMemoIdIsNotEmpty" after="grabMemoId"/>
138+
<click selector="{{AdminCreditMemosGridSection.memoId}}" stepKey="clickView"/>
139+
<waitForPageLoad stepKey="waitForCreditMemo"/>
140+
<scrollTo selector="{{AdminCreditMemoViewTotalSection.subtotal}}" stepKey="scrollToTotal"/>
141+
<see selector="{{AdminCreditMemoViewTotalSection.subtotal}}" userInput="$0.00" stepKey="seeSubtotal"/>
142+
<see selector="{{AdminCreditMemoViewTotalSection.adjustmentRefund}}" userInput="$10.00" stepKey="seeAdjustmentRefund"/>
143+
<see selector="{{AdminCreditMemoViewTotalSection.adjustmentFee}}" userInput="$0.00" stepKey="seeAdjustmentFee"/>
144+
<see selector="{{AdminCreditMemoViewTotalSection.grandTotal}}" userInput="$10.00" stepKey="assertRefundOnCreditMemoTab"/>
145+
146+
<after>
147+
<actionGroup ref="logout" stepKey="logout"/>
148+
149+
<deleteData createDataKey="product" stepKey="delete"/>
150+
<deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/>
151+
<deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/>
152+
<deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/>
153+
</after>
154+
</test>
155+
</tests>

0 commit comments

Comments
 (0)