Skip to content

Commit b1b3e6c

Browse files
committed
Cover MFTF test
1 parent 168a006 commit b1b3e6c

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed

app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,18 @@
178178
<data key="website_id">0</data>
179179
<requiredEntity type="address">US_Address_CA</requiredEntity>
180180
</entity>
181+
<entity name="Simple_US_Customer_CA_Without_Email" type="customer">
182+
<data key="group_id">0</data>
183+
<data key="default_billing">true</data>
184+
<data key="default_shipping">true</data>
185+
<data key="firstname">John</data>
186+
<data key="lastname">Doe</data>
187+
<data key="fullname">John Doe</data>
188+
<data key="password">pwdTest123!</data>
189+
<data key="store_id">0</data>
190+
<data key="website_id">0</data>
191+
<requiredEntity type="address">US_Address_CA</requiredEntity>
192+
</entity>
181193
<entity name="Simple_US_Customer_For_Update" type="customer">
182194
<var key="id" entityKey="id" entityType="customer"/>
183195
<data key="firstname">Jane</data>
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="VerifyCreatedOrderInformationWithGeneratedEmailActionGroup">
11+
<annotations>
12+
<description>Validate customer email on order page. Starts on order page.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="email" type="string" defaultValue="{{CustomerEntityOne.email}}"/>
16+
</arguments>
17+
<see selector="{{AdminOrderDetailsInformationSection.customerEmail}}" userInput="{{email}}" stepKey="seeGeneratedEmail"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/Sales/Test/Mftf/Data/ConfigData.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,12 @@
2020
<data key="label">No</data>
2121
<data key="value">0</data>
2222
</entity>
23+
<entity name="DisableEmailRequiredForOrder">
24+
<data key="path">customer/create_account/email_required_create_order</data>
25+
<data key="value">0</data>
26+
</entity>
27+
<entity name="EnableEmailRequiredForOrder">
28+
<data key="path">customer/create_account/email_required_create_order</data>
29+
<data key="value">1</data>
30+
</entity>
2331
</entities>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateOrderWithCustomerWithoutEmailTest">
11+
<annotations>
12+
<title value="Admin Create Order"/>
13+
<stories value="Admin create order with customer without email."/>
14+
<description value="Verify, admin able to create order with customer without email."/>
15+
<severity value="MINOR"/>
16+
<group value="Sales"/>
17+
</annotations>
18+
<before>
19+
<!--Disable required 'email' field on create order page.-->
20+
<magentoCLI command="config:set {{DisableEmailRequiredForOrder.path}} {{DisableEmailRequiredForOrder.value}}" stepKey="disableRequiredFieldEmailForAdminOrderCreation"/>
21+
<!--Create test data.-->
22+
<createData entity="_defaultCategory" stepKey="category"/>
23+
<createData entity="SimpleProduct" stepKey="simpleProduct">
24+
<requiredEntity createDataKey="category"/>
25+
</createData>
26+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
27+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
28+
</before>
29+
<after>
30+
<!--Clean up created test data.-->
31+
<deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/>
32+
<deleteData createDataKey="category" stepKey="deleteCategory"/>
33+
<!--Enable required 'email' field on create order page.-->
34+
<magentoCLI command="config:set {{EnableEmailRequiredForOrder.path}} {{EnableEmailRequiredForOrder.value}}" stepKey="enableRequiredFieldEmailForAdminOrderCreation"/>
35+
<actionGroup ref="logout" stepKey="logout"/>
36+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
37+
</after>
38+
39+
<!--Create order.-->
40+
<actionGroup ref="NavigateToNewOrderPageNewCustomerActionGroup" stepKey="navigateToNewOrderPageNewCustomerActionGroup" />
41+
<actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder">
42+
<argument name="product" value="$$simpleProduct$$"/>
43+
<argument name="productQty" value="{{SimpleProduct.quantity}}"/>
44+
</actionGroup>
45+
<!--Fill customer address without 'email'-->
46+
<actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerInformation">
47+
<argument name="customer" value="Simple_US_Customer_CA_Without_Email"/>
48+
<argument name="address" value="US_Address_CA"/>
49+
</actionGroup>
50+
<actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="orderSelectFlatRateShippingMethod"/>
51+
<actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/>
52+
<!--Verify, 'email' is generated.-->
53+
<actionGroup ref="VerifyCreatedOrderInformationWithGeneratedEmailActionGroup" stepKey="verifyCustomerEmail">
54+
<argument name="email" value="@example.com"/>
55+
</actionGroup>
56+
<grabTextFrom selector="{{AdminOrderDetailsInformationSection.customerEmail}}" stepKey="generatedCustomerEmail"/>
57+
<actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteCustomer">
58+
<argument name="email" value="$generatedCustomerEmail"/>
59+
</actionGroup>
60+
</test>
61+
</tests>

0 commit comments

Comments
 (0)