Skip to content

Commit c265b7f

Browse files
committed
Merge branch 'password-complexity-test' of https://github.com/DmitryTsymbal/magento-functional-tests-migration into reece-community-migration-2
2 parents 1ad65a3 + 7459ca7 commit c265b7f

File tree

8 files changed

+136
-0
lines changed

8 files changed

+136
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontClickHeaderLinkActionGroup">
11+
<arguments>
12+
<argument name="LinkName" type="string" defaultValue="Create an Account"/>
13+
</arguments>
14+
<click stepKey="ClickTheLink" selector="{{StorefrontHeaderSection.HeaderLinkByText(LinkName)}}"/>
15+
<waitForPageLoad stepKey="Wait"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontSeeHeaderLinksActionGroup">
11+
<arguments>
12+
<argument name="LinkName" type="string" defaultValue="Create an Account"/>
13+
</arguments>
14+
<see stepKey="SeeElement" selector="{{StorefrontHeaderSection.headerlinks}}" userInput="{{LinkName}}"/>
15+
</actionGroup>
16+
</actionGroups>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="StorefrontHeaderSection">
12+
<element name="headerlinks" type="text" selector="ul.header.links"/>
13+
<element name="HeaderLinkByText" type="text" selector="//ul[contains(@class, 'header') and contains(@class, 'links')]/li/a[contains(text(),'{{LinkName}}')]"
14+
parameterized="true" />
15+
</section>
16+
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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="AssertMessageCustomerCreateAccountPasswordComplexityActionGroup">
12+
<arguments>
13+
<argument name="message" type="string"/>
14+
</arguments>
15+
<see userInput="{{message}}" selector="{{StorefrontCustomerCreateFormSection.PasswordErrorMessages}}" stepKey="verifyMessage" />
16+
</actionGroup>
17+
</actionGroups>

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,24 @@
300300
<requiredEntity type="address">US_Address_TX</requiredEntity>
301301
<requiredEntity type="address">US_Address_NY_Not_Default_Address</requiredEntity>
302302
</entity>
303+
<entity name="Simple_Customer_With_Password_Length_Is_Below_Eight_Characters" type="customer">
304+
<data key="group_id">1</data>
305+
<data key="email" unique="prefix">John.Doe@example.com</data>
306+
<data key="firstname">John</data>
307+
<data key="lastname">Doe</data>
308+
<data key="fullname">John Doe</data>
309+
<data key="password">123123</data>
310+
<data key="store_id">0</data>
311+
<data key="website_id">0</data>
312+
</entity>
313+
<entity name="Simple_Customer_With_Not_Secure_Password" type="customer">
314+
<data key="group_id">1</data>
315+
<data key="email" unique="prefix">John.Doe@example.com</data>
316+
<data key="firstname">John</data>
317+
<data key="lastname">Doe</data>
318+
<data key="fullname">John Doe</data>
319+
<data key="password">123123qa</data>
320+
</entity>
303321
<entity name="Simple_US_Customer_Incorrect_Email" type="customer">
304322
<data key="group_id">0</data>
305323
<data key="default_billing">true</data>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<element name="passwordField" type="input" selector="#password"/>
1818
<element name="confirmPasswordField" type="input" selector="#password-confirmation"/>
1919
<element name="createAccountButton" type="button" selector="button.action.submit.primary" timeout="30"/>
20+
<element name="PasswordErrorMessages" type="text" selector="#password-error"/>
2021
</section>
2122
<section name="StoreFrontCustomerAdvancedAttributesSection">
2223
<element name="textFieldAttribute" type="input" selector="//input[@id='{{var}}']" parameterized="true" />
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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="NewCustomerPasswordComplexityTest">
12+
<annotations>
13+
<features value="Security"/>
14+
<stories value="Checking customer's password length and password complexity"/>
15+
<title value="Notify the customer if password length or complexity is not match to requirements"/>
16+
<description value="Show notifies to the customer if password length or complexity is not match to requirements"/>
17+
<group value="security"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
21+
<!-- TEST BODY -->
22+
<!-- Go to storefront home page -->
23+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStoreFrontHomePage"/>
24+
<!-- See the Registration Link -->
25+
<actionGroup ref="StorefrontSeeHeaderLinksActionGroup" stepKey="SeeTheLink"/>
26+
<!-- Click the Registration Link -->
27+
<actionGroup ref="StorefrontClickHeaderLinkActionGroup" stepKey="ClickTheLink">
28+
<argument name="LinkName" value="Create an Account"/>
29+
</actionGroup>
30+
<!-- Fill Registration Form with Password length is bellow 8 Characters -->
31+
<actionGroup ref="StorefrontFillCustomerAccountCreationFormActionGroup" stepKey="FillRegistrationFormPasswordLengthBellowEightCharacters">
32+
<argument name="customer" value="Simple_Customer_With_Password_Length_Is_Below_Eight_Characters"/>
33+
</actionGroup>
34+
<!-- See the Error -->
35+
<actionGroup ref="AssertMessageCustomerCreateAccountPasswordComplexityActionGroup" stepKey="SeeTheErrorPasswordLength">
36+
<argument name="message" value="Minimum length of this field must be equal or greater than 8 symbols. Leading and trailing spaces will be ignored."/>
37+
</actionGroup>
38+
<!-- Fill Registration Form with not secure enough password -->
39+
<actionGroup ref="StorefrontFillCustomerAccountCreationFormActionGroup" stepKey="FillRegistrationFormPasswordNotSecure">
40+
<argument name="customer" value="Simple_Customer_With_Not_Secure_Password"/>
41+
</actionGroup>
42+
<!-- See the Error -->
43+
<actionGroup ref="AssertMessageCustomerCreateAccountPasswordComplexityActionGroup" stepKey="SeeTheErrorPasswordSecure">
44+
<argument name="message" value="Minimum of different classes of characters in password is 3. Classes of characters: Lower Case, Upper Case, Digits, Special Characters."/>
45+
</actionGroup>
46+
<!--Test Body END-->
47+
48+
</test>
49+
</tests>

dev/tests/functional/tests/app/Magento/Security/Test/TestCase/NewCustomerPasswordComplexityTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<data name="customer/data/password" xsi:type="string">123123</data>
1717
<data name="customer/data/password_confirmation" xsi:type="string">123123</data>
1818
<constraint name="Magento\Security\Test\Constraint\AssertPasswordLengthErrorMessage" />
19+
<data name="tag" xsi:type="string">mftf_migrated:yes</data>
1920
</variation>
2021
<variation name="PasswordComplexityTest" summary="Customer password is not secure enough">
2122
<data name="tag" xsi:type="string">severity:S1</data>
@@ -26,6 +27,7 @@
2627
<data name="customer/data/password" xsi:type="string">123123qa</data>
2728
<data name="customer/data/password_confirmation" xsi:type="string">123123qa</data>
2829
<constraint name="Magento\Security\Test\Constraint\AssertPasswordIsNotSecureEnoughMessage" />
30+
<data name="tag" xsi:type="string">mftf_migrated:yes</data>
2931
</variation>
3032
</testCase>
3133
</config>

0 commit comments

Comments
 (0)