Skip to content

Commit

Permalink
Merge pull request #6265 from magento-tsg/MC-34292
Browse files Browse the repository at this point in the history
[Arrows] MC-34292: AdminCreateUserRoleWithReportsActionGroup needs to be refactored to be based in CE
  • Loading branch information
zakdma authored Oct 22, 2020
2 parents 68c903f + a80350a commit a1e5689
Show file tree
Hide file tree
Showing 8 changed files with 183 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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="AdminChooseUserRoleResourceActionGroup">
<annotations>
<description>Check the resource access checkbox. Leave the form open.</description>
</annotations>
<arguments>
<argument name="resourceId" type="string" defaultValue="Magento_Backend::dashboard"/>
<argument name="resourceName" type="string" defaultValue="Dashboard"/>
</arguments>

<waitForElementVisible selector="{{AdminEditRoleResourcesSection.resourceCheckboxLink(resourceId, resourceName)}}" stepKey="waitForResourceCheckboxVisible"/>
<click selector="{{AdminEditRoleResourcesSection.resourceCheckboxLink(resourceId, resourceName)}}" stepKey="checkResource"/>
<seeCheckboxIsChecked selector="{{AdminEditRoleResourcesSection.resourceCheckbox(resourceId)}}" stepKey="seeCheckedResource"/>
</actionGroup>
</actionGroups>
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.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminSaveUserRoleActionGroup">
<annotations>
<description>Click to Save Role</description>
</annotations>
<click selector="{{AdminEditRoleInfoSection.saveButton}}" stepKey="clickSaveRoleButton" />
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/>
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the role." stepKey="seeSuccessMessageForSavedRole"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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="AdminStartCreateUserRoleActionGroup">
<annotations>
<description>Open Admin Edit Role page. Fills role, user password, resource access. Leave the form open.</description>
</annotations>
<arguments>
<argument name="roleName" type="string" defaultValue="{{limitedRole.name}}"/>
<argument name="userPassword" type="string" defaultValue="123123q"/>
<argument name="resourceAccess" type="string" defaultValue="Custom"/>
</arguments>
<amOnPage url="{{AdminEditRolePage.url}}" stepKey="openNewAdminRolePage"/>
<waitForElementVisible selector="{{AdminCreateRoleSection.name}}" stepKey="waitForName"/>
<fillField selector="{{AdminCreateRoleSection.name}}" userInput="{{roleName}}" stepKey="setTheRoleName"/>
<fillField selector="{{AdminCreateRoleSection.password}}" userInput="{{userPassword}}" stepKey="setPassword"/>
<click selector="{{AdminCreateRoleSection.roleResources}}" stepKey="clickToOpenRoleResources"/>
<selectOption selector="{{AdminEditRoleResourcesSection.resourceAccess}}" userInput="{{resourceAccess}}" stepKey="chooseResourceAccess"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminUserSaveRoleActionGroup">
<annotations>
<description>Click to Save Role</description>
<description>Deprecated. Please use AdminSaveUserRoleActionGroup</description>
</annotations>
<click selector="{{AdminEditRoleInfoSection.saveButton}}" stepKey="clickSaveRoleButton" />
<see userInput="You saved the role." stepKey="seeUserRoleSavedMessage"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
<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="create" type="button" selector="#add" timeout="30"/>
<element name="name" type="button" selector="#role_name"/>
<element name="password" type="input" selector="#current_password"/>
<element name="resourceAccess" type="select" selector="[data-ui-id='adminhtml-user-editroles-tab-content-account'] [name='all']"/>
<element name="resourceTree" type="block" selector="[data-ui-id='adminhtml-user-editroles-tab-content-account'] [data-role='resource-tree']"/>

<element name="roleResources" type="button" selector="#role_info_tabs_account"/>
<element name="roleResources" type="button" selector="#role_info_tabs_account" timeout="30"/>
<element name="roleResource" type="button" selector="#gws_is_all"/>
<element name="roleResourceNew" type="button" selector="#all"/>
<element name="resourceValue" type="button" selector="//*[text()='{{arg1}}']" parameterized="true"/>
Expand All @@ -24,7 +24,7 @@
<element name="scopeValue" type="button" selector="//select[@id='all']/*[text()='{{arg2}}']" parameterized="true"/>
<element name="website" type="checkbox" selector="//*[contains(text(), '{{arg3}}')]" parameterized="true"/>
<element name="selectWebsite" type="checkbox" selector="//label[contains(text(), '{{websiteName}}')]/preceding-sibling::input" parameterized="true"/>
<element name="save" type="button" selector="//button[@title='Save Role']"/>
<element name="save" type="button" selector="//button[@title='Save Role']" timeout="30"/>
<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"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<element name="backButton" type="button" selector="button[title='Back']"/>
<element name="resetButton" type="button" selector="button[title='Reset']"/>
<element name="deleteButton" type="button" selector="button[title='Delete Role']"/>
<element name="saveButton" type="button" selector="button[title='Save Role']"/>
<element name="saveButton" type="button" selector="button[title='Save Role']" timeout="30"/>
<element name="message" type="text" selector=".modal-popup.confirm div.modal-content"/>
<element name="cancel" type="button" selector=".modal-popup.confirm button.action-dismiss"/>
<element name="ok" type="button" selector=".modal-popup.confirm button.action-accept" timeout="60"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<element name="resources" type="checkbox" selector="#role_info_tabs_account"/>
<element name="storeName" type="checkbox" selector="//label[contains(text(),'{{var1}}')]" parameterized="true"/>
<element name="reportsCheckbox" type="text" selector="//li[@data-id='Magento_Reports::report']//a[text()='Reports']"/>
<element name="resourceCheckboxLink" type="checkbox" selector="//li[@data-id='{{resourceId}}']//a[text()='{{resourceName}}']" timeout="30" parameterized="true"/>
<element name="resourceCheckbox" type="checkbox" selector="//li[@data-id='{{resourceId}}']/input" timeout="30" parameterized="true"/>
<element name="userRoles" type="text" selector="//span[contains(text(), 'User Roles')]"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminReviewOrderWithReportsPermissionTest">
<annotations>
<features value="User"/>
<stories value="Admin with restricted permissions"/>
<title value="User should be able to review ordered products with only 'Reports' permission"/>
<description value="User should be able to review ordered products with only 'Reports' permission"/>
<severity value="MAJOR"/>
<testCaseId value="MAGETWO-25812"/>
<group value="user"/>
</annotations>
<before>
<createData entity="ApiCategory" stepKey="createCategory"/>
<createData entity="ApiSimpleProduct" stepKey="createProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>

