Skip to content

Commit 4f27d93

Browse files
committed
Merge remote-tracking branch 'magento-mpi/MC-17838' into PR-20190718
2 parents a9ea087 + 2c5091b commit 4f27d93

File tree

4 files changed

+133
-2
lines changed

4 files changed

+133
-2
lines changed

app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
*/
1818
abstract class Create extends \Magento\Backend\App\Action
1919
{
20+
/**
21+
* Indicates how to process post data
22+
*/
23+
private static $actionSave = 'save';
2024
/**
2125
* @var \Magento\Framework\Escaper
2226
*/
@@ -206,7 +210,7 @@ protected function _processActionData($action = null)
206210
/**
207211
* Apply mass changes from sidebar
208212
*/
209-
if ($data = $this->getRequest()->getPost('sidebar')) {
213+
if (($data = $this->getRequest()->getPost('sidebar')) && $action !== self::$actionSave) {
210214
$this->_getOrderCreateModel()->applySidebarData($data);
211215
}
212216

@@ -222,7 +226,8 @@ protected function _processActionData($action = null)
222226
/**
223227
* Adding products to quote from special grid
224228
*/
225-
if ($this->getRequest()->has('item') && !$this->getRequest()->getPost('update_items') && !($action == 'save')
229+
if ($this->getRequest()->has('item') && !$this->getRequest()->getPost('update_items')
230+
&& $action !== self::$actionSave
226231
) {
227232
$items = $this->getRequest()->getPost('item');
228233
$items = $this->_processFiles($items);

app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,14 @@
292292
<see selector="{{AdminOrderItemsOrderedSection.productSkuColumn}}" userInput="{{product.sku}}" stepKey="seeSkuInItemsOrdered"/>
293293
</actionGroup>
294294

295+
<!--Assert that the product is not in the order items list-->
296+
<actionGroup name="dontSeeProductInItemsOrdered">
297+
<arguments>
298+
<argument name="product"/>
299+
</arguments>
300+
<dontSee selector="{{AdminOrderItemsOrderedSection.productSkuColumn}}" userInput="{{product.sku}}" stepKey="dontseeSkuInItemsOrdered"/>
301+
</actionGroup>
302+
295303
<!--Select Check Money payment method-->
296304
<actionGroup name="SelectCheckMoneyPaymentMethod">
297305
<waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminOrderFormShoppingCartSection">
12+
<element name="addProduct" type="button" selector="//div[@id='sidebar_data_cart']//tr[td[contains(.,'{{name}}')]]//input[contains(@name,'[add_cart_item]')]" timeout="30" parameterized="true"/>
13+
<element name="removeProduct" type="button" selector="//div[@id='sidebar_data_cart']//tr[td[contains(.,'{{name}}')]]//input[contains(@name,'[remove]')]" timeout="30" parameterized="true"/>
14+
</section>
15+
</sections>
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateOrderWithSelectedShoppingCartItemsTest">
11+
<annotations>
12+
<title value="Shopping cart items must not be added to the order unless they were moved manually"/>
13+
<stories value="MC-17838: Shopping cart items added to the order created in the admin"/>
14+
<description value="Shopping cart items must not be added to the order unless they were moved manually"/>
15+
<features value="Sales"/>
16+
<severity value="AVERAGE"/>
17+
<group value="Sales"/>
18+
</annotations>
19+
<before>
20+
<!--Set default flat rate shipping method settings-->
21+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
22+
23+
<!--Create customer-->
24+
<createData entity="Simple_US_CA_Customer" stepKey="simpleCustomer"/>
25+
26+
<!--Create category-->
27+
<createData entity="_defaultCategory" stepKey="category1"/>
28+
29+
<!--Create product1-->
30+
<createData entity="_defaultProduct" stepKey="product1">
31+
<requiredEntity createDataKey="category1"/>
32+
</createData>
33+
34+
<!--Create product2-->
35+
<createData entity="_defaultProduct" stepKey="product2">
36+
<requiredEntity createDataKey="category1"/>
37+
</createData>
38+
39+
<!--Login as admin-->
40+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
41+
</before>
42+
43+
<!-- Step 1: Go to Storefront as Customer -->
44+
<actionGroup ref="CustomerLoginOnStorefront" stepKey="customerLogin">
45+
<argument name="customer" value="$$simpleCustomer$$" />
46+
</actionGroup>
47+
48+
<!-- Step 2: Add product to cart -->
49+
<amOnPage url="{{StorefrontProductPage.url($$product1.custom_attributes[url_key]$)}}" stepKey="amOnPage"/>
50+
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
51+
<argument name="product" value="$$product1$$"/>
52+
<argument name="productCount" value="1"/>
53+
</actionGroup>
54+
55+
<!--Step 3: Create new customer order-->
56+
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrderWithExistingCustomer">
57+
<argument name="customer" value="$$simpleCustomer$$"/>
58+
</actionGroup>
59+
60+
<!--Step 4: Add product2 to the order-->
61+
<actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder">
62+
<argument name="product" value="$$product2$$"/>
63+
</actionGroup>
64+
65+
<!--Step 5: Select product1 in the shopping cart-->
66+
<click selector="{{AdminOrderFormShoppingCartSection.addProduct($$product1.name$$)}}" stepKey="selectProduct1InTheShoppingCart"/>
67+
68+
<!--Step 6: Select FlatRate shipping method-->
69+
<actionGroup ref="orderSelectFlatRateShipping" stepKey="orderSelectFlatRateShippingMethod"/>
70+
71+
<!--Step 7: Submit order-->
72+
<actionGroup ref="SubmitOrderActionGroup" stepKey="submitOrder"/>
73+
74+
<!--Step 8: Verify order information-->
75+
<actionGroup ref="verifyCreatedOrderInformation" stepKey="verifyCreatedOrderInformation"/>
76+
77+
<!--Step 9: Check that product 2 is in the order items list -->
78+
<actionGroup ref="seeProductInItemsOrdered" stepKey="seeProduct2InItemsOrdered">
79+
<argument name="product" value="$$product2$$"/>
80+
</actionGroup>
81+
82+
<!--Step 10: Check that product 1 is not in the order items list -->
83+
<actionGroup ref="dontSeeProductInItemsOrdered" stepKey="dontSeeProduct1InItemsOrdered">
84+
<argument name="product" value="$$product1$$"/>
85+
</actionGroup>
86+
<after>
87+
<!--Delete product1-->
88+
<deleteData createDataKey="product1" stepKey="deleteProduct1"/>
89+
90+
<!--Delete product2-->
91+
<deleteData createDataKey="product2" stepKey="deleteProduct2"/>
92+
93+
<!--Delete category-->
94+
<deleteData createDataKey="category1" stepKey="deleteCategory1"/>
95+
96+
<!--Delete customer-->
97+
<deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/>
98+
99+
<!--Logout-->
100+
<actionGroup ref="logout" stepKey="logout"/>
101+
</after>
102+
</test>
103+
</tests>

0 commit comments

Comments
 (0)