Skip to content

Commit 0f7ff15

Browse files
committed
refactored
1 parent 3c5ff49 commit 0f7ff15

8 files changed

+151
-60
lines changed
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminClickUpdateQtysButtonOnCreateInvoicePageActionGroup">
12+
<annotations>
13+
<description>Clicks on 'Update Qty's' on the Create Invoice page.</description>
14+
</annotations>
15+
16+
<click selector="{{AdminOrderInvoiceViewSection.updateInvoiceBtn}}" stepKey="clickUpdateQtysBtn"/>
17+
<waitForLoadingMaskToDisappear stepKey="waitForQtysUpdated"/>
18+
</actionGroup>
19+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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="AdminFillInvoiceCommentsFieldOnCreateInvoicePageActionGroup">
12+
<annotations>
13+
<description>Fills the "Invoice Comments" field on the Create Invoice page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="comment" type="string" defaultValue="test comment"/>
17+
</arguments>
18+
19+
<fillField selector="{{AdminInvoiceTotalSection.invoiceComment}}" userInput="{{comment}}" stepKey="fillInvoiceCommentsField"/>
20+
</actionGroup>
21+
</actionGroups>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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="AdminFillQtyToInvoiceOnCreateInvoicePageActionGroup">
12+
<annotations>
13+
<description>Fills the "Qty to invoice" field on the Create Invoice page</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="qty" type="string" defaultValue="1"/>
17+
</arguments>
18+
19+
<fillField selector="{{AdminOrderInvoiceViewSection.invoiceQty}}" userInput="{{qty}}" stepKey="fillQtyToInvoiceField"/>
20+
</actionGroup>
21+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="AdminOpenInvoiceTabFromOrderPageActionGroup">
12+
<annotations>
13+
<description>Opens the Invoice tab from the Edit Order page</description>
14+
</annotations>
15+
16+
<click selector="{{AdminOrderDetailsMainActionsSection.invoiceTab}}" stepKey="openInvoicesTabFromOrderPage"/>
17+
</actionGroup>
18+
</actionGroups>
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontOpenInvoiceTabActionGroup">
12+
<annotations>
13+
<description>Opens the Invoice tab from the Order View page</description>
14+
</annotations>
15+
16+
<click selector="{{StorefrontOrderInvoicesSection.invoiceTab}}" stepKey="clickInvoiceTab"/>
17+
<waitForPageLoad stepKey="waitForInvoiceTabLoad"/>
18+
</actionGroup>
19+
</actionGroups>

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

Lines changed: 28 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -19,129 +19,97 @@
1919
<group value="mtf_migrated"/>
2020
</annotations>
2121
<before>
22-
<!-- Login as admin -->
2322
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
24-
25-
<!-- Create customer -->
2623
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
27-
28-
<!-- Create simple product -->
2924
<createData entity="SimpleProduct2" stepKey="createSimpleProduct">
3025
<field key="price">100</field>
3126
</createData>
32-
33-
<!-- Enable payment method -->
3427
<magentoCLI command="config:set {{BankTransferEnableConfigData.path}} {{BankTransferEnableConfigData.value}}" stepKey="enableBankTransfer"/>
3528
</before>
3629
<after>
37-
<!-- Disable payment method -->
3830
<magentoCLI command="config:set {{BankTransferDisabledConfigData.path}} {{BankTransferDisabledConfigData.value}}" stepKey="enableBankTransfer"/>
39-
40-
<!-- Logout customer -->
4131
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogoutStorefront"/>
42-
43-
<!-- Delete customer -->
4432
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
45-
46-
<!-- Delete product -->
4733
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
48-
49-
<!-- Log out -->
5034
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
5135
</after>
5236

53-
<!-- Create order -->
5437
<actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="goToCreateOrderPage">
5538
<argument name="customer" value="$$createCustomer$$"/>
5639
</actionGroup>
57-
58-
<!-- Add product to order -->
5940
<actionGroup ref="AddSimpleProductWithQtyToOrderActionGroup" stepKey="addProductToOrder">
6041
<argument name="product" value="$$createSimpleProduct$$"/>
6142
<argument name="productQty" value="2"/>
6243
</actionGroup>
63-
64-
<!-- Select bank transfer payment method -->
6544
<actionGroup ref="SelectBankTransferPaymentMethodActionGroup" stepKey="selectPaymentMethod"/>
66-
67-
<!-- Select shipping method -->
6845
<actionGroup ref="AdminClickGetShippingMethodsAndRatesActionGroup" stepKey="openShippingMethod"/>
6946
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForShippingMethods"/>
7047
<actionGroup ref="AdminSelectFixedShippingMethodActionGroup" stepKey="chooseShippingMethod"/>
7148
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForShippingMethodLoad"/>
72-
73-
<!-- Submit order -->
7449
<actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/>
75-
76-
<!-- Grab order id -->
7750
<grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId"/>
7851

