Skip to content

Commit d32285c

Browse files
committed
Issue-709. Convert CreateAdminUserEntityTest to MFTF
1 parent cfa198b commit d32285c

File tree

5 files changed

+140
-2
lines changed

5 files changed

+140
-2
lines changed

app/code/Magento/User/Test/Mftf/ActionGroup/AdminCreateUserActionGroup.xml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
<!--Create new user with role-->
3737
<actionGroup name="AdminCreateUserWithRoleActionGroup">
3838
<arguments>
39-
<argument name="role"/>
4039
<argument name="user" defaultValue="newAdmin"/>
4140
</arguments>
4241
<amOnPage url="{{AdminNewUserPage.url}}" stepKey="navigateToNewUser"/>
@@ -50,9 +49,32 @@
5049
<fillField selector="{{AdminCreateUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterCurrentPassword" />
5150
<scrollToTopOfPage stepKey="scrollToTopOfPage" />
5251
<click stepKey="clickUserRole" selector="{{AdminCreateUserSection.userRoleTab}}"/>
53-
<click stepKey="chooseRole" selector="{{AdminStoreSection.createdRoleInUserPage(role.name)}}"/>
52+
<checkOption selector="{{AdminNewUserFormSection.roleRadiobutton(user.role)}}" stepKey="assignRole"/>
5453
<click selector="{{AdminCreateUserSection.saveButton}}" stepKey="clickSaveUser" />
5554
<waitForPageLoad stepKey="waitForSaveTheUser" />
5655
<see userInput="You saved the user." stepKey="seeSuccessMessage" />
5756
</actionGroup>
57+
58+
<!--Create new user with role and active/inactive setting-->
59+
<actionGroup name="AdminCreateUserWithRoleAndIsActiveActionGroup">
60+
<arguments>
61+
<argument name="user" defaultValue="newAdmin"/>
62+
</arguments>
63+
<amOnPage url="{{AdminNewUserPage.url}}" stepKey="navigateToNewUser"/>
64+
<waitForPageLoad stepKey="waitForUsersPage" />
65+
<fillField selector="{{AdminNewUserFormSection.username}}" userInput="{{user.username}}" stepKey="enterUserName" />
66+
<fillField selector="{{AdminNewUserFormSection.firstname}}" userInput="{{user.firstName}}" stepKey="enterFirstName" />
67+
<fillField selector="{{AdminNewUserFormSection.lastname}}" userInput="{{user.lastName}}" stepKey="enterLastName" />
68+
<fillField selector="{{AdminNewUserFormSection.email}}" userInput="{{user.username}}@magento.com" stepKey="enterEmail" />
69+
<fillField selector="{{AdminNewUserFormSection.password}}" userInput="{{user.password}}" stepKey="enterPassword" />
70+
<fillField selector="{{AdminNewUserFormSection.passwordConfirmation}}" userInput="{{user.password}}" stepKey="confirmPassword" />
71+
<checkOption selector="{{AdminNewUserFormSection.userIsActive(user.is_active)}}" stepKey="checkIsActive" />
72+
<fillField selector="{{AdminNewUserFormSection.currentPassword}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterCurrentPassword" />
73+
<scrollToTopOfPage stepKey="scrollToTopOfPage" />
74+
<click stepKey="clickUserRole" selector="{{AdminNewUserFormSection.userRoleTab}}"/>
75+
<checkOption selector="{{AdminNewUserFormSection.roleRadiobutton(user.role)}}" stepKey="assignRole"/>
76+
<click selector="{{AdminNewUserFormSection.save}}" stepKey="clickSaveUser" />
77+
<waitForPageLoad stepKey="waitForSaveTheUser" />
78+
<see userInput="You saved the user." stepKey="seeSuccessMessage" />
79+
</actionGroup>
5880
</actionGroups>

app/code/Magento/User/Test/Mftf/Data/UserData.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,36 @@
7474
<item>1</item>
7575
</array>
7676
</entity>
77+
<entity name="activeAdmin" type="user">
78+
<data key="username" unique="suffix">AdminUser</data>
79+
<data key="firstname" unique="suffix">FirstName</data>
80+
<data key="lastname" unique="suffix">LastName</data>
81+
<data key="email" unique="prefix">admin@example.com</data>
82+
<data key="password">123123q</data>
83+
<data key="password_confirmation">123123q</data>
84+
<data key="interface_local">en_US</data>
85+
<data key="interface_local_label">English (United States)</data>
86+
<data key="is_active">1</data>
87+
<data key="current_password">{{_ENV.MAGENTO_ADMIN_PASSWORD}}</data>
88+
<data key="role">Administrators</data>
89+
<array key="roles">
90+
<item>1</item>
91+
</array>
92+
</entity>
93+
<entity name="inactiveAdmin" type="user">
94+
<data key="username" unique="suffix">AdminUser</data>
95+
<data key="firstname" unique="suffix">FirstName</data>
96+
<data key="lastname" unique="suffix">LastName</data>
97+
<data key="email" unique="prefix">admin@example.com</data>
98+
<data key="password">123123q</data>
99+
<data key="password_confirmation">123123q</data>
100+
<data key="interface_local">en_US</data>
101+
<data key="interface_local_label">English (United States)</data>
102+
<data key="is_active">0</data>
103+
<data key="current_password">{{_ENV.MAGENTO_ADMIN_PASSWORD}}</data>
104+
<data key="role">Administrators</data>
105+
<array key="roles">
106+
<item>1</item>
107+
</array>
108+
</entity>
77109
</entities>

