Skip to content

Commit d3d0b54

Browse files
committed
MC-4756: Convert CreateCreditMemoEntityTest to MFTF
1 parent 48c1b50 commit d3d0b54

7 files changed

+146
-148
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11-
<actionGroup name="AdminAssertProductQtyChangedAfterCreditMemoActionGroup">
11+
<actionGroup name="AdminAssertProductQtyInGridActionGroup">
1212
<arguments>
13-
<argument name="product" type="entity"/>
14-
<argument name="changedQty" type="string"/>
13+
<argument name="productSku" type="string"/>
14+
<argument name="expectedQty" type="string"/>
1515
</arguments>
1616
<!-- Assert product Qty decreased after CreditMemo -->
1717
<amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="onProductPage"/>
1818
<waitForPageLoad stepKey="waitForProductPage"/>
1919
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/>
2020
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openOrderGridFilters"/>
2121
<waitForPageLoad stepKey="waitForFilter"/>
22-
<fillField userInput="{{product.sku}}" selector="{{AdminProductGridFilterSection.skuFilter}}" stepKey="fillOrderIdFilter"/>
22+
<fillField userInput="{{productSku}}" selector="{{AdminProductGridFilterSection.skuFilter}}" stepKey="fillOrderIdFilter"/>
2323
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickOrderApplyFilters"/>
24-
<see userInput="{{changedQty}}" stepKey="assertQtyDecreased"/>
24+
<see userInput="{{expectedQty}}" stepKey="assertQtyDecreased"/>
2525
</actionGroup>
2626
</actionGroups>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminCreditMemoViewItemsSection">
1212
<element name="blockItemsRefunded" type="block" selector="#creditmemo_items_container"/>
13-
<element name="productName" type="text" selector="td.col-product>div.product-title"/>
14-
<element name="productPrice" type="text" selector=".col-price>.price-excl-tax>.price"/>
13+
<element name="productName" type="text" selector="td.col-product > div.product-title"/>
14+
<element name="productPrice" type="text" selector=".col-price > .price-excl-tax > .price"/>
1515
<element name="productQty" type="text" selector="td.col-qty"/>
1616
</section>
1717
</sections>

app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,41 +32,40 @@
3232
<magentoCLI command="config:set {{enabledCheckMoneyOrder.label}} {{enabledCheckMoneyOrder.value}}" stepKey="enableCheckMoneyOrder"/>
3333
<magentoCLI command="config:set {{enabledBankTransferPaymentOrder.label}} {{enabledBankTransferPaymentOrder.value}}" stepKey="enableBankTransfer"/>
3434
<createData entity="FlatRateShippingMethodConfig" stepKey="enableFlatRate"/>
35-
36-
<!-- Create Order -->
37-
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage">
38-
<argument name="customer" value="$createCustomer$"/>
39-
</actionGroup>
40-
<actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProduct">
41-
<argument name="product" value="$createProduct$"/>
42-
</actionGroup>
43-
<actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerInfo">
44-
<argument name="customer" value="$createCustomer$"/>
45-
<argument name="address" value="US_Address_TX"/>
46-
</actionGroup>
47-
<actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRate"/>
48-
<conditionalClick selector="{{AdminOrderFormPaymentSection.linkPaymentOptions}}" dependentSelector="{{AdminOrderFormPaymentSection.linkPaymentOptions}}" visible="true" stepKey="openMoneyOption"/>
49-
<waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/>
50-
<checkOption selector="{{AdminOrderFormPaymentSection.checkBankTransfer}}" stepKey="checkBankTransfer"/>
51-
<waitForLoadingMaskToDisappear stepKey="waitForDisappear"/>
52-
<click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/>
53-
<waitForPageLoad stepKey="waitForSubmitOrderPage"/>
54-
<see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/>
55-
56-
<!-- Create Invoice -->
57-
<actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startInvoice"/>
58-
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>
59-
<waitForElementVisible selector="{{AdminMessagesSection.successMessage}}" stepKey="waitForMessageAppears"/>
60-
<see selector="{{AdminMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/>
6135
</before>
6236
<after>
37+
<magentoCLI command="config:set {{disabledBankTransferPaymentOrder.label}} {{disabledBankTransferPaymentOrder.value}}" stepKey="disableBankTransfer"/>
6338
<!-- Delete data -->
6439
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
6540
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
6641
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
67-
<magentoCLI command="config:set {{disabledBankTransferPaymentOrder.label}} {{disabledBankTransferPaymentOrder.value}}" stepKey="disableBankTransfer"/>
6842
<actionGroup ref="logout" stepKey="logout"/>
6943
</after>
44+
<!-- Create Order -->
45+
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage">
46+
<argument name="customer" value="$createCustomer$"/>
47+
</actionGroup>
48+
<actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProduct">
49+
<argument name="product" value="$createProduct$"/>
50+
</actionGroup>
51+
<actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerInfo">
52+
<argument name="customer" value="$createCustomer$"/>
53+
<argument name="address" value="US_Address_TX"/>
54+
</actionGroup>
55+
<actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRate"/>
56+
<conditionalClick selector="{{AdminOrderFormPaymentSection.linkPaymentOptions}}" dependentSelector="{{AdminOrderFormPaymentSection.linkPaymentOptions}}" visible="true" stepKey="openMoneyOption"/>
57+
<waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/>
58+
<checkOption selector="{{AdminOrderFormPaymentSection.checkBankTransfer}}" stepKey="checkBankTransfer"/>
59+
<waitForLoadingMaskToDisappear stepKey="waitForDisappear"/>
60+
<click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/>
61+
<waitForPageLoad stepKey="waitForSubmitOrderPage"/>
62+
<see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/>
63+
64+
<!-- Create Invoice -->
65+
<actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startInvoice"/>
66+
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>
67+
<waitForElementVisible selector="{{AdminMessagesSection.successMessage}}" stepKey="waitForMessageAppears"/>
68+
<see selector="{{AdminMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/>
7069

