Skip to content

Commit

Permalink
Merge pull request #179 from magento-pangolin/MC-6621
Browse files Browse the repository at this point in the history
MC-6621 Backport for MC-6447
  • Loading branch information
kabothu committed Jul 31, 2019
2 parents 6252001 + cc13bdf commit f9d7b18
Show file tree
Hide file tree
Showing 11 changed files with 231 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminCreateUserSection">
<element name="system" type="input" selector="#menu-magento-backend-system"/>
<element name="allUsers" type="input" selector="//span[contains(text(), 'All Users')]"/>
<element name="create" type="input" selector="#add"/>
<element name="usernameTextField" type="input" selector="#user_username"/>
<element name="firstNameTextField" type="input" selector="#user_firstname"/>
<element name="lastNameTextField" type="input" selector="#user_lastname"/>
<element name="emailTextField" type="input" selector="#user_email"/>
<element name="passwordTextField" type="input" selector="#user_password"/>
<element name="pwConfirmationTextField" type="input" selector="#user_confirmation"/>
<element name="currentPasswordField" type="input" selector="#user_current_password"/>
<element name="userRoleTab" type="button" selector="#page_tabs_roles_section"/>
<element name="saveButton" type="button" selector="#save"/>
</section>
</sections>
27 changes: 27 additions & 0 deletions app/code/Magento/Store/Test/Mftf/Data/StoreData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,31 @@
<data key="code">allstoreviews</data>
<data key="is_active">1</data>
</entity>
<entity name="storeViewData" type="store">
<data key="group_id">1</data>
<data key="name" unique="suffix">storeView</data>
<data key="code" unique="suffix">storeView</data>
<data key="is_active">1</data>
<data key="store_id">null</data>
<data key="store_type">store</data>
<data key="store_action">add</data>
</entity>
<entity name="storeViewData1" type="store">
<data key="group_id">1</data>
<data key="name" unique="suffix">storeView</data>
<data key="code" unique="suffix">storeView</data>
<data key="is_active">1</data>
<data key="store_id">null</data>
<data key="store_type">store</data>
<data key="store_action">add</data>
</entity>
<entity name="storeViewData2" type="store">
<data key="group_id">1</data>
<data key="name" unique="suffix">storeView</data>
<data key="code" unique="suffix">storeView</data>
<data key="is_active">1</data>
<data key="store_id">null</data>
<data key="store_type">store</data>
<data key="store_action">add</data>
</entity>
</entities>
4 changes: 4 additions & 0 deletions app/code/Magento/Store/Test/Mftf/Data/WebsiteData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@
<data key="code" unique="suffix">second_website_</data>
<data key="sort_order">10</data>
</entity>
<entity name="secondCustomWebsite" extends="CustomWebSite">
<data key="name" unique="suffix">Custom Website</data>
<data key="code" unique="suffix">custom_website</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
<element name="websiteInFirstRow" type="text" selector=".data-row[data-repeat-index='0'] td:nth-of-type(1) a"/>
<element name="storeInFirstRow" type="text" selector=".data-row[data-repeat-index='0'] td:nth-of-type(2) a"/>
<element name="storeViewInFirstRow" type="text" selector=".data-row[data-repeat-index='0'] td:nth-of-type(3) a"/>
<element name="websiteNameInFirstRow" type="text" selector="tr:nth-of-type(1) > .col-website_title > a"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminAddNewUserRoleActionGroup">
<arguments>
<argument name="role" type="entity"/>
</arguments>

<!-- Navigate to Roles Page -->
<amOnPage url="{{AdminRolesPage.url}}" stepKey="amOnRolesPage"/>
<waitForPageLoad stepKey="waitForPageLoad"/>

<!-- Click Button "Add New Role" -->
<click selector="{{AdminMainActionsSection.add}}" stepKey="addNewUseRole"/>
<waitForPageLoad stepKey="waitForCreateNewUserRolePageLoad"/>

<!-- Fill forms "Role info" -->
<fillField userInput="{{role.name}}" selector="{{AdminCreateRoleSection.name}}" stepKey="fillNameUserRole"/>
<fillField userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" selector="{{AdminCreateRoleSection.password}}" stepKey="fillPass"/>

<!-- Open tab "Role Resources" -->
<click selector="{{AdminCreateRoleSection.roleResources}}" stepKey="clickOnTab"/>
<waitForPageLoad stepKey="waitForTabLoaded"/>

<!-- Select Role Scopes -->
<selectOption userInput="{{role.roleScopes}}" selector="{{AdminCreateRoleSection.roleScopeNew}}" stepKey="selectRoleResources"/>

<!-- Select Resource Access -->
<selectOption userInput="{{role.resourceAccess}}" selector="{{AdminCreateRoleSection.roleResourceNew}}" stepKey="selectResourceAccess"/>
<click selector="{{AdminCreateRoleSection.save}}" stepKey="saveUserRole"/>
<waitForPageLoad stepKey="waitForSaving"/>
<see userInput="You saved the role." selector="{{AdminMessagesSection.successMessage}}" stepKey="seeMessage"/>
</actionGroup>