<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite">
<argument name="newWebsiteName" value="{{NewWebSiteData.name}}"/>
<argument name="websiteCode" value="{{NewWebSiteData.code}}"/>
</actionGroup>
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewStore">
<argument name="website" value="{{NewWebSiteData.name}}"/>
<argument name="storeGroupName" value="{{NewStoreData.name}}"/>
<argument name="storeGroupCode" value="{{NewStoreData.code}}"/>
</actionGroup>
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView">
<argument name="StoreGroup" value="NewStoreData"/>
<argument name="customStore" value="NewStoreViewData"/>
</actionGroup>
<actionGroup ref="AdminCreateCustomerWithWebsiteAndStoreViewActionGroup" stepKey="createCustomerWithWebsiteAndStoreView">
<argument name="customerData" value="Simple_US_Customer"/>
<argument name="address" value="US_Address_NY"/>
<argument name="website" value="{{NewWebSiteData.name}}"/>
<argument name="storeView" value="{{NewStoreViewData.name}}"/>
</actionGroup>
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProductOnAdmin">
<argument name="product" value="$createProduct$"/>
</actionGroup>
<actionGroup ref="CreatedProductConnectToWebsiteActionGroup" stepKey="productConnectToWebsite">
<argument name="website" value="NewWebSiteData"/>
<argument name="product" value="$createProduct$"/>
</actionGroup>
<actionGroup ref="CreateOrderInStoreChoosingPaymentMethodActionGroup" stepKey="createOrder">
<argument name="product" value="$createProduct$"/>
<argument name="customer" value="Simple_US_Customer"/>
<argument name="storeView" value="NewStoreViewData"/>
</actionGroup>
<actionGroup ref="AdminStartCreateUserRoleActionGroup" stepKey="startCreateUserRole">
<argument name="roleName" value="{{limitedRole.name}}"/>
<argument name="userPassword" value="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/>
<argument name="resourceAccess" value="Custom"/>
</actionGroup>
<actionGroup ref="AdminChooseUserRoleResourceActionGroup" stepKey="setResourceAccess">
<argument name="resourceId" value="Magento_Reports::report"/>
<argument name="resourceName" value="Reports"/>
</actionGroup>
<actionGroup ref="AdminSaveUserRoleActionGroup" stepKey="saveRole"/>
<actionGroup ref="AdminCreateUserWithRoleActionGroup" stepKey="createUser">
<argument name="role" value="limitedRole"/>
<argument name="user" value="NewAdminUser"/>
</actionGroup>
</before>
<after>
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>

<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdminUser"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminDeleteCreatedUserActionGroup" stepKey="deleteUser">
<argument name="user" value="NewAdminUser"/>
</actionGroup>
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearAdminUserGridFilters"/>
<amOnPage url="{{AdminRolesPage.url}}" stepKey="navigateToUserRoleGrid"/>
<actionGroup ref="AdminDeleteRoleActionGroup" stepKey="deleteRole">
<argument name="role" value="limitedRole"/>
</actionGroup>

<actionGroup ref="AdminDeleteCustomerActionGroup" stepKey="deleteCustomer">
<argument name="customerEmail" value="Simple_US_Customer.email"/>
</actionGroup>
<actionGroup ref="AdminClearCustomersFiltersActionGroup" stepKey="clearCustomerFilters"/>
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
<argument name="websiteName" value="{{NewWebSiteData.name}}"/>
</actionGroup>
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductFilters"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
</after>

<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="logAsNewUser">
<argument name="username" value="{{NewAdminUser.username}}"/>
<argument name="password" value="{{NewAdminUser.password}}"/>
</actionGroup>
<actionGroup ref="AdminReviewOrderActionGroup" stepKey="reviewOrder">
<argument name="productName" value="$createProduct.name$"/>
</actionGroup>
</test>
</tests>

0 comments on commit a1e5689

Please sign in to comment.