Skip to content

Commit d49162c

Browse files
MAGETWO-91688: Exception when login as restricted admin with access only to CMS Block
- Resolved conflicts
2 parents 5498231 + cf78277 commit d49162c

17 files changed

+194
-272
lines changed

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: 36 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -17,87 +17,70 @@
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MAGETWO-93677"/>
1919
<group value="braintree"/>
20+
<skip>
21+
<issueId value="MQE-1187" />
22+
</skip>
2023
</annotations>
2124

22-
2325
<before>
2426
<!--Login As Admin-->
2527
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
26-
2728
<!--CreateNewProduct-->
28-
<createData entity="_defaultCategory" stepKey="createCategory"/>
29-
<createData entity="_defaultProduct" stepKey="createProduct">
30-
<requiredEntity createDataKey="createCategory"/>
31-
</createData>
32-
29+
<actionGroup ref="CreateNewProductActionGroup" stepKey="CreateNewProduct"/>
3330
<!--Create New Customer-->
34-
<createData stepKey="createCustomer" entity="Simple_US_Customer"/>
31+
<actionGroup ref="CreateCustomerActionGroup" stepKey="CreateCustomer"/>
3532
</before>
3633

37-
3834
<!--Configure Braintree-->
3935
<actionGroup ref="ConfigureBraintree" stepKey="configureBraintree"/>
4036

4137
<!--Create New Role-->
42-
<actionGroup ref="GoToUserRoles" stepKey="GoToUserRoles"/>
43-
<actionGroup ref="AdminCreateRole" stepKey="AdminCreateNewRole"/>
44-
45-
<!--Create New User With Specific Role-->
46-
<actionGroup ref="GoToAllUsers" stepKey="GoToAllUsers"/>
47-
<actionGroup ref="AdminCreateUserAction" stepKey="AdminCreateNewUser"/>
48-
49-
<!--SignOut-->
50-
<actionGroup ref="logout" stepKey="signOutFromAdmin"/>
51-
52-
<!--SignIn New User-->
53-
<actionGroup ref="LoginNewUser" stepKey="signInNewUser"/>
54-
<waitForPageLoad stepKey="waitForLogin" time="3"/>
55-
56-
<!--Create New Order-->
57-
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrder">
58-
<argument name="customer" value="Simple_US_Customer"/>
38+
<actionGroup ref="AdminCreateRoleActionGroup" stepKey="adminCreateRole">
39+
<argument name="restrictedRole" value="Sales"/>
40+
<argument name="User" value="adminRole"/>
5941
</actionGroup>
6042

61-
<actionGroup ref="addSimpleProductToOrder" stepKey="addProduct">
62-
<argument name="product" value="_defaultProduct"/>
43+
<!--Create new admin user-->
44+
<actionGroup ref="AdminCreateUserActionGroup" stepKey="adminCreateUser">
45+
<argument name="role" value="adminRole"/>
6346
</actionGroup>
6447

65-
<actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress">
66-
<argument name="customer" value="Simple_US_Customer"/>
67-
<argument name="address" value="US_Address_TX"/>
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}}"/>
6854
</actionGroup>
6955

70-
<actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping"/>
71-
72-
<waitForPageLoad stepKey="waitForShippingToFinish"/>
73-
74-
<actionGroup ref="useBraintreeForMasterCard" stepKey="selectCardWithBraintree"/>
75-
76-
<click stepKey="submitOrder" selector="{{NewOrderSection.submitOrder}}"/>
77-
<waitForPageLoad stepKey="waitForSaveConfig" time="5"/>
78-
<waitForElementVisible selector="{{NewOrderSection.successMessage}}" stepKey="waitForSuccessMessage" time="1"/>
56+
<!--Create New Order-->
57+
<actionGroup ref="CreateNewOrderActionGroup" stepKey="createNewOrder"/>
7958

8059
<after>
81-
<!-- Disable BrainTree -->
82-
<actionGroup ref="DisableBrainTree" stepKey="disableBrainTree"/>
83-
8460
<!--SignOut-->
8561
<actionGroup ref="SignOut" stepKey="signOutFromNewUser"/>
8662
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
8763

8864
<!--Delete Product-->
89-
<deleteData stepKey="deleteProduct" createDataKey="createProduct"/>
65+
<actionGroup ref="DeleteProductActionGroup" stepKey="DeleteAllProducts">
66+
<argument name="productName" value="NewProductData.ProductName"/>
67+
</actionGroup>
9068

