Skip to content

Commit cf78277

Browse files
MAGETWO-91688: Exception when login as restricted admin with access only to CMS Block
- Add automated test
1 parent 5367bde commit cf78277

16 files changed

+197
-235
lines changed

app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminRoleActionGroup.xml

Lines changed: 0 additions & 51 deletions
This file was deleted.

app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminUserActionGroup.xml

Lines changed: 0 additions & 56 deletions
This file was deleted.

app/code/Magento/Braintree/Test/Mftf/Section/AdminCreateRoleSection.xml

Lines changed: 0 additions & 24 deletions
This file was deleted.

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

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/code/Magento/Braintree/Test/Mftf/Section/AdminDeleteUserSection.xml

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/code/Magento/Braintree/Test/Mftf/Section/AdminRoleGridSection.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/code/Magento/Braintree/Test/Mftf/Section/AdminUserGridSection.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,42 +22,40 @@
2222
</skip>
2323
</annotations>
2424

25-
2625
<before>
2726
<!--Login As Admin-->
2827
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
29-
3028
<!--CreateNewProduct-->
3129
<actionGroup ref="CreateNewProductActionGroup" stepKey="CreateNewProduct"/>
32-
3330
<!--Create New Customer-->
3431
<actionGroup ref="CreateCustomerActionGroup" stepKey="CreateCustomer"/>
35-
3632
</before>
3733

38-
3934
<!--Configure Braintree-->
4035
<actionGroup ref="ConfigureBraintree" stepKey="configureBraintree"/>
4136

4237
<!--Create New Role-->
43-
<actionGroup ref="GoToUserRoles" stepKey="GoToUserRoles"/>
44-
<actionGroup ref="AdminCreateRole" stepKey="AdminCreateNewRole"/>
45-
46-
<!--Create New User With Specific Role-->
47-
<actionGroup ref="GoToAllUsers" stepKey="GoToAllUsers"/>
48-
<actionGroup ref="AdminCreateUserAction" stepKey="AdminCreateNewUser"/>
49-
50-
<!--SignOut-->
51-
<actionGroup ref="SignOut" stepKey="signOutFromAdmin"/>
52-
53-
<!--SignIn New User-->
54-
<actionGroup ref="LoginNewUser" stepKey="signInNewUser"/>
55-
<waitForPageLoad stepKey="waitForLogin" time="3"/>
38+
<actionGroup ref="AdminCreateRoleActionGroup" stepKey="adminCreateRole">
39+
<argument name="restrictedRole" value="Sales"/>
40+
<argument name="User" value="adminRole"/>
41+
</actionGroup>
42+
43+
<!--Create new admin user-->
44+
<actionGroup ref="AdminCreateUserActionGroup" stepKey="adminCreateUser">
45+
<argument name="role" value="adminRole"/>
46+
</actionGroup>
47+
48+
<!--Log out-->
49+
<actionGroup ref="SignOut" stepKey="SignOut"/>
50+
<!--Log in as new user-->
51+
<actionGroup ref="LoginAsAnyUser" stepKey="LoginActionGroup">
52+
<argument name="uname" value="{{newAdmin.username}}"/>
53+
<argument name="passwd" value="{{newAdmin.password}}"/>
54+
</actionGroup>
5655

5756
<!--Create New Order-->
5857
<actionGroup ref="CreateNewOrderActionGroup" stepKey="createNewOrder"/>
5958

60-
6159
<after>
6260
<!--SignOut-->
6361
<actionGroup ref="SignOut" stepKey="signOutFromNewUser"/>
@@ -73,15 +71,16 @@
7371
<argument name="lastName" value="NewCustomerData.LastName"/>
7472
</actionGroup>
7573

