|
| 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