Skip to content

Commit 6903934

Browse files
authored
ENGCOM-9262: [MFTF] Refactoring StorefrontOrderPagerDisplayedTest #33571
2 parents d577a65 + 4460a38 commit 6903934

File tree

7 files changed

+216
-123
lines changed

7 files changed

+216
-123
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
9+
<page name="AdminOrderViewPage" url="sales/order/view/order_id/{{entity_id}}" area="admin" module="Backend"/>
10+
</pages>

app/code/Magento/Quote/Test/Mftf/Data/CustomerCartData.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,9 @@
3030
<requiredEntity type="payment_method">CashOnDeliveryPaymentMethod</requiredEntity>
3131
<requiredEntity type="billing_address">BillingAddressTX</requiredEntity>
3232
</entity>
33+
34+
<entity name="GetOrderData" type="CustomerCart">
35+
<var key="cart_id" entityKey="return" entityType="CustomerCart"/>
36+
</entity>
37+
3338
</entities>

app/code/Magento/Quote/Test/Mftf/Metadata/CustomerCartMeta.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,9 @@
6060
<field key="method">string</field>
6161
</object>
6262
</operation>
63+
64+
<operation name="GetOrderData" dataType="CustomerCart" type="get" auth="adminOauth" url="/V1/orders/{return}" method="GET">
65+
<contentType>application/json</contentType>
66+
</operation>
67+
6368
</operations>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="AdminOpenOrderViewPageByOrderIdActionGroup">
12+
<annotations>
13+
<description>Opens the Order View Page in Admin using order_id</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="orderId" type="string"/>
17+
</arguments>
18+
19+
<amOnPage url="{{AdminOrderViewPage.url(orderId)}}" stepKey="openOrderViewPage"/>
20+
<waitForPageLoad stepKey="waitForOrderViewPage"/>
21+
</actionGroup>
22+
</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="StorefrontOpenMyOrdersPageActionGroup">
12+
<annotations>
13+
<description>Opens the "My Account->"My Orders" Page</description>
14+
</annotations>
15+
16+
<amOnPage url="/sales/order/history/" stepKey="openMyOrdersPage"/>
17+
<waitForPageLoad stepKey="waitForMyOrdersPage"/>
18+
</actionGroup>
19+
</actionGroups>

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

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,25 @@
2222
<before>
2323
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
2424

25-
<!-- Enable Cash On Delivery payment method -->
2625
<magentoCLI command="config:set {{EnableCashOnDeliveryConfigData.path}} {{EnableCashOnDeliveryConfigData.value}}" stepKey="enableCashOnDeliveryPayment"/>
27-
28-
<!--Set default flat rate shipping method settings-->
2926
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
3027

31-
<!--Create simple customer-->
3228
<createData entity="Simple_US_Customer_CA" stepKey="simpleCustomer"/>
3329

34-
<!-- Create Simple Product -->
3530
<createData entity="SimpleProduct2" stepKey="simpleProduct">
3631
<field key="price">10.00</field>
3732
</createData>
33+
34+
<createData entity="CustomerCart" stepKey="createCustomerCart">
35+
<requiredEntity createDataKey="simpleCustomer"/>
36+
</createData>
37+
<createData entity="CustomerCartItem" stepKey="addCartItem">
38+
<requiredEntity createDataKey="createCustomerCart"/>
39+
<requiredEntity createDataKey="simpleProduct"/>
40+
</createData>
41+
<createData entity="CustomerAddressInformation" stepKey="addCustomerOrderAddress">
42+
<requiredEntity createDataKey="createCustomerCart"/>
43+
</createData>
3844
</before>
3945
<after>
4046
<magentoCLI command="config:set {{DisableCashOnDeliveryConfigData.path}} {{DisableCashOnDeliveryConfigData.value}}" stepKey="disableCashOnDeliveryPayment"/>
@@ -43,39 +49,34 @@
4349
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
4450
</after>
4551

46-
<!-- Create new customer order -->
47-
<actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer">
48-
<argument name="customer" value="$$simpleCustomer$$"/>
49-
</actionGroup>
52+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="navigateToNewOrderWithExistingCustomer"/>
53+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="addSimpleProductToTheOrder"/>
54+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectFlatRateShippingMethod"/>
55+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPaymentOptions"/>
56+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="selectCashOnDeliveryPaymentOption"/>
5057

51-
<!-- Add Simple product to order -->
52-
<actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToTheOrder">
53-
<argument name="product" value="$$simpleProduct$$"/>
54-
</actionGroup>
55-
56-
<!-- Select FlatRate shipping method -->
57-
<actionGroup ref="AdminSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
58+
<updateData createDataKey="createCustomerCart" entity="CashOnDeliveryOrderPaymentMethod" stepKey="submitOrder">
59+
<requiredEntity createDataKey="createCustomerCart"/>
60+
</updateData>
5861

59-
<!-- Select Cash On Delivery payment method -->
60-
<waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/>
61-
<checkOption selector="{{AdminOrderFormPaymentSection.cashOnDeliveryOption}}" stepKey="selectCashOnDeliveryPaymentOption"/>
62-
<actionGroup ref="AdminOrderClickSubmitOrderActionGroup" stepKey="submitOrder" />
62+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="verifyCreatedOrderInformation"/>
63+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="orderId"/>
6364

64-
<!--Verify order information-->
65-
<actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/>
66-
<grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/>
65+
<actionGroup ref="AdminOpenOrderViewPageByOrderIdActionGroup" stepKey="openOrder">
66+
<argument name="orderId" value="$createCustomerCart.return$"/>
67+
</actionGroup>
6768

68-
<!-- Cancel the Order -->
6969
<actionGroup ref="CancelPendingOrderActionGroup" stepKey="cancelPendingOrder"/>
70-
71-
<!--Log in to Storefront as Customer -->
70+
7271
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="signUp">
7372
<argument name="Customer" value="$$simpleCustomer$$"/>
7473
</actionGroup>
75-
76-
<!-- Assert Order status in frontend grid -->
77-
<click selector="{{StorefrontCustomerSidebarSection.sidebarCurrentTab('My Orders')}}" stepKey="clickOnMyOrders"/>
78-
<waitForPageLoad stepKey="waitForOrderDetailsToLoad"/>
79-
<seeElement selector="{{StorefrontCustomerOrderViewSection.orderStatusInGrid('$orderId', 'Canceled')}}" stepKey="seeOrderStatusInGrid"/>
74+
75+
<getData entity="GetOrderData" stepKey="getOrderData">
76+
<requiredEntity createDataKey="createCustomerCart"/>
77+
</getData>
78+
<actionGroup ref="StorefrontOpenMyOrdersPageActionGroup" stepKey="clickOnMyOrders"/>
79+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForOrderDetailsToLoad"/>
80+
<seeElement selector="{{StorefrontCustomerOrderViewSection.orderStatusInGrid('$getOrderData.increment_id$', 'Canceled')}}" stepKey="seeOrderStatusInGrid"/>
8081
</test>
8182
</tests>

0 commit comments

Comments
 (0)