<actionGroup name="AdminAddNewUserRoleWithCustomRoleScopes" extends="AdminAddNewUserRoleActionGroup">
<arguments>
<argument name="customWebsiteName" type="string"/>
</arguments>
<checkOption selector="{{AdminCreateRoleSection.selectWebsite(customWebsiteName)}}" stepKey="checkWebsite" after="selectRoleResources"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<!--Create new user with role-->
<actionGroup name="AdminCreateUserWithRoleActionGroup">
<arguments>
<argument name="role"/>
<argument name="user" defaultValue="newAdmin"/>
</arguments>
<amOnPage url="{{AdminNewUserPage.url}}" stepKey="navigateToNewUser"/>
<waitForPageLoad stepKey="waitForUsersPage" />
<fillField selector="{{AdminCreateUserSection.usernameTextField}}" userInput="{{user.username}}" stepKey="enterUserName" />
<fillField selector="{{AdminCreateUserSection.firstNameTextField}}" userInput="{{user.firstName}}" stepKey="enterFirstName" />
<fillField selector="{{AdminCreateUserSection.lastNameTextField}}" userInput="{{user.lastName}}" stepKey="enterLastName" />
<fillField selector="{{AdminCreateUserSection.emailTextField}}" userInput="{{user.username}}@magento.com" stepKey="enterEmail" />
<fillField selector="{{AdminCreateUserSection.passwordTextField}}" userInput="{{user.password}}" stepKey="enterPassword" />
<fillField selector="{{AdminCreateUserSection.pwConfirmationTextField}}" userInput="{{user.password}}" stepKey="confirmPassword" />
<fillField selector="{{AdminCreateUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="enterCurrentPassword" />
<scrollToTopOfPage stepKey="scrollToTopOfPage" />
<click stepKey="clickUserRole" selector="{{AdminCreateUserSection.userRoleTab}}"/>
<click stepKey="chooseRole" selector="{{AdminStoreSection.createdRoleInUserPage(role.name)}}"/>
<click selector="{{AdminCreateUserSection.saveButton}}" stepKey="clickSaveUser" />
<waitForPageLoad stepKey="waitForSaveTheUser" />
<see userInput="You saved the user." stepKey="seeSuccessMessage" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminDeleteCreatedUserActionGroup">
<arguments>
<argument name="user"/>
</arguments>
<amOnPage stepKey="amOnAdminUsersPage" url="{{AdminUsersPage.url}}"/>
<click stepKey="openTheUser" selector="{{AdminDeleteUserSection.role(user.username)}}"/>
<waitForPageLoad stepKey="waitForSingleUserPageToLoad" />
<fillField stepKey="TypeCurrentPassword" selector="{{AdminDeleteUserSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/>
<scrollToTopOfPage stepKey="scrollToTop"/>
<click stepKey="clickToDeleteUser" selector="{{AdminDeleteUserSection.delete}}"/>
<waitForPageLoad stepKey="waitForConfirmationPopup"/>
<click stepKey="clickToConfirm" selector="{{AdminDeleteUserSection.confirm}}"/>
<see stepKey="seeDeleteMessageForUser" userInput="You deleted the user."/>
</actionGroup>
</actionGroups>
11 changes: 11 additions & 0 deletions app/code/Magento/User/Test/Mftf/Data/UserRoleData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@
</array>
</entity>

<entity name="limitedRole" type="role">
<data key="name" unique="suffix">Limited</data>
<data key="roleScopes">Custom</data>
<data key="resourceAccess">All</data>
</entity>

<entity name="restrictedRole" type="role">
<data key="name" unique="suffix">Restricted</data>
<data key="roleScopes">Custom</data>
<data key="resourceAccess">All</data>
</entity>
<!-- This admin created for checking turn off "Bulk Actions" -->
<entity name="adminWithoutBulkActionRole" type="user_role">
<data key="rolename">restrictedWebsiteRole</data>
Expand Down
24 changes: 24 additions & 0 deletions app/code/Magento/User/Test/Mftf/Section/AdminCreateRoleSection.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminCreateRoleSection">
<element name="create" type="button" selector="#add"/>
<element name="name" type="button" selector="#role_name"/>
<element name="password" type="input" selector="#current_password"/>
<element name="roleResources" type="button" selector="#role_info_tabs_account"/>
<element name="roleResourceNew" type="button" selector="#all"/>
<element name="roleScopeNew" type="button" selector="#gws_is_all"/>
<element name="selectWebsite" type="checkbox" selector="//label[contains(text(), '{{websiteName}}')]/preceding-sibling::input" parameterized="true"/>
<element name="save" type="button" selector="button.save-role"/>
<element name="roleNameFilterTextField" type="input" selector="#permissionsUserRolesGrid_filter_role_name"/>
<element name="searchButton" type="button" selector=".admin__data-grid-header button[title=Search]"/>
<element name="searchResultFirstRow" type="text" selector=".data-grid>tbody>tr"/>
</section>
</sections>
17 changes: 17 additions & 0 deletions app/code/Magento/User/Test/Mftf/Section/AdminDeleteRoleSection.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminDeleteRoleSection">
<element name="theRole" selector="//td[contains(text(), 'Role')]" type="button"/>
<element name="current_pass" type="button" selector="#current_password"/>
<element name="delete" selector="//button/span[contains(text(), 'Delete Role')]" type="button"/>
<element name="confirm" selector=".action-primary.action-accept" type="button"/>
</section>
</sections>
18 changes: 18 additions & 0 deletions app/code/Magento/User/Test/Mftf/Section/AdminDeleteUserSection.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminDeleteUserSection">
<element name="theUser" selector="//td[contains(text(), 'John')]" type="button"/>
<element name="password" selector="#user_current_password" type="input"/>
<element name="delete" selector="//button/span[contains(text(), 'Delete User')]" type="button"/>
<element name="confirm" selector=".action-primary.action-accept" type="button"/>
<element name="role" parameterized="true" selector="//td[contains(text(), '{{args}}')]" type="button"/>
</section>
</sections>

0 comments on commit f9d7b18

Please sign in to comment.