Skip to content

Commit

Permalink
Merge branch 'mftf' into project_pepe
Browse files Browse the repository at this point in the history
  • Loading branch information
lfolco committed Sep 26, 2019
2 parents b16de6b + b195ca0 commit 1089987
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminCreateNewUserWithExpirationActionGroup">
<annotations>
<description>Goes to the Admin Users grid page. Clicks on Create User. Fills in the provided User with an expiration date and saves.</description>
</annotations>
<arguments>
<argument name="user" defaultValue="NewAdminUserWithValidExpiration"/>
</arguments>

<amOnPage url="{{AdminNewUserPage.url}}" stepKey="navigateToNewUser"/>
<waitForPageLoad stepKey="waitForUsersPage" />
<fillField selector="{{AdminNewUserFormSection.username}}" userInput="{{user.username}}" stepKey="enterUserName" />
<fillField selector="{{AdminNewUserFormSection.firstname}}" userInput="{{user.firstName}}" stepKey="enterFirstName" />
<fillField selector="{{AdminNewUserFormSection.lastname}}" userInput="{{user.lastName}}" stepKey="enterLastName" />
<fillField selector="{{AdminNewUserFormSection.email}}" userInput="{{user.username}}@magento.com" stepKey="enterEmail" />
<fillField selector="{{AdminNewUserFormSection.password}}" userInput="{{user.password}}" stepKey="enterPassword" />
<fillField selector="{{AdminNewUserFormSection.passwordConfirmation}}" userInput="{{user.password}}" stepKey="confirmPassword" />
<fillField selector="{{AdminNewUserFormSection.userExpiresField}}" userInput="{{user.expires_at}}" stepKey="enterUserExpiration" />
<fillField selector="{{AdminNewUserFormSection.currentPassword}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterCurrentPassword" />
<click selector="{{AdminNewUserFormSection.save}}" stepKey="clickSaveUser" />
<waitForPageLoad stepKey="waitForSaveTheUser" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminSaveUserInvalidExpirationActionGroup">
<annotations>
<description>Error message for saving an admin user with an invalid expiration date.</description>
</annotations>
<see selector="{{AdminMessagesSection.errorMessage}}" userInput='"Expiration date" must be later than the current date.' stepKey="seeErrorMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminSaveUserSuccessActionGroup">
<annotations>
<description>Success message for saving an admin user successfully.</description>
</annotations>
<see userInput="You saved the user." stepKey="seeSuccessMessage" />
</actionGroup>
</actionGroups>
34 changes: 34 additions & 0 deletions app/code/Magento/Security/Test/Mftf/Data/UserData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">

<entity name="NewAdminUserWithValidExpiration" type="user">
<data key="username" unique="suffix">adminExpiresAt</data>
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="email" unique="prefix">[email protected]</data>
<data key="password">123123q</data>
<data key="password_confirmation">123123q</data>
<data key="interface_local">en_US</data>
<data key="interface_local_label">English (United States)</data>
<data key="is_active">true</data>
<data key="is_active_label">Active</data>
<data key="current_password">{{_ENV.MAGENTO_ADMIN_PASSWORD}}</data>
<data key="role">Administrators</data>
<data key="expires_at">Sep 3, 2030 4:42:36 PM</data>
<array key="roles">
<item>1</item>
</array>
</entity>

<entity name="NewAdminUserWithInvalidExpiration" type="user" extends="NewAdminUserWithValidExpiration">
<data key="expires_at">Sep 3, 2000 4:42:36 PM</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminEditUserSection">
<element name="userExpiresField" type="input" selector="#user_expires_at"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminNewUserFormSection">
<element name="userExpiresField" type="input" selector="#page_tabs_main_section_content input[name='expires_at']"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminUserCreateNewUserWithInvalidExpirationTest">
<annotations>
<features value="Security"/>
<stories value="Create new user with invalid expiration date."/>
<title value="Create new user with invalid expiration date"/>
<description value="Create new user with invalid expiration date."/>
<testCaseId value="" />
<severity value="CRITICAL"/>
<group value="security_userexpiration"/>
</annotations>
<before>
<!-- Log in to Admin Panel -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>

<!-- Create new user with user expiration set -->
<actionGroup ref="AdminCreateNewUserWithExpirationActionGroup" stepKey="fillInNewUserWithInvalidExpiration">
<argument name="user" value="NewAdminUserWithInvalidExpiration" />
</actionGroup>

<actionGroup ref="AdminSaveUserInvalidExpirationActionGroup" stepKey="saveNewUserWithInvalidExpirationError" />
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminUserCreateNewUserWithValidExpirationTest">
<annotations>
<features value="Security"/>
<stories value="Create new user with valid expiration date."/>
<title value="Create new user with valid expiration date"/>
<description value="Create new user with valid expiration date."/>
<testCaseId value="" />
<severity value="CRITICAL"/>
<group value="security_userexpiration"/>
</annotations>
<before>
<!-- Log in to Admin Panel -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>

<!-- Create new user with user expiration set -->
<actionGroup ref="AdminCreateNewUserWithExpirationActionGroup" stepKey="fillInNewUserWithValidExpiration">
<argument name="user" value="NewAdminUserWithValidExpiration" />
</actionGroup>

<actionGroup ref="AdminSaveUserSuccessActionGroup" stepKey="saveNewUserWithValidExpirationSuccess" />
</test>
</tests>

0 comments on commit 1089987

Please sign in to comment.