Skip to content

Commit 473356f

Browse files
committed
MC-29184: Unexpected message appears if you try to add products to order via admin panel
1 parent 9f093a3 commit 473356f

File tree

4 files changed

+121
-0
lines changed

4 files changed

+121
-0
lines changed
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertAdminItemOrderedErrorActionGroup">
11+
<annotations>
12+
<description>Assert that item in "Item Ordered" grid has an error/notice</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="productName" defaultValue="{{_defaultProduct.name}}" type="string"/>
16+
<argument name="messageType" defaultValue="error" type="string"/>
17+
<argument name="message" defaultValue="The requested qty is not available" type="string"/>
18+
</arguments>
19+
<see userInput="{{message}}" selector="{{AdminOrderFormItemsOrderedSection.productMessage(productName, messageType)}}" stepKey="assertItemErrorVisible"/>
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertAdminItemOrderedErrorNotVisibleActionGroup">
11+
<annotations>
12+
<description>Assert that item in "Item Ordered" grid does not have an error/notice</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="productName" defaultValue="{{_defaultProduct.name}}" type="string"/>
16+
<argument name="messageType" defaultValue="error" type="string"/>
17+
<argument name="message" defaultValue="The requested qty is not available" type="string"/>
18+
</arguments>
19+
<dontSee userInput="{{message}}" selector="{{AdminOrderFormItemsOrderedSection.productMessage(productName, messageType)}}" stepKey="assertItemErrorNotVisible"/>
20+
</actionGroup>
21+
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
<element name="configureSelectAttribute" type="select" selector="select[id*=attribute]"/>
1919
<element name="itemsSKU" type="text" selector="(//div[contains(@class, 'product-sku-block')])[{{productNumber}}]" parameterized="true"/>
2020
<element name="moveProduct" type="select" selector="//td[contains(.,'{{productName}}')]/../..//td//select" parameterized="true"/>
21+
<element name="productMessage" type="text" selector="//section[@id = 'order-items']//span[text()='{{productName}}']/ancestor::tr/..//div[contains(@class, 'message-{{messageType}}')]" parameterized="true"/>
2122
</section>
2223
</sections>
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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="AdminAddSelectedProductToOrderTest">
12+
<annotations>
13+
<features value="CatalogInventory"/>
14+
<stories value="Admin create order"/>
15+
<title value="Add selected products to order in Admin when requested qty more than available"/>
16+
<description value="Trying to add selected products to order in Admin when requested qty more than available"/>
17+
<useCaseId value="MC-29184"/>
18+
<testCaseId value="MC-31589"/>
19+
<severity value="MAJOR"/>
20+
<group value="sales"/>
21+
<group value="catalogInventory"/>
22+
</annotations>
23+
<before>
24+
<createData entity="Simple_US_Customer" stepKey="simpleCustomer"/>
25+
<createData entity="SimpleProduct2" stepKey="simpleProduct"/>
26+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
27+
</before>
28+
<after>
29+
<deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/>
30+
<deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/>
31+
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
32+
</after>
33+
34+
<!-- Initiate create new order -->
35+
<actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderPageWithExistingCustomer">
36+
<argument name="customer" value="$simpleCustomer$"/>
37+
</actionGroup>
38+
<!-- Add to order maximum available quantity - 1 -->
39+
<executeJS function="return {{SimpleProduct2.quantity}} - 1" stepKey="maxQtyMinusOne"/>
40+
<actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProductToOrderWithMaxQtyMinusOne">
41+
<argument name="product" value="$simpleProduct$"/>
42+
<argument name="productQty" value="{$maxQtyMinusOne}"/>
43+
</actionGroup>
44+
<!-- Check that there is no error or notice -->
45+
<actionGroup ref="AssertAdminItemOrderedErrorNotVisibleActionGroup" stepKey="assertNoticeAbsent">
46+
<argument name="productName" value="$simpleProduct.name$"/>
47+
<argument name="messageType" value="notice"/>
48+
</actionGroup>
49+
<actionGroup ref="AssertAdminItemOrderedErrorNotVisibleActionGroup" stepKey="assertErrorAbsent">
50+
<argument name="productName" value="$simpleProduct.name$"/>
51+
<argument name="messageType" value="error"/>
52+
</actionGroup>
53+
<!-- Add to order maximum available quantity -->
54+
<actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProductToOrder">
55+
<argument name="product" value="$simpleProduct$"/>
56+
<argument name="productQty" value="1"/>
57+
</actionGroup>
58+
<!-- Check that there is no error or notice -->
59+
<actionGroup ref="AssertAdminItemOrderedErrorNotVisibleActionGroup" stepKey="assertNoticeAbsentAgain">
60+
<argument name="productName" value="$simpleProduct.name$"/>
61+
<argument name="messageType" value="notice"/>
62+
</actionGroup>
63+
<actionGroup ref="AssertAdminItemOrderedErrorNotVisibleActionGroup" stepKey="assertErrorAbsentAgain">
64+
<argument name="productName" value="$simpleProduct.name$"/>
65+
<argument name="messageType" value="error"/>
66+
</actionGroup>
67+
<!-- Add to order one more quantity -->
68+
<actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProductToOrderAgain">
69+
<argument name="product" value="$simpleProduct$"/>
70+
<argument name="productQty" value="1"/>
71+
</actionGroup>
72+
<!-- Check that error remains -->
73+
<actionGroup ref="AssertAdminItemOrderedErrorActionGroup" stepKey="assertProductErrorRemains">
74+
<argument name="productName" value="$simpleProduct.name$"/>
75+
<argument name="messageType" value="notice"/>
76+
</actionGroup>
77+
</test>
78+
</tests>

0 commit comments

Comments
 (0)