Skip to content

Commit e48908d

Browse files
committed
Merge branch 'issue-310-update-admin-user-entity-test' of https://github.com/kate-kyzyma/magento-functional-tests-migration into 2.3-develop
2 parents 0b1d950 + 3548cd0 commit e48908d

File tree

7 files changed

+157
-1
lines changed

7 files changed

+157
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="AssertAdminUserIsInGridActionGroup">
12+
<arguments>
13+
<argument name="user" type="entity"/>
14+
</arguments>
15+
<click selector="{{AdminUserGridSection.resetButton}}" stepKey="resetGridFilter"/>
16+
<waitForPageLoad stepKey="waitForFiltersReset" time="15"/>
17+
<fillField selector="{{AdminUserGridSection.usernameFilterTextField}}" userInput="{{user.username}}" stepKey="enterUserName"/>
18+
<click selector="{{AdminUserGridSection.searchButton}}" stepKey="clickSearch"/>
19+
<waitForPageLoad stepKey="waitForGridToLoad" time="15"/>
20+
<see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{user.username}}" stepKey="seeUser"/>
21+
</actionGroup>
22+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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="AssertUserRoleRestrictedAccessActionGroup">
12+
<see selector="{{AdminHeaderSection.pageHeading}}" userInput="Sorry, you need permissions to view this content." stepKey="seeErrorMessage"/>
13+
</actionGroup>
14+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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="AdminOpenAdminUsersPageActionGroup">
11+
<amOnPage url="{{AdminUsersPage.url}}" stepKey="navigateToAdminUsersGrid"/>
12+
<waitForPageLoad stepKey="waitForAdminUsersPageLoad"/>
13+
</actionGroup>
14+
</actionGroups>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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="AdminUpdateUserRoleActionGroup">
11+
<arguments>
12+
<argument name="role" type="entity"/>
13+
</arguments>
14+
<fillField selector="{{AdminEditUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterThePassword"/>
15+
<scrollToTopOfPage stepKey="scrollToTop"/>
16+
<waitForPageLoad stepKey="waitForPageScrollToTop" time="15"/>
17+
<click selector="{{AdminNewUserFormSection.userRoleTab}}" stepKey="openUserRoleTab"/>
18+
<waitForPageLoad stepKey="waitForUserRoleTabOpened" />
19+
<click selector="{{AdminNewUserFormSection.resetFilter}}" stepKey="resetGridFilter"/>
20+
<waitForPageLoad stepKey="waitForFiltersReset"/>
21+
<fillField selector="{{AdminNewUserFormSection.roleFilterField}}" userInput="{{role.name}}" stepKey="fillRoleFilterField"/>
22+
<click selector="{{AdminNewUserFormSection.search}}" stepKey="clickSearchButton"/>
23+
<waitForPageLoad stepKey="waitForFiltersApplied"/>
24+
<checkOption selector="{{AdminNewUserFormSection.roleRadiobutton(role.name)}}" stepKey="assignRole"/>
25+
</actionGroup>
26+
</actionGroups>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminDeleteRoleSection">
1212
<element name="theRole" selector="//td[contains(text(), 'Role')]" type="button"/>
13+
<element name="salesRole" selector="//td[contains(text(), 'Sales')]" type="button"/>
1314
<element name="current_pass" type="button" selector="#current_password"/>
1415
<element name="delete" selector="//button/span[contains(text(), 'Delete Role')]" type="button"/>
1516
<element name="confirm" selector="//*[@class='action-primary action-accept']" type="button"/>
1617
</section>
1718
</sections>
19+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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="AdminUpdateUserRoleTest">
12+
<annotations>
13+
<features value="User"/>
14+
<title value="Admin user role update"/>
15+
<description value="Change full access role for admin user to custom one with restricted permission (Sales)"/>
16+
<group value="user"/>
17+
<group value="mtf_migrated"/>
18+
</annotations>
19+
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="logIn"/>
22+
</before>
23+
<after>
24+
<actionGroup ref="logout" stepKey="logOut"/>
25+
</after>
26+
27+
<!--Create New User-->
28+
<actionGroup ref="AdminOpenNewUserPageActionGroup" stepKey="goToNewUserPage"/>
29+
<actionGroup ref="AdminFillNewUserFormRequiredFieldsActionGroup" stepKey="fillNewUserForm">
30+
<argument name="user" value="NewAdminUser"/>
31+
</actionGroup>
32+
<actionGroup ref="AdminClickSaveButtonOnUserFormActionGroup" stepKey="saveNewUser"/>
33+
34+
<!--Create New Role-->
35+
<actionGroup ref="AdminOpenCreateRolePageActionGroup" stepKey="goToNewRolePage"/>
36+
<actionGroup ref="AdminFillUserRoleFormActionGroup" stepKey="fillNewRoleForm">
37+
<argument name="role" value="salesRole"/>
38+
</actionGroup>
39+
<actionGroup ref="AdminClickSaveButtonOnUserRoleFormActionGroup" stepKey="saveNewRole"/>
40+
41+
<!--Assign new role-->
42+
<actionGroup ref="AdminOpenUserEditPageActionGroup" stepKey="openUserEditPage">
43+
<argument name="user" value="NewAdminUser"/>
44+
</actionGroup>
45+
46+
<actionGroup ref="AdminUpdateUserRoleActionGroup" stepKey="assignNewUserRole">
47+
<argument name="role" value="salesRole"/>
48+
</actionGroup>
49+
<actionGroup ref="AdminClickSaveButtonOnUserFormActionGroup" stepKey="saveUser"/>
50+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage">
51+
<argument name="message" value="You saved the user."/>
52+
</actionGroup>
53+
54+
<actionGroup ref="AssertAdminUserIsInGridActionGroup" stepKey="seeUserInGrid">
55+
<argument name="user" value="NewAdminUser"/>
56+
</actionGroup>
57+
<actionGroup ref="logout" stepKey="logOutFromAdminPanel"/>
58+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsSaleRoleUser">
59+
<argument name="adminUser" value="NewAdminUser"/>
60+
</actionGroup>
61+
<actionGroup ref="AssertAdminSuccessLoginActionGroup" stepKey="seeSuccessloginMessage"/>
62+
<actionGroup ref="AdminOpenAdminUsersPageActionGroup" stepKey="navigateToAdminUsersPage"/>
63+
<actionGroup ref="AssertUserRoleRestrictedAccessActionGroup" stepKey="seeErrorMessage"/>
64+
65+
<!--Delete new User-->
66+
<actionGroup ref="logout" stepKey="logoutAsSaleRoleUser"/>
67+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsDefaultAdminUser"/>
68+
<actionGroup ref="AdminDeleteCustomUserActionGroup" stepKey="deleteNewUser">
69+
<argument name="user" value="NewAdminUser"/>
70+
</actionGroup>
71+
72+
<!--Delete new Role-->
73+
<actionGroup ref="AdminDeleteUserRoleActionGroup" stepKey="deleteCustomRole">
74+
<argument name="roleName" value="{{salesRole.name}}"/>
75+
</actionGroup>
76+
77+
</test>
78+
</tests>

dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
99
<testCase name="Magento\User\Test\TestCase\UpdateAdminUserEntityTest" summary="Update Admin User" ticketId="MAGETWO-24345">
1010
<variation name="UpdateAdminUserEntityTestVariation2">
11-
<data name="tag" xsi:type="string">severity:S3</data>
11+
<data name="tag" xsi:type="string">severity:S3, mftf_migrated:yes</data>
1212
<data name="initialUser/dataset" xsi:type="string">custom_admin_with_default_role</data>
1313
<data name="user/data/role_id/dataset" xsi:type="string">role::role_sales</data>
1414
<data name="user/data/current_password" xsi:type="string">123123q</data>

0 commit comments

Comments
 (0)