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 >
0 commit comments