79-
<!-- Open created order -->
8052
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="goToOrdersPage"/>
8153
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrdersGridById">
8254
<argument name="orderId" value="$getOrderId"/>
8355
</actionGroup>
84-
<click selector="{{AdminDataGridTableSection.firstRow}}" stepKey="clickCreatedOrderInGrid"/>
85-
86-
<!-- Go to invoice tab and fill data -->
56+
<actionGroup ref="AdminSelectFirstGridRowActionGroup" stepKey="clickCreatedOrderInGrid"/>
8757
<actionGroup ref="AdminClickInvoiceButtonOrderViewActionGroup" stepKey="clickInvoiceAction"/>
88-
<fillField selector="{{AdminOrderInvoiceViewSection.invoiceQty}}" userInput="1" stepKey="fillInvoiceQuantity"/>
89-
<click selector="{{AdminOrderInvoiceViewSection.updateInvoiceBtn}}" stepKey="clickUpdateQtyInvoiceBtn"/>
90-
<fillField selector="{{AdminInvoiceTotalSection.invoiceComment}}" userInput="comment" stepKey="writeComment"/>
58+
<actionGroup ref="AdminFillQtyToInvoiceOnCreateInvoicePageActionGroup" stepKey="fillInvoiceQuantity"/>
59+
<actionGroup ref="AdminClickUpdateQtysButtonOnCreateInvoicePageActionGroup" stepKey="clickUpdateQtyInvoiceBtn"/>
60+
<actionGroup ref="AdminFillInvoiceCommentsFieldOnCreateInvoicePageActionGroup" stepKey="writeComment"/>
9161
<actionGroup ref="AdminInvoiceClickSubmitActionGroup" stepKey="clickSubmitInvoice"/>
92-
93-
<!-- Assert invoice with shipment success message -->
9462
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessMessage"/>
9563

96-
<!-- Assert invoice in invoices grid -->
9764
<actionGroup ref="FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup" stepKey="filterInvoiceGridByOrderId">
9865
<argument name="orderId" value="$getOrderId"/>
9966
</actionGroup>
100-
<click selector="{{AdminInvoicesGridSection.firstRow}}" stepKey="opeCreatedInvoice"/>
101-
<waitForPageLoad stepKey="waitForInvoiceDetailsPageToLoad"/>
67+
<actionGroup ref="AdminSelectFirstGridRowActionGroup" stepKey="opeCreatedInvoice"/>
68+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForInvoiceDetailsPageToLoad"/>
10269
<grabFromCurrentUrl regex="~/invoice_id/(\d+)/~" stepKey="grabInvoiceId"/>
103-
104-
<!-- Assert invoice in invoices tab -->
10570
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="goToOrders"/>
10671
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridByIdForAssertingInvoiceBtn">
10772
<argument name="orderId" value="$getOrderId"/>
10873
</actionGroup>
109-
<click selector="{{AdminDataGridTableSection.firstRow}}" stepKey="clickOrderInGrid"/>
110-
<click selector="{{AdminOrderDetailsMainActionsSection.invoiceTab}}" stepKey="clickInvoicesTabOrdersPage"/>
111-
<conditionalClick selector="{{AdminOrderInvoicesTabSection.clearFilters}}" dependentSelector="{{AdminOrderInvoicesTabSection.clearFilters}}" visible="true" stepKey="clearInvoiceFilters"/>
112-
<click selector="{{AdminOrderInvoicesTabSection.filters}}" stepKey="openOrderInvoicesGridFilters"/>
113-
<fillField selector="{{AdminOrderInvoicesTabSection.invoiceId}}" userInput="$grabInvoiceId" stepKey="fillInvoiceIdFilter"/>
114-
<fillField selector="{{AdminOrderInvoicesTabSection.amountFrom}}" userInput="110.00" stepKey="fillAmountFromFilter"/>
115-
<fillField selector="{{AdminOrderInvoicesTabSection.amountTo}}" userInput="110.00" stepKey="fillAmountToFilter"/>
116-
<click selector="{{AdminOrderInvoicesTabSection.applyFilters}}" stepKey="clickOrderApplyFilters"/>
74+
<actionGroup ref="AdminSelectFirstGridRowActionGroup" stepKey="clickOrderInGrid"/>
75+
<actionGroup ref="AdminOpenInvoiceTabFromOrderPageActionGroup" stepKey="clickInvoicesTabOrdersPage"/>
76+
<actionGroup ref="AdminGridFilterResetActionGroup" stepKey="clearInvoiceFilters"/>
77+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="openOrderInvoicesGridFilters"/>
78+
<actionGroup ref="AdminGridFilterFillFieldBySelectorActionGroup" stepKey="fillInvoiceIdFilter">
79+
<argument name="selector" value="{{AdminOrderInvoicesTabSection.invoiceId}}"/>
80+
<argument name="filterValue" value="$grabInvoiceId"/>
81+
</actionGroup>
82+
<actionGroup ref="AdminGridFilterFillFieldBySelectorActionGroup" stepKey="fillAmountFromFilter">
83+
<argument name="selector" value="{{AdminOrderInvoicesTabSection.amountFrom}}"/>
84+
<argument name="filterValue" value="110.00"/>
85+
</actionGroup>
86+
<actionGroup ref="AdminGridFilterFillFieldBySelectorActionGroup" stepKey="fillAmountToFilter">
87+
<argument name="selector" value="{{AdminOrderInvoicesTabSection.amountTo}}"/>
88+
<argument name="filterValue" value="110.00"/>
89+
</actionGroup>
90+
<actionGroup ref="AdminClickSearchInGridActionGroup" stepKey="clickOrderApplyFilters"/>
11791
<dontSeeElement selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="assertThatInvoiceGridNotEmpty"/>
118-
119-
<!-- Assert invoice items -->
92+
12093
<actionGroup ref="FilterInvoiceGridByOrderIdWithCleanFiltersActionGroup" stepKey="filterInvoiceByOrderId">
12194
<argument name="orderId" value="$getOrderId"/>
12295
</actionGroup>
123-
<click selector="{{AdminInvoicesGridSection.firstRow}}" stepKey="openInvoice"/>
96+
<actionGroup ref="AdminSelectFirstGridRowActionGroup" stepKey="openInvoice"/>
12497
<waitForPageLoad stepKey="waitForInvoicePageToLoad"/>
12598
<see selector="{{AdminInvoiceTotalSection.itemName}}" userInput="$$createSimpleProduct.name$$" stepKey="seeProductNameInInvoiceItems"/>
12699
<see selector="{{AdminInvoiceTotalSection.itemQty}}" userInput="1" stepKey="seeProductQtyInInvoiceItems"/>
127100
<see selector="{{AdminInvoiceTotalSection.itemTotalPrice}}" userInput="$$createSimpleProduct.price$$" stepKey="seeProductTotalPriceInInvoiceItems"/>
128101