app/code/Magento/User/Test/Mftf/Section/AdminNewUserFormSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<element name="password" type="input" selector="#page_tabs_main_section_content input[name='password']"/>
2020
<element name="passwordConfirmation" type="input" selector="#page_tabs_main_section_content input[name='password_confirmation']"/>
2121
<element name="interfaceLocale" type="select" selector="#page_tabs_main_section_content select[name='interface_locale']"/>
22+
<element name="userIsActive" type="select" selector="#page_tabs_main_section_content select[id='user_is_active'] > option[value='{{var}}']" parameterized="true"/>
2223
<element name="currentPassword" type="input" selector="#page_tabs_main_section_content input[name='current_password']"/>
2324

2425
<element name="userRoleTab" type="button" selector="#page_tabs_roles_section"/>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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="AdminCreateActiveUserEntityTest">
12+
<annotations>
13+
<features value="User"/>
14+
<stories value="Create Admin User"/>
15+
<title value="Admin user should be able to create active admin user"/>
16+
<description value="Admin user should be able to create active admin user"/>
17+
<testCaseId value=""/>
18+
<severity value="CRITICAL"/>
19+
<group value="user"/>
20+
<group value="mtf_migrated"/>
21+
</annotations>
22+
<before>
23+
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
24+
</before>
25+
26+
<actionGroup ref="AdminCreateUserWithRoleAndIsActiveActionGroup" stepKey="createAdminUser">
27+
<argument name="user" value="activeAdmin"/>
28+
</actionGroup>
29+
<actionGroup ref="logout" stepKey="logoutMasterAdmin"/>
30+
<amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin"/>
31+
<fillField selector="{{AdminLoginFormSection.username}}" userInput="{{activeAdmin.username}}" stepKey="fillUsername"/>
32+
<fillField selector="{{AdminLoginFormSection.password}}" userInput="{{activeAdmin.password}}" stepKey="fillPassword"/>
33+
<click selector="{{AdminLoginFormSection.signIn}}" stepKey="clickLogin"/>
34+
<closeAdminNotification stepKey="closeAdminNotification"/>
35+
<amOnPage url="{{AdminUsersPage.url}}" stepKey="navigateToAdminUsersGrid"/>
36+
<fillField selector="{{AdminUserGridSection.usernameFilterTextField}}" userInput="{{activeAdmin.username}}" stepKey="fillUsernameSearch"/>
37+
<click selector="{{AdminUserGridSection.searchButton}}" stepKey="clickSearchButton"/>
38+
<waitForPageLoad time="10" stepKey="wait1"/>
39+
<see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{activeAdmin.username}}" stepKey="seeFoundUsername"/>
40+
<actionGroup ref="logout" stepKey="logoutCreatedUser"/>
41+
</test>
42+
</tests>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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="AdminCreateInactiveUserEntityTest">
12+
<annotations>
13+
<features value="User"/>
14+
<stories value="Create Admin User"/>
15+
<title value="Admin user should be able to create inactive admin user"/>
16+
<description value="Admin user should be able to create inactive admin user"/>
17+
<testCaseId value=""/>
18+
<severity value="CRITICAL"/>
19+
<group value="user"/>
20+
<group value="mtf_migrated"/>
21+
</annotations>
22+
<before>
23+
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
24+
</before>
25+
26+
<actionGroup ref="AdminCreateUserWithRoleAndIsActiveActionGroup" stepKey="createAdminUser">
27+
<argument name="user" value="inactiveAdmin"/>
28+
</actionGroup>
29+
<amOnPage url="{{AdminUsersPage.url}}" stepKey="navigateToAdminUsersGrid"/>
30+
<fillField selector="{{AdminUserGridSection.usernameFilterTextField}}" userInput="{{inactiveAdmin.username}}" stepKey="fillUsernameSearch"/>
31+
<click selector="{{AdminUserGridSection.searchButton}}" stepKey="clickSearchButton"/>
32+
<waitForPageLoad time="10" stepKey="wait1"/>
33+
<see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{inactiveAdmin.username}}" stepKey="seeFoundUsername"/>
34+
<actionGroup ref="logout" stepKey="logoutMasterAdmin"/>
35+
<amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin"/>
36+
<fillField selector="{{AdminLoginFormSection.username}}" userInput="{{inactiveAdmin.username}}" stepKey="fillUsername"/>
37+
<fillField selector="{{AdminLoginFormSection.password}}" userInput="{{inactiveAdmin.password}}" stepKey="fillPassword"/>
38+
<click selector="{{AdminLoginFormSection.signIn}}" stepKey="clickLogin"/>
39+
<actionGroup ref="AssertMessageOnAdminLoginActionGroup" stepKey="seeUserErrorMessage" />
40+
</test>
41+
</tests>

0 commit comments

Comments
 (0)