76-
<!--Delete User -->
77-
<actionGroup ref="GoToAllUsers" stepKey="GoBackToAllUsers"/>
78-
<actionGroup ref="AdminDeleteUserActionGroup" stepKey="AdminDeleteUserActionGroup"/>
79-
80-
<!--Delete Role-->
81-
<actionGroup ref="GoToUserRoles" stepKey="GoBackToUserRoles"/>
82-
<actionGroup ref="AdminDeleteRoleActionGroup" stepKey="AdminDeleteRoleActionGroup"/>
83-
74+
<!--Delete created user-->
75+
<actionGroup ref="DeleteCreatedUserActionGroup" stepKey="AdminDeleteUserActionGroup">
76+
<argument name="user" value="adminRole"/>
77+
</actionGroup>
78+
<!--Delete created role-->
79+
<actionGroup ref="AdminDeleteCreatedRoleActionGroup" stepKey="AdminDeleteRoleActionGroup">
80+
<argument name="role" value="adminRole"/>
81+
</actionGroup>
82+
<!--Log Out-->
83+
<actionGroup ref="logout" stepKey="logOut2"/>
8484
</after>
85-
8685
</test>
8786
</tests>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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="AdminRestrictedUserOnlyAccessCmsBlockTest">
12+
<annotations>
13+
<features value="Cms"/>
14+
<stories value="MAGETWO-91688: Exception when login as restricted admin with access only to CMS Block"/>
15+
<title value="Check: restricted admin with access only to CMS Block"/>
16+
<description value="Check that the system shows information only in Blocks"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-94804"/>
19+
<group value="Cms"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="LoginAsAdmin" stepKey="logIn"/>
23+
</before>
24+
25+
<!--Create restricted roles for this user. Access to Content->Blocks only-->
26+
<actionGroup ref="AdminCreateRoleActionGroup" stepKey="adminCreateRole">
27+
<argument name="restrictedRole" value="Blocks"/>
28+
<argument name="User" value="adminRole"/>
29+
</actionGroup>
30+
31+
<!--Create new admin user-->
32+
<actionGroup ref="AdminCreateUserActionGroup" stepKey="adminCreateUser">
33+
<argument name="role" value="adminRole"/>
34+
</actionGroup>
35+
36+
<!--Log out-->
37+
<actionGroup ref="SignOut" stepKey="SignOut"/>
38+
<!--Log in as new user-->
39+
<actionGroup ref="LoginAsAnyUser" stepKey="LoginActionGroup">
40+
<argument name="uname" value="{{newAdmin.username}}"/>
41+
<argument name="passwd" value="{{newAdmin.password}}"/>
42+
</actionGroup>
43+
44+
<!--Verify that The system shows information included in "Blocks"-->
45+
<see stepKey="seeBlocksPage" userInput="Blocks"/>
46+
<seeInCurrentUrl url="{{CmsBlocksPage.url}}" stepKey="assertUrl"/>
47+
48+
<!--Log Out-->
49+
<actionGroup ref="logout" stepKey="logOut1"/>
50+
51+
<after>
52+
<!--Login as Admin-->
53+
<actionGroup ref="LoginAsAdmin" stepKey="logInForDeletingCreatedData"/>
54+
<!--Delete created user-->
55+
<actionGroup ref="DeleteCreatedUserActionGroup" stepKey="AdminDeleteUserActionGroup">
56+
<argument name="user" value="adminRole"/>
57+
</actionGroup>
58+
<!--Delete created role-->
59+
<actionGroup ref="AdminDeleteCreatedRoleActionGroup" stepKey="AdminDeleteRoleActionGroup">
60+
<argument name="role" value="adminRole"/>
61+
</actionGroup>
62+
<!--Log Out-->
63+
<actionGroup ref="logout" stepKey="logOut2"/>
64+
</after>
65+
</test>
66+
</tests>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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="AdminCreateRoleActionGroup">
11+
<arguments>
12+
<argument name="restrictedRole"/>
13+
<argument name="User"/>
14+
</arguments>
15+
<amOnPage url="{{AdminEditRolePage.url}}" stepKey="navigateToNewRole"/>
16+
<waitForPageLoad stepKey="waitForPageLoad1"/>
17+
<fillField selector="{{AdminEditRoleInfoSection.roleName}}" userInput="{{User.name}}" stepKey="fillRoleName" />
18+
<fillField selector="{{AdminEditRoleInfoSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterPassword" />
19+
<click selector="{{AdminEditRoleInfoSection.roleResourcesTab}}" stepKey="clickRoleResourcesTab" />
20+
<waitForElementVisible selector="{{AdminEditRoleResourcesSection.roleScopes}}" stepKey="waitForScopeSelection" />
21+
<selectOption selector="{{AdminEditRoleResourcesSection.resourceAccess}}" userInput="0" stepKey="selectResourceAccessCustom"/>
22+
<waitForElementVisible stepKey="waitForElementVisible" selector="{{AdminEditRoleInfoSection.blockName('restrictedRole')}}" time="30"/>
23+
<click stepKey="clickContentBlockCheckbox" selector="{{AdminEditRoleInfoSection.blockName('restrictedRole')}}"/>
24+
<click selector="{{AdminEditRoleInfoSection.saveButton}}" stepKey="clickSaveRoleButton" />
25+
<waitForPageLoad stepKey="waitForPageLoad2" />
26+
</actionGroup>
27+
</actionGroups>

0 commit comments

Comments
 (0)