Skip to content

Commit b971123

Browse files
authored
ENGCOM-9351: [MFTF] Refactoring MoveLastOrderedSimpleProductOnOrderPageTest #33688
2 parents 21107dd + 66509a0 commit b971123

4 files changed

+92
-22
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminCheckLastOrderedProductOnCustomerEditPageActionGroup">
11+
<annotations>
12+
<description>Checks the last ordered product on the Customer Edit page</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="productName" type="string"/>
16+
</arguments>
17+
18+
<click selector="{{AdminCustomerActivitiesLastOrderedSection.addProductToOrder(productName)}}" stepKey="addLastOrderedProductToOrder"/>
19+
</actionGroup>
20+
</actionGroups>
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="AdminClickCreateOrderButtonOnEditCustomerPageActionGroup">
12+
<annotations>
13+
<description>Clicks Create Order Button on the Edit Customer Page</description>
14+
</annotations>
15+
16+
<click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/>
17+
<waitForPageLoad stepKey="waitForPageLoaded"/>
18+
</actionGroup>
19+
</actionGroups>
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="AdminSeeProductInItemsOrderedGridOnCreateOrderPageActionGroup">
12+
<annotations>
13+
<description>Sees Product in the "Items Ordered" Grid on th Create Order page</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="rowIndex" type="string" defaultValue="1"/>
17+
<argument name="columnName" type="string" defaultValue="Product"/>
18+
<argument name="expectedValue" type="string"/>
19+
</arguments>
20+
21+
<see selector="{{AdminCustomerCreateNewOrderSection.gridCell(rowIndex, columnName)}}" userInput="{{expectedValue}}" stepKey="seeProductAttribute"/>
22+
</actionGroup>
23+
</actionGroups>

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

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,46 +21,54 @@
2121
<group value="pr_exclude"/>
2222
</annotations>
2323
<before>
24-
<!-- Login as admin -->
2524
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
2625

27-
<!-- Create customer -->
2826
<createData entity="Simple_US_CA_Customer" stepKey="createCustomer"/>
29-
30-
<!-- Create product -->
3127
<createData entity="SimpleProduct2" stepKey="createProduct"/>
28+
29+
<createData entity="CustomerCart" stepKey="createCustomerCart">
30+
<requiredEntity createDataKey="createCustomer"/>
31+
</createData>
32+
<createData entity="CustomerCartItem" stepKey="addCartItem">
33+
<requiredEntity createDataKey="createCustomerCart"/>
34+
<requiredEntity createDataKey="createProduct"/>
35+
</createData>
36+
<createData entity="CustomerAddressInformation" stepKey="addCustomerOrderAddress">
37+
<requiredEntity createDataKey="createCustomerCart"/>
38+
</createData>
39+
<updateData createDataKey="createCustomerCart" entity="CustomerOrderPaymentMethod" stepKey="submitOrder">
40+
<requiredEntity createDataKey="createCustomerCart"/>
41+
</updateData>
3242
</before>
3343
<after>
34-
<!-- Delete created data -->
3544
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
3645
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
3746
<actionGroup ref="AdminLogoutActionGroup" stepKey="logOut"/>
3847
</after>
3948

40-
<!-- Create order -->
41-
<actionGroup ref="CreateOrderActionGroup" stepKey="createOrder">
42-
<argument name="product" value="$$createProduct$$"/>
43-
<argument name="customer" value="$$createCustomer$$"/>
44-
</actionGroup>
45-
46-
<!-- Search and open customer -->
49+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="createOrder"/>
50+
4751
<actionGroup ref="AdminOpenCustomerEditPageActionGroup" stepKey="openCustomerEditPage">
4852
<argument name="customerId" value="$createCustomer.id$"/>
4953
</actionGroup>
5054
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterCreatedCustomer"/>
5155
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickEditButton"/>
5256

53-
<!-- Click create order -->
54-
<click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/>
55-
56-
<!-- Select product in Last Ordered Items section -->
57-
<click selector="{{AdminCustomerActivitiesLastOrderedSection.addProductToOrder($$createProduct.name$$)}}" stepKey="addProductToOrder"/>
58-
59-
<!-- Click Update Changes -->
57+
<actionGroup ref="AdminClickCreateOrderButtonOnEditCustomerPageActionGroup" stepKey="clickCreateOrder"/>
58+
59+
<actionGroup ref="AdminCheckLastOrderedProductOnCustomerEditPageActionGroup" stepKey="addProductToOrder">
60+
<argument name="productName" value="$$createProduct.name$$"/>
61+
</actionGroup>
62+
6063
<actionGroup ref="AdminClickUpdateChangesOnCreateOrderPageActionGroup" stepKey="clickUpdateChangesBtn"/>
6164

62-
<!-- Assert product in items ordered grid -->
63-
<see selector="{{AdminCustomerCreateNewOrderSection.gridCell('1', 'Product')}}" userInput="$$createProduct.name$$" stepKey="seeProductName"/>
64-
<see selector="{{AdminCustomerCreateNewOrderSection.gridCell('1', 'Price')}}" userInput="$$createProduct.price$$" stepKey="seeProductPrice"/>
65+
<actionGroup ref="AdminSeeProductInItemsOrderedGridOnCreateOrderPageActionGroup" stepKey="seeProductName">
66+
<argument name="expectedValue" value="$$createProduct.name$$"/>
67+
</actionGroup>
68+
<actionGroup ref="AdminSeeProductInItemsOrderedGridOnCreateOrderPageActionGroup" stepKey="seeProductPrice">
69+
<argument name="columnName" value="Price"/>
70+
<argument name="expectedValue" value="$$createProduct.price$$"/>
71+
</actionGroup>
72+
6573
</test>
6674
</tests>

0 commit comments

Comments
 (0)