9169
<!--Delete Customer-->
92-
<deleteData stepKey="deleteCustomer" createDataKey="createCustomer"/>
93-
94-
<!--Delete User -->
95-
<actionGroup ref="GoToAllUsers" stepKey="GoBackToAllUsers"/>
96-
<actionGroup ref="AdminDeleteUserActionGroup" stepKey="AdminDeleteUserActionGroup"/>
97-
98-
<!--Delete Role-->
99-
<actionGroup ref="GoToUserRoles" stepKey="GoBackToUserRoles"/>
100-
<actionGroup ref="AdminDeleteRoleActionGroup" stepKey="AdminDeleteRoleActionGroup"/>
70+
<actionGroup ref="DeleteCustomerActionGroup" stepKey="DeleteCustomer">
71+
<argument name="lastName" value="NewCustomerData.LastName"/>
72+
</actionGroup>
73+
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"/>
10184
</after>
10285
</test>
10386
</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>

app/code/Magento/Cms/Ui/Component/DataProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ public function prepareMetadata()
9595
'config' => [
9696
'editorConfig' => [
9797
'enabled' => false
98-
]
98+
],
99+
'componentType' => \Magento\Ui\Component\Container::NAME
99100
]
100101
]
101102
]
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>

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,24 @@
1010
<actionGroup name="AdminCreateUserActionGroup">
1111
<arguments>
1212
<argument name="role"/>
13-
<argument name="User" defaultValue="admin2"/>
13+
<argument name="User" defaultValue="newAdmin"/>
1414
</arguments>
15-
<amOnPage url="{{AdminEditUserPage.url}}" stepKey="navigateToNewUser"/>
16-
<waitForPageLoad stepKey="waitForPageLoad1" />
17-
<fillField selector="{{AdminEditUserSection.usernameTextField}}" userInput="{{admin2.username}}" stepKey="enterUserName" />
18-
<fillField selector="{{AdminEditUserSection.firstNameTextField}}" userInput="{{admin2.firstName}}" stepKey="enterFirstName" />
19-
<fillField selector="{{AdminEditUserSection.lastNameTextField}}" userInput="{{admin2.lastName}}" stepKey="enterLastName" />
20-
<fillField selector="{{AdminEditUserSection.emailTextField}}" userInput="{{admin2.username}}@magento.com" stepKey="enterEmail" />
21-
<fillField selector="{{AdminEditUserSection.passwordTextField}}" userInput="{{admin2.password}}" stepKey="enterPassword" />
22-
<fillField selector="{{AdminEditUserSection.pwConfirmationTextField}}" userInput="{{admin2.password}}" stepKey="confirmPassword" />
15+
<amOnPage url="{{AdminUsersPage.url}}" stepKey="amOnAdminUsersPage"/>
16+
<waitForPageLoad stepKey="waitForAdminUserPageLoad"/>
17+
<click selector="{{AdminCreateUserSection.create}}" stepKey="clickToCreateNewUser"/>
18+
<fillField selector="{{AdminEditUserSection.usernameTextField}}" userInput="{{newAdmin.username}}" stepKey="enterUserName" />
19+
<fillField selector="{{AdminEditUserSection.firstNameTextField}}" userInput="{{newAdmin.firstName}}" stepKey="enterFirstName" />
20+
<fillField selector="{{AdminEditUserSection.lastNameTextField}}" userInput="{{newAdmin.lastName}}" stepKey="enterLastName" />
21+
<fillField selector="{{AdminEditUserSection.emailTextField}}" userInput="{{newAdmin.username}}@magento.com" stepKey="enterEmail" />
22+
<fillField selector="{{AdminEditUserSection.passwordTextField}}" userInput="{{newAdmin.password}}" stepKey="enterPassword" />
23+
<fillField selector="{{AdminEditUserSection.pwConfirmationTextField}}" userInput="{{newAdmin.password}}" stepKey="confirmPassword" />
2324
<fillField selector="{{AdminEditUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterCurrentPassword" />
2425
<scrollToTopOfPage stepKey="scrollToTopOfPage" />
2526
<click selector="{{AdminEditUserSection.userRoleTab}}" stepKey="clickUserRole" />
26-
<fillField selector="{{AdminEditUserRoleSection.roleNameFilterTextField}}" userInput="{{role.name}}" stepKey="filterRole" />
27-
<click selector="{{AdminEditUserRoleSection.searchButton}}" stepKey="clickSearch" />
27+
<fillField selector="{{AdminEditUserSection.roleNameFilterTextField}}" userInput="{{role.name}}" stepKey="filterRole" />
28+
<click selector="{{AdminEditUserSection.searchButton}}" stepKey="clickSearch" />
2829
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear1"/>
29-
<click selector="{{AdminEditUserRoleSection.searchResultFirstRow}}" stepKey="selectRole" />
30+
<click selector="{{AdminEditUserSection.searchResultFirstRow}}" stepKey="selectRole" />
3031
<click selector="{{AdminEditUserSection.saveButton}}" stepKey="clickSaveUser" />
3132
<waitForPageLoad stepKey="waitForPageLoad2" />
3233
<see userInput="You saved the user." stepKey="seeSuccessMessage" />

0 commit comments

Comments
 (0)