7170
<!-- Go to Sales > Orders > find out placed order and open -->
7271
<grabTextFrom selector="|Order # (\d+)|" stepKey="grabOrderId" />

app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -88,33 +88,6 @@
8888
<!-- Enable payment method one of "Check/Money Order" and shipping method one of "Flat Rate" -->
8989
<magentoCLI command="config:set {{enabledCheckMoneyOrder.label}} {{enabledCheckMoneyOrder.value}}" stepKey="enableCheckMoneyOrder"/>
9090
<createData entity="FlatRateShippingMethodConfig" stepKey="enableFlatRate"/>
91-
92-
<!-- Create Order -->
93-
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage">
94-
<argument name="customer" value="$createCustomer$"/>
95-
</actionGroup>
96-
97-
<!--Add configurable product to order-->
98-
<actionGroup ref="addConfigurableProductToOrderFromAdmin" stepKey="addConfigurableProductToOrder">
99-
<argument name="product" value="$$createConfigProduct$$"/>
100-
<argument name="attribute" value="$$createConfigProductAttribute$$"/>
101-
<argument name="option" value="$$getConfigAttributeOption1$$"/>
102-
</actionGroup>
103-
104-
<actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerInfo">
105-
<argument name="customer" value="$createCustomer$"/>
106-
<argument name="address" value="US_Address_TX"/>
107-
</actionGroup>
108-
<actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRate"/>
109-
<click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/>
110-
<waitForPageLoad stepKey="waitForSubmitOrderPage"/>
111-
<see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/>
112-
113-
<!-- Create Invoice -->
114-
<actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startInvoice"/>
115-
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>
116-
<waitForElementVisible selector="{{AdminMessagesSection.successMessage}}" stepKey="waitForMessageAppears"/>
117-
<see selector="{{AdminMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/>
11891
</before>
11992
<after>
12093
<!-- Delete data -->
@@ -126,6 +99,32 @@
12699
<deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/>
127100
<actionGroup ref="logout" stepKey="logout"/>
128101
</after>
102+
<!-- Create Order -->
103+
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage">
104+
<argument name="customer" value="$createCustomer$"/>
105+
</actionGroup>
106+
107+
<!--Add configurable product to order-->
108+
<actionGroup ref="addConfigurableProductToOrderFromAdmin" stepKey="addConfigurableProductToOrder">
109+
<argument name="product" value="$$createConfigProduct$$"/>
110+
<argument name="attribute" value="$$createConfigProductAttribute$$"/>
111+
<argument name="option" value="$$getConfigAttributeOption1$$"/>
112+
</actionGroup>
113+
114+
<actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerInfo">
115+
<argument name="customer" value="$createCustomer$"/>
116+
<argument name="address" value="US_Address_TX"/>
117+
</actionGroup>
118+
<actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRate"/>
119+
<click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/>
120+
<waitForPageLoad stepKey="waitForSubmitOrderPage"/>
121+
<see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/>
122+
123+
<!-- Create Invoice -->
124+
<actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startInvoice"/>
125+
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>
126+
<waitForElementVisible selector="{{AdminMessagesSection.successMessage}}" stepKey="waitForMessageAppears"/>
127+
<see selector="{{AdminMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/>
129128

130129
<!-- Go to Sales > Orders > find out placed order and open -->
131130
<grabTextFrom selector="|Order # (\d+)|" stepKey="grabOrderId" />
@@ -149,9 +148,9 @@
149148
<see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You created the credit memo." stepKey="assertRefundSuccessCreateMessage"/>
150149

