Skip to content

Commit 381fc1f

Browse files
committed
MC-41850: Contact form error with non-breaking space at the end of the email address
1 parent 2879dda commit 381fc1f

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertEmailTrimmedInInputActionGroup">
12+
<annotations>
13+
<description>Validated that the provided email address is trimmed from spaces in the given input.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="inputSelector" type="string" defaultValue="input[name='email']"/>
17+
<argument name="emailAddressWithSpaces" type="string" defaultValue="John.Doe@example.com "/>
18+
</arguments>
19+
20+
<executeJS function="return '{{emailAddressWithSpaces}}'.trim();" stepKey="trimEmail"/>
21+
22+
<grabValueFrom selector="{{inputSelector}}" stepKey="grabEmailFromInput"/>
23+
24+
<assertEquals stepKey="assertEmailsAreEqual">
25+
<expectedResult type="string">$trimEmail</expectedResult>
26+
<actualResult type="string">$grabEmailFromInput</actualResult>
27+
</assertEquals>
28+
</actionGroup>
29+
</actionGroups>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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="StorefrontVerifyContactUsNbspTrimFromEmailInputTest">
12+
<annotations>
13+
<features value="Contact"/>
14+
<title value="Test for contact form to trim non-breaking spaces at the end of the email address"/>
15+
<description value="Non-break spaces should be trimmed from the contact form email address input field"/>
16+
<stories value="Submit Contact Us Form"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MC-42234"/>
19+
<useCaseId value="MC-41850"/>
20+
<group value="contact"/>
21+
</annotations>
22+
23+
<actionGroup ref="StorefrontOpenContactUsPageActionGroup" stepKey="goToContactUsPage"/>
24+
25+
<actionGroup ref="StorefrontFillContactUsFormActionGroup" stepKey="fillUpTheFormWithCustomerDataWithNbsp">
26+
<argument name="customer" value="Simple_US_Customer_Nbsp_In_Email" />
27+
<argument name="contactUsData" value="DefaultContactUsData" />
28+
</actionGroup>
29+
30+
<actionGroup ref="AssertEmailTrimmedInInputActionGroup" stepKey="assertEmailWasTrimmedInTheInput">
31+
<argument name="emailAddressWithSpaces" value="{{Simple_US_Customer_Nbsp_In_Email.email}}" />
32+
<argument name="inputSelector" value="{{StorefrontContactUsFormSection.emailField}}" />
33+
</actionGroup>
34+
35+
<actionGroup ref="StorefrontSubmitContactUsFormActionGroup" stepKey="submitContactUsForm"/>
36+
<actionGroup ref="AssertMessageContactUsFormActionGroup" stepKey="assertContactUsFormSuccessfullySubmitted"/>
37+
</test>
38+
</tests>

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@
100100
<data key="website_id">0</data>
101101
<requiredEntity type="address">US_Address_TX</requiredEntity>
102102
</entity>
103+
<entity name="Simple_US_Customer_Nbsp_In_Email" type="customer">
104+
<data key="group_id">1</data>
105+
<data key="default_billing">true</data>
106+
<data key="default_shipping">true</data>
107+
<data key="email" unique="prefix">John.Doe@example.com  </data>
108+
<data key="firstname">John</data>
109+
<data key="lastname">Doe</data>
110+
<data key="fullname">John Doe</data>
111+
<data key="password">pwdTest123!</data>
112+
<data key="store_id">0</data>
113+
<data key="website_id">0</data>
114+
<data key="group">General</data>
115+
<requiredEntity type="address">US_Address_TX</requiredEntity>
116+
</entity>
103117
<entity name="Simple_Customer_Without_Address" type="customer">
104118
<data key="group_id">1</data>
105119
<data key="email" unique="prefix">John.Doe@example.com</data>

0 commit comments

Comments
 (0)