Skip to content

Commit fd4ed41

Browse files
committed
magento:magento2 Missed form validation in Admin Order Address Edit route sales/order/address
1 parent 7b8e969 commit fd4ed41

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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="AdminSubmitsOrderWithAndWithoutFieldsValidationTest">
11+
<annotations>
12+
<features value="Sales"/>
13+
<stories value="Create orders"/>
14+
<title value="Fields validation is required to create an order from Admin Panel"/>
15+
<description value="Admin should not be able to submit orders without invalid address fields"/>
16+
<group value="sales"/>
17+
</annotations>
18+
<before>
19+
<createData entity="_defaultCategory" stepKey="createCategory"/>
20+
<createData entity="_defaultProduct" stepKey="createSimpleProduct">
21+
<requiredEntity createDataKey="createCategory"/>
22+
</createData>
23+
</before>
24+
<after>
25+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
26+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
27+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
28+
</after>
29+
<!--Create order via Admin-->
30+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
31+
<comment userInput="Admin creates order" stepKey="adminCreateOrderComment"/>
32+
<!--<actionGroup ref="navigateToNewOrderPageNewCustomer" stepKey="navigateToNewOrderPage"/>-->
33+
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/>
34+
<waitForPageLoad stepKey="waitForIndexPageLoad"/>
35+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/>
36+
<click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/>
37+
<click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/>
38+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/>
39+
40+
<!--Check if order can be submitted without the required fields including email address-->
41+
<actionGroup ref="checkRequiredFieldsNewOrderForm" stepKey="checkRequiredFieldsNewOrder" after="seeNewOrderPageTitle"/>
42+
<scrollToTopOfPage stepKey="scrollToTopOfOrderFormPage" after="checkRequiredFieldsNewOrder"/>
43+
<actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder" after="scrollToTopOfOrderFormPage">
44+
<argument name="product" value="_defaultProduct"/>
45+
</actionGroup>
46+
47+
<!--Fill customer group and customer email-->
48+
<selectOption selector="{{AdminOrderFormAccountSection.group}}" userInput="{{GeneralCustomerGroup.code}}" stepKey="selectCustomerGroup" after="addSimpleProductToOrder"/>
49+
<fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer.email}}" stepKey="fillCustomerEmail" after="selectCustomerGroup"/>
50+
51+
<!--Fill wrong customer address information-->
52+
<actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress" after="fillCustomerEmail">
53+
<argument name="customer" value="Simple_US_Customer"/>
54+
<argument name="address" value="US_address_TX_Wrong_Validation"/>
55+
</actionGroup>
56+
<!-- Select shipping -->
57+
<actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/>
58+
59+
<!--Verify totals on Order page-->
60+
<see selector="{{AdminOrderFormTotalSection.total('Subtotal')}}" userInput="${{AdminOrderSimpleProduct.subtotal}}" stepKey="seeOrderSubTotal" after="selectFlatRateShipping"/>
61+
<see selector="{{AdminOrderFormTotalSection.total('Shipping')}}" userInput="${{AdminOrderSimpleProduct.shipping}}" stepKey="seeOrderShipping" after="seeOrderSubTotal"/>
62+
<scrollTo selector="{{AdminOrderFormTotalSection.grandTotal}}" stepKey="scrollToOrderGrandTotal"/>
63+
<see selector="{{AdminOrderFormTotalSection.grandTotal}}" userInput="${{AdminOrderSimpleProduct.grandTotal}}" stepKey="seeCorrectGrandTotal" after="scrollToOrderGrandTotal"/>
64+
65+
<!--Submit Order and verify information-->
66+
<click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="clickSubmitOrder" after="seeCorrectGrandTotal"/>
67+
<see selector="{{AdminOrderFormBillingAddressSection.firstNameError}}" userInput="Please enter less or equal than 255 symbols." stepKey="firstNameError" after="clickSubmitOrder"/>
68+
69+
<!--Fill correct customer address information-->
70+
<actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress" after="firstNameError">
71+
<argument name="customer" value="Simple_US_Customer"/>
72+
<argument name="address" value="US_address_TX"/>
73+
</actionGroup>
74+
<!--Submit Order and verify information-->
75+
<click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="clickSubmitOrder" after="fillCustomerAddress"/>
76+
<seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}" stepKey="seeViewOrderPage" after="clickSubmitOrder"/>
77+
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeSuccessMessage" after="seeViewOrderPage"/>
78+
</test>
79+
</tests>

dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,21 @@
118118
<field name="default_shipping" xsi:type="string">Yes</field>
119119
</dataset>
120120

121+
<dataset name="US_address_TX_Wrong_Validation">
122+
<field name="firstname" xsi:type="string">LoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsumLoremIpsum</field>
123+
<field name="lastname" xsi:type="string">Doe</field>
124+
<field name="email" xsi:type="string">John.Doe%isolation%@example.com</field>
125+
<field name="company" xsi:type="string">Magento %isolation%</field>
126+
<field name="street" xsi:type="string">7700 W. Parmer Lane Bldg. D</field>
127+
<field name="city" xsi:type="string">Austin</field>
128+
<field name="region_id" xsi:type="string">Texas</field>
129+
<field name="postcode" xsi:type="string">78729</field>
130+
<field name="country_id" xsi:type="string">United States</field>
131+
<field name="telephone" xsi:type="string">512-691-4400</field>
132+
<field name="default_billing" xsi:type="string">Yes</field>
133+
<field name="default_shipping" xsi:type="string">Yes</field>
134+
</dataset>
135+
121136
<dataset name="US_address_NY">
122137
<field name="firstname" xsi:type="string">John</field>
123138
<field name="lastname" xsi:type="string">Doe</field>

0 commit comments

Comments
 (0)