129-
<!-- Login as customer -->
130102
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount">
131103
<argument name="Customer" value="$$createCustomer$$"/>
132104
</actionGroup>
133-
<waitForPageLoad stepKey="waitForCustomerLogin"/>
134-
135-
<!-- Open My Account > My Orders -->
105+
<comment userInput="Adding the comment to replace action for preserving Backward Compatibility" stepKey="waitForCustomerLogin"/>
136106
<actionGroup ref="StorefrontOpenMyAccountPageActionGroup" stepKey="goToMyAccountPage"/>
137107
<actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="goToSidebarMenu">
138108
<argument name="menu" value="My Orders"/>
139109
</actionGroup>
140-
141-
<!-- Assert invoiced amount on frontend -->
142-
<click selector="{{StorefrontCustomerOrderSection.viewOrder}}" stepKey="clickViewOrder"/>
110+
<actionGroup ref="StorefrontClickViewOrderLinkOnMyOrdersPageActionGroup" stepKey="clickViewOrder"/>
143111
<dontSeeElement selector="{{StorefrontOrderDetailsSection.orderDateTagElement}}" stepKey="dontSeeDateTag"/>
144-
<click selector="{{StorefrontOrderInvoicesSection.invoiceTab}}" stepKey="clickInvoiceTabOnStorefront"/>
112+
<actionGroup ref="StorefrontOpenInvoiceTabActionGroup" stepKey="clickInvoiceTabOnStorefront"/>
145113
<see selector="{{StorefrontOrderInvoicesSection.grandTotalPrice}}" userInput="$110.00" stepKey="seePrice"/>
146114
</test>
147115
</tests>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="AdminGridFilterFillFieldBySelectorActionGroup">
12+
<annotations>
13+
<description>Fills the provided Filter Value for the element with specified selector.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="selector" type="string"/>
17+
<argument name="filterValue" type="string"/>
18+
</arguments>
19+
20+
<conditionalClick selector="{{AdminDataGridFilterSection.filtersButton}}" dependentSelector="{{AdminDataGridFilterSection.filterExpanded}}" visible="false" stepKey="expandFiltersFormIfCollapsed"/>
21+
<fillField userInput="{{filterValue}}" selector="{{selector}}" stepKey="fillFieldWithValue"/>
22+
</actionGroup>
23+
</actionGroups>

app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridFilterSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
<section name="AdminDataGridFilterSection">
1212
<element name="filterForm" type="block" selector="[data-part='filter-form']" />
1313
<element name="filterExpand" type="button" selector="//div[@class='admin__data-grid-header'][(not(ancestor::*[@class='sticky-header']) and not(contains(@style,'visibility: hidden'))) or (ancestor::*[@class='sticky-header' and not(contains(@style,'display: none'))])]//button[@data-action='grid-filter-expand']" />
14+
<element name="filtersButton" type="button" selector="//button[contains(text(),'Filters')]" />
15+
<element name="filterExpanded" type="button" selector="button.action-default._active"/>
1416
<element name="inputFieldByNameAttr" type="input" selector="//*[@data-part='filter-form']//input[@name='{{inputNameAttr}}']" parameterized="true" />
1517
<element name="inputFieldByNameAttrInGrid" type="input" selector="//*[@data-role='filter-form']//input[@name='{{inputNameAttr}}']" parameterized="true"/>
1618
<element name="selectByNameAttrInGrid" type="input" selector="//*[@data-role='filter-form']//select[@name='{{inputNameAttr}}']" parameterized="true"/>

0 commit comments

Comments
 (0)