|
| 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="AdminNoAccessToLoginAsCustomerConfigurationTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Login As Customer"/> |
| 14 | + <stories value="Permissions and ACl"/> |
| 15 | + <title value="User does not have access to 'Login as customer' section in System Configuration"/> |
| 16 | + <description |
| 17 | + value="Login into Magento Admin panel as user that does not have access to 'Login as customer' section in System Configuration"/> |
| 18 | + <severity value="CRITICAL"/> |
| 19 | + <group value="login_as_customer"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 1" |
| 23 | + stepKey="enableLoginAsCustomer"/> |
| 24 | + <magentoCLI command="cache:flush config" stepKey="flushCacheBeforeTestRun"/> |
| 25 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 26 | + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> |
| 27 | + <requiredEntity createDataKey="createCategory"/> |
| 28 | + </createData> |
| 29 | + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> |
| 30 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsDefaultAdminUserBefore"/> |
| 31 | + |
| 32 | + <!--Create New Role--> |
| 33 | + <actionGroup ref="AdminOpenCreateRolePageActionGroup" stepKey="goToNewRolePage"/> |
| 34 | + <actionGroup ref="AdminFillUserRoleFormActionGroup" stepKey="fillNewRoleForm"> |
| 35 | + <argument name="role" value="customRoleAllResources"/> |
| 36 | + </actionGroup> |
| 37 | + <actionGroup ref="AdminRevokeRoleResourceActionGroup" stepKey="revokeLoginAsCustomerAccess"> |
| 38 | + <argument name="resourceName" value="Login As Customer Section"/> |
| 39 | + </actionGroup> |
| 40 | + <actionGroup ref="AdminClickSaveButtonOnUserRoleFormActionGroup" stepKey="saveNewRole"/> |
| 41 | + |
| 42 | + <!--Create New User--> |
| 43 | + <actionGroup ref="AdminCreateUserWithApiRoleActionGroup" stepKey="adminCreateUser"> |
| 44 | + <argument name="user" value="NewAdminUser"/> |
| 45 | + <argument name="role" value="customRoleAllResources"/> |
| 46 | + </actionGroup> |
| 47 | + </before> |
| 48 | + <after> |
| 49 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 50 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 51 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> |
| 52 | + |
| 53 | + <!--Delete new User--> |
| 54 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAsSaleRoleUser"/> |
| 55 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsDefaultAdminUserAfter"/> |
| 56 | + <actionGroup ref="AdminDeleteCustomUserActionGroup" stepKey="deleteNewUser"> |
| 57 | + <argument name="user" value="NewAdminUser"/> |
| 58 | + </actionGroup> |
| 59 | + |
| 60 | + <!--Delete new Role--> |
| 61 | + <actionGroup ref="AdminDeleteUserRoleActionGroup" stepKey="deleteCustomRoleAllResources"> |
| 62 | + <argument name="roleName" value="{{customRoleAllResources.rolename}}"/> |
| 63 | + </actionGroup> |
| 64 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logOut"/> |
| 65 | + |
| 66 | + <magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 0" |
| 67 | + stepKey="disableLoginAsCustomer"/> |
| 68 | + <magentoCLI command="cache:flush config" stepKey="flushCacheAfterTestRun"/> |
| 69 | + </after> |
| 70 | + |
| 71 | + <!-- Login as new User --> |
| 72 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logOutFromAdminPanel"/> |
| 73 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsSaleRoleUser"> |
| 74 | + <argument name="adminUser" value="NewAdminUser"/> |
| 75 | + </actionGroup> |
| 76 | + |
| 77 | + <!-- Navigate to Configuration page and open Customers tab --> |
| 78 | + <actionGroup ref="AdminOpenStoreConfigPageActionGroup" stepKey="openStoreConfig"/> |
| 79 | + <actionGroup ref="AdminExpandConfigTabActionGroup" stepKey="expandCustomersTab"> |
| 80 | + <argument name="tabName" value="Customers"/> |
| 81 | + </actionGroup> |
| 82 | + |
| 83 | + <!-- Assert no Login As Customer config section visible --> |
| 84 | + <actionGroup ref="AssertAdminLoginAsCustomerConfigNotVisibleActionGroup" stepKey="assertConfigNotVisible"/> |
| 85 | + |
| 86 | + <!-- Assert Login As Customer config section is not available by direct url --> |
| 87 | + <actionGroup ref="AssertAdminLoginAsCustomerConfigNotAvailableDirectlyActionGroup" |
| 88 | + stepKey="assertConfigNotAvailableDirectly"/> |
| 89 | + </test> |
| 90 | +</tests> |
0 commit comments