From afe1fc243f2322515abadb0d1d9618324a74b626 Mon Sep 17 00:00:00 2001 From: Viktor Sevch Date: Mon, 12 Oct 2020 14:49:05 +0300 Subject: [PATCH] MC-34292: AdminCreateUserRoleWithReportsActionGroup needs to be refactored to be based in CE --- ...AdminChooseUserRoleResourceActionGroup.xml | 23 ++++ .../AdminSaveUserRoleActionGroup.xml | 18 +++ .../AdminStartCreateUserRoleActionGroup.xml | 26 +++++ .../AdminUserSaveRoleActionGroup.xml | 2 +- .../Mftf/Section/AdminCreateRoleSection.xml | 6 +- .../Mftf/Section/AdminEditRoleInfoSection.xml | 2 +- .../Section/AdminEditRoleResourcesSection.xml | 2 + ...inReviewOrderWithReportsPermissionTest.xml | 109 ++++++++++++++++++ 8 files changed, 183 insertions(+), 5 deletions(-) create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminChooseUserRoleResourceActionGroup.xml create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml create mode 100644 app/code/Magento/User/Test/Mftf/ActionGroup/AdminStartCreateUserRoleActionGroup.xml create mode 100644 app/code/Magento/User/Test/Mftf/Test/AdminReviewOrderWithReportsPermissionTest.xml diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminChooseUserRoleResourceActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminChooseUserRoleResourceActionGroup.xml new file mode 100644 index 0000000000000..7072830e2036b --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminChooseUserRoleResourceActionGroup.xml @@ -0,0 +1,23 @@ + + + + + + Check the resource access checkbox. Leave the form open. + + + + + + + + + + + diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml new file mode 100644 index 0000000000000..4a90630161e99 --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml @@ -0,0 +1,18 @@ + + + + + + Click to Save Role + + + + + + diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminStartCreateUserRoleActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminStartCreateUserRoleActionGroup.xml new file mode 100644 index 0000000000000..2a1dec5b8574e --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminStartCreateUserRoleActionGroup.xml @@ -0,0 +1,26 @@ + + + + + + Open Admin Edit Role page. Fills role, user password, resource access. Leave the form open. + + + + + + + + + + + + + + diff --git a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserSaveRoleActionGroup.xml b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserSaveRoleActionGroup.xml index 824e9407125f5..e247db64deeab 100644 --- a/app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserSaveRoleActionGroup.xml +++ b/app/code/Magento/User/Test/Mftf/ActionGroup/AdminUserSaveRoleActionGroup.xml @@ -9,7 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - Click to Save Role + Deprecated. Please use AdminSaveUserRoleActionGroup diff --git a/app/code/Magento/User/Test/Mftf/Section/AdminCreateRoleSection.xml b/app/code/Magento/User/Test/Mftf/Section/AdminCreateRoleSection.xml index 93acfc2753b61..96aaf879e2054 100644 --- a/app/code/Magento/User/Test/Mftf/Section/AdminCreateRoleSection.xml +++ b/app/code/Magento/User/Test/Mftf/Section/AdminCreateRoleSection.xml @@ -9,13 +9,13 @@
- + - + @@ -24,7 +24,7 @@ - + diff --git a/app/code/Magento/User/Test/Mftf/Section/AdminEditRoleInfoSection.xml b/app/code/Magento/User/Test/Mftf/Section/AdminEditRoleInfoSection.xml index 57659e1aff075..b8430eb3b7313 100644 --- a/app/code/Magento/User/Test/Mftf/Section/AdminEditRoleInfoSection.xml +++ b/app/code/Magento/User/Test/Mftf/Section/AdminEditRoleInfoSection.xml @@ -13,7 +13,7 @@ - + diff --git a/app/code/Magento/User/Test/Mftf/Section/AdminEditRoleResourcesSection.xml b/app/code/Magento/User/Test/Mftf/Section/AdminEditRoleResourcesSection.xml index 48873bd9d152e..2352575257afb 100644 --- a/app/code/Magento/User/Test/Mftf/Section/AdminEditRoleResourcesSection.xml +++ b/app/code/Magento/User/Test/Mftf/Section/AdminEditRoleResourcesSection.xml @@ -11,6 +11,8 @@ + +
diff --git a/app/code/Magento/User/Test/Mftf/Test/AdminReviewOrderWithReportsPermissionTest.xml b/app/code/Magento/User/Test/Mftf/Test/AdminReviewOrderWithReportsPermissionTest.xml new file mode 100644 index 0000000000000..8629187fe3ffb --- /dev/null +++ b/app/code/Magento/User/Test/Mftf/Test/AdminReviewOrderWithReportsPermissionTest.xml @@ -0,0 +1,109 @@ + + + + + + + + + + <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>