Skip to content

Commit 21d41fa

Browse files
authored
Merge pull request #172 from magento-pangolin/MC-6141
MC-6141
2 parents 7e55aca + a984d07 commit 21d41fa

5 files changed

+81
-0
lines changed
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontOpenMyAccountPageActionGroup">
12+
<amOnPage url="{{StorefrontCustomerDashboardPage.url}}" stepKey="goToMyAccountPage"/>
13+
<waitForPageLoad stepKey="waitForPageLoad"/>
14+
</actionGroup>
15+
</actionGroups>

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerAccountInformationSection.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@
2020
<element name="confirmNewPassword" type="input" selector="#password-confirmation"/>
2121
<element name="confirmNewPasswordError" type="text" selector="#password-confirmation-error"/>
2222
<element name="email" type="input" selector=".form-edit-account input[name='email']" />
23+
<element name="emailErrorMessage" type="text" selector="#email-error"/>
24+
<element name="currentPasswordErrorMessage" type="text" selector="#current-password-error"/>
25+
<element name="emailField" type="input" selector="#email"/>
2326
</section>
2427
</sections>

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerAccountMainSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<section name="StorefrontCustomerAccountMainSection">
1212
<element name="pageTitle" type="text" selector="#maincontent .column.main [data-ui-id='page-title-wrapper']" />
1313
<element name="messageByType" type="block" selector="#maincontent .message-{{messageType}}" parameterized="true" />
14+
<element name="alertMessage" type="text" selector=".page.messages [role=alert]"/>
1415
</section>
1516
</sections>

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerDashboardAccountInformationSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<element name="ContactInformation" type="textarea" selector=".box.box-information .box-content"/>
1313
<element name="edit" type="block" selector=".action.edit" timeout="15"/>
1414
<element name="changePassword" type="block" selector=".action.change-password" timeout="15"/>
15+
<element name="editLink" type="text" selector=".box-information .edit"/>
1516
</section>
1617
<section name="StorefrontCustomerAddressSection">
1718
<element name="firstName" type="input" selector="#firstname"/>
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontCheckNecessaryLogicToActionClassForCookieMessagesTest">
12+
<annotations>
13+
<features value="Security"/>
14+
<stories value="Check necessary logic to action class for cookie messages"/>
15+
<title value="Storefront check necessary logic to action class for cookie messages test"/>
16+
<description value="Check necessary logic to action class for cookie messages"/>
17+
<testCaseId value="MC-6141" />
18+
<severity value="CRITICAL"/>
19+
<group value="security"/>
20+
<group value="customer"/>
21+
</annotations>
22+
<before>
23+
<!-- Create customer -->
24+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
25+
</before>
26+
<after>
27+
<!-- Delete customer -->
28+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
29+
</after>
30+
31+
<!-- Login to application -->
32+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount">
33+
<argument name="Customer" value="$$createCustomer$$"/>
34+
</actionGroup>
35+
36+
<!-- Open 'My Account' page and click 'Edit; link -->
37+
<actionGroup ref="StorefrontOpenMyAccountPageActionGroup" stepKey="goToMyAccountPage"/>
38+
<click selector="{{StorefrontCustomerDashboardAccountInformationSection.editLink}}" stepKey="clickEditContactInformation"/>
39+
40+
<!-- Mark as checked 'Change email' check-box. Assert 2 labels under 'Change Email' block -->
41+
<checkOption selector="{{StorefrontCustomerAccountInformationSection.changeEmail}}" stepKey="clickChangeEmailCheckbox"/>
42+
<seeElement selector="{{StorefrontCustomerAccountInformationSection.email}}" stepKey="seeEmailField"/>
43+
<seeElement selector="{{StorefrontCustomerAccountInformationSection.currentPassword}}" stepKey="seeCurrentPasswordField"/>
44+
45+
<!-- Change email attribute 'type' from email to text and type script after email address. Click 'Save' button -->
46+
<executeJS function="document.querySelector('{{StorefrontCustomerAccountInformationSection.emailField}}').setAttribute('type', 'text');" stepKey="changeAttributeFromEmailToText"/>
47+
<fillField selector="{{StorefrontCustomerAccountInformationSection.email}}" userInput="$$createCustomer.email$$&lt;script&gt;alert('Hello')&lt;/script&gt;" stepKey="fillEmailWithScript"/>
48+
<click selector="{{StorefrontCustomerAccountInformationSection.saveButton}}" stepKey="clickSave"/>
49+
50+
<!-- Assert error messages for email and password fields -->
51+
<dontSee selector="{{StorefrontCustomerAccountInformationSection.emailErrorMessage}}" userInput="Please enter a valid email address." stepKey="dontSeeEmailErrorMessage"/>
52+
<see selector="{{StorefrontCustomerAccountInformationSection.currentPasswordErrorMessage}}" userInput="This is a required field." stepKey="seeErrorPasswordMessage"/>
53+
54+
<!-- Fill password and click 'Save' button -->
55+
<fillField selector="{{StorefrontCustomerAccountInformationSection.currentPassword}}" userInput="$$createCustomer.password$$" stepKey="fillCurrentPassword"/>
56+
<click selector="{{StorefrontCustomerAccountInformationSection.saveButton}}" stepKey="saveChanges"/>
57+
58+
<!-- Throw validation error message (server side validation) with escaped customer input -->
59+
<see selector="{{StorefrontCustomerAccountMainSection.alertMessage}}" userInput="&quot;Email&quot; is not a valid hostname. 'example.com&lt;script&gt;alert('Hello')&lt;/script&gt;' looks like a DNS hostname but we cannot match it against the hostname schema for TLD 'com&lt;script&gt;alert('Hello')&lt;/script&gt;'. 'example.com&lt;script&gt;alert('Hello')&lt;/script&gt;' does not look like a valid local network name." stepKey="seeValidationErrorMessage"/>
60+
</test>
61+
</tests>

0 commit comments

Comments
 (0)