Skip to content

Commit 7730f6e

Browse files
Merge branch 'ACQE-4860_1' into ACQE-6392
2 parents d1d9b50 + 82fc1f1 commit 7730f6e

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed
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="AdminSelectCustomStockUserRoleResourcesActionGroup">
11+
<annotations>
12+
<description>Goes to the Backend Custom User role page. Selecting required elements on roles resource page.</description>
13+
</annotations>
14+
15+
<scrollTo selector="{{AdminEditRoleResourcesSection.inventoryCheckbox}}" stepKey="scrollToInventoryCheckBox"/>
16+
<waitForElementClickable selector="{{AdminEditRoleResourcesSection.stockCheckbox}}" stepKey="waitForStockToBeClickable"/>
17+
<click selector="{{AdminEditRoleResourcesSection.stockCheckbox}}" stepKey="selectStock"/>
18+
<waitForElementClickable selector="{{AdminEditRoleResourcesSection.editStockCheckbox}}" stepKey="waitForEditStockToBeClickable"/>
19+
<click selector="{{AdminEditRoleResourcesSection.editStockCheckbox}}" stepKey="uncheckEditStock"/>
20+
<waitForElementClickable selector="{{AdminEditRoleResourcesSection.deleteStockCheckbox}}" stepKey="waitForDeleteStockToBeClickable"/>
21+
<click selector="{{AdminEditRoleResourcesSection.deleteStockCheckbox}}" stepKey="uncheckDeleteStock"/>
22+
<scrollTo selector="{{AdminEditRoleResourcesSection.twoFactorAuth}}" stepKey="scrollToTwoFactor"/>
23+
<waitForElementClickable selector="{{AdminEditRoleResourcesSection.twoFactorAuth}}" stepKey="waitForTwoFactorToBeClickable"/>
24+
<click selector="{{AdminEditRoleResourcesSection.twoFactorAuth}}" stepKey="checkTwoFactorCheckbox"/>
25+
</actionGroup>
26+
</actionGroups>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@
1414
<element name="resourceCheckboxLink" type="checkbox" selector="//li[@data-id='{{resourceId}}']//a[text()='{{resourceName}}']" timeout="30" parameterized="true"/>
1515
<element name="resourceCheckbox" type="checkbox" selector="//li[@data-id='{{resourceId}}']/a[@aria-selected='true']" timeout="30" parameterized="true"/>
1616
<element name="userRoles" type="text" selector="//span[contains(text(), 'User Roles')]"/>
17+
<element name="inventoryCheckbox" type="checkbox" selector="//li[@id='Magento_InventoryApi::inventory']/i"/>
18+
<element name="stockCheckbox" type="checkbox" selector="//a[@id='Magento_InventoryApi::stock_anchor']/i[@class='jstree-icon jstree-checkbox']"/>
19+
<element name="editStockCheckbox" type="checkbox" selector="//a[@id='Magento_InventoryApi::stock_edit_anchor']/i[@class='jstree-icon jstree-checkbox']"/>
20+
<element name="deleteStockCheckbox" type="checkbox" selector="//a[@id='Magento_InventoryApi::stock_delete_anchor']/i[@class='jstree-icon jstree-checkbox']"/>
21+
<element name="twoFactorAuth" type="checkbox" selector="//a[@id='Magento_TwoFactorAuth::tfa_anchor']/i[@class='jstree-icon jstree-checkbox']"/>
1722
</section>
1823
</sections>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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="AdminCreateUserRoleWithLimitedPermissionTest">
12+
<annotations>
13+
<features value="User"/>
14+
<stories value="Create User Role with limited permission"/>
15+
<title value="User with limited right can't amend Stocks"/>
16+
<description value="The testcase purpose to verify User cannot make changes in stock with limited access"/>
17+
<testCaseId value="AC-6618"/>
18+
<group value="user"/>
19+
<severity value="MAJOR"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="logIn"/>
23+
</before>
24+
<after>
25+
<actionGroup ref="AdminLoginActionGroup" stepKey="adminLogin"/>
26+
<!--Delete new user-->
27+
<actionGroup ref="AdminDeleteCustomUserActionGroup" stepKey="deleteNewUser">
28+
<argument name="user" value="activeAdmin"/>
29+
</actionGroup>
30+
<!--Delete new Role-->
31+
<actionGroup ref="AdminDeleteUserRoleActionGroup" stepKey="deleteCustomRole">
32+
<argument name="roleName" value="{{roleSales.rolename}}"/>
33+
</actionGroup>
34+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logOut"/>
35+
</after>
36+
<!--Create a new role with custom access-->
37+
<actionGroup ref="AdminOpenCreateRolePageActionGroup" stepKey="goToNewRolePage"/>
38+
<actionGroup ref="AdminFillUserRoleFormActionGroup" stepKey="fillNewRoleForm">
39+
<argument name="role" value="roleSales"/>
40+
</actionGroup>
41+
<actionGroup ref="AdminSelectCustomStockUserRoleResourcesActionGroup" stepKey="selectStockAndTwoFactor"/>
42+
<actionGroup ref="AdminClickSaveButtonOnUserRoleFormActionGroup" stepKey="saveNewRole"/>
43+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage">
44+
<argument name="message" value="You saved the role."/>
45+
</actionGroup>
46+
<actionGroup ref="AdminCreateUserWithRoleActionGroup" stepKey="createUser">
47+
<argument name="role" value="roleSales"/>
48+
<argument name="user" value="activeAdmin"/>
49+
</actionGroup>
50+
51+
<!--Log out of admin and login with newly created user-->
52+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
53+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsNewUser">
54+
<argument name="username" value="{{activeAdmin.username}}"/>
55+
<argument name="password" value="{{activeAdmin.password}}"/>
56+
</actionGroup>
57+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutNewUserFromAdmin" after="verifyDeleteStockButtonNotVisible"/>
58+
</test>
59+
</tests>

0 commit comments

Comments
 (0)