151150
<!-- Assert product Qty decreased after CreditMemo -->
152-
<actionGroup ref="AdminAssertProductQtyChangedAfterCreditMemoActionGroup" stepKey="assertQtyDecreased">
153-
<argument name="product" value="$createConfigChildProduct1$"/>
154-
<argument name="changedQty" value="10.000"/>
151+
<actionGroup ref="AdminAssertProductQtyInGridActionGroup" stepKey="assertQtyDecreased">
152+
<argument name="productSku" value="$createConfigChildProduct1.sku$"/>
153+
<argument name="expectedQty" value="10.000"/>
155154
</actionGroup>
156155
</test>
157156
</tests>

app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,6 @@
3131
<!-- Enable payment method one of "Check/Money Order" and shipping method one of "Flat Rate" -->
3232
<magentoCLI command="config:set {{enabledCheckMoneyOrder.label}} {{enabledCheckMoneyOrder.value}}" stepKey="enableCheckMoneyOrder"/>
3333
<createData entity="FlatRateShippingMethodConfig" stepKey="enableFlatRate"/>
34-
35-
<!-- Create Order -->
36-
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage">
37-
<argument name="customer" value="$createCustomer$"/>
38-
</actionGroup>
39-
<actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProduct">
40-
<argument name="product" value="$createProduct$"/>
41-
<argument name="productQty" value="2"/>
42-
</actionGroup>
43-
<actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerInfo">
44-
<argument name="customer" value="$createCustomer$"/>
45-
<argument name="address" value="US_Address_TX"/>
46-
</actionGroup>
47-
<actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRate"/>
48-
<click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/>
49-
<waitForPageLoad stepKey="waitForSubmitOrderPage"/>
50-
<see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/>
51-
52-
<!-- Create Invoice -->
53-
<actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startInvoice"/>
54-
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>
55-
<waitForElementVisible selector="{{AdminMessagesSection.successMessage}}" stepKey="waitForMessageAppears"/>
56-
<see selector="{{AdminMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/>
5734
</before>
5835
<after>
5936
<!-- Delete data -->
@@ -62,6 +39,28 @@
6239
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
6340
<actionGroup ref="logout" stepKey="logout"/>
6441
</after>
42+
<!-- Create Order -->
43+
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderPage">
44+
<argument name="customer" value="$createCustomer$"/>
45+
</actionGroup>
46+
<actionGroup ref="addSimpleProductToOrder" stepKey="addSecondProduct">
47+
<argument name="product" value="$createProduct$"/>
48+
<argument name="productQty" value="2"/>
49+
</actionGroup>
50+
<actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerInfo">
51+
<argument name="customer" value="$createCustomer$"/>
52+
<argument name="address" value="US_Address_TX"/>
53+
</actionGroup>
54+
<actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRate"/>
55+
<click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/>
56+
<waitForPageLoad stepKey="waitForSubmitOrderPage"/>
57+
<see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/>
58+
59+
<!-- Create Invoice -->
60+
<actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startInvoice"/>
61+
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>
62+
<waitForElementVisible selector="{{AdminMessagesSection.successMessage}}" stepKey="waitForMessageAppears"/>
63+
<see selector="{{AdminMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/>
6564

6665
<!-- Go to Sales > Orders > find out placed order and open -->
6766
<grabTextFrom selector="|Order # (\d+)|" stepKey="grabOrderId" />
@@ -128,12 +127,13 @@
128127
<click selector="{{StorefrontCustomerOrderSection.tabRefund}}" stepKey="clickRefund"/>
129128
<waitForPageLoad stepKey="waitRefundsLoad"/>
130129
<scrollTo selector="{{StorefrontCustomerOrderSection.grandTotalRefund}}" stepKey="scrollToGrandTotal"/>
131-
<see selector="{{StorefrontCustomerOrderSection.grandTotalRefund}}" userInput="110.00" stepKey="seeGrandTotal"/>
130+
<see selector="{{AdminCreateCreditMemoStoreCreditTest.xml
131+
.grandTotalRefund}}" userInput="110.00" stepKey="seeGrandTotal"/>
132132

133133
<!-- Assert product Qty decreased after CreditMemo -->
134-
<actionGroup ref="AdminAssertProductQtyChangedAfterCreditMemoActionGroup" stepKey="assertQtyDecreased">
135-
<argument name="product" value="$createProduct$"/>
136-
<argument name="changedQty" value="776"/>
134+
<actionGroup ref="AdminAssertProductQtyInGridActionGroup" stepKey="assertQtyDecreased">
135+
<argument name="productSku" value="$createProduct.sku$"/>
136+
<argument name="expectedQty" value="776"/>
137137
</actionGroup>
138138

139139
<!--Assert refund in refunds grid-->

0 commit comments

Comments
 (0)