|
| 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="AdminRestrictedUserAddCategoryFromProductPageTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Catalog"/> |
| 14 | + <title value="Adding new category from product page by restricted user"/> |
| 15 | + <description value="Adding new category from product page by restricted user"/> |
| 16 | + <severity value="MAJOR"/> |
| 17 | + <testCaseId value="MC-17229"/> |
| 18 | + <useCaseId value="MAGETWO-69893"/> |
| 19 | + <group value="catalog"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 23 | + <!--Create category--> |
| 24 | + <comment userInput="Create category" stepKey="commentCreateCategory"/> |
| 25 | + <createData entity="SimpleSubCategory" stepKey="createCategory"/> |
| 26 | + </before> |
| 27 | + <after> |
| 28 | + <!--Delete created product--> |
| 29 | + <comment userInput="Delete created product" stepKey="commentDeleteProduct"/> |
| 30 | + <actionGroup ref="deleteProductBySku" stepKey="deleteProduct"> |
| 31 | + <argument name="sku" value="{{_defaultProduct.sku}}"/> |
| 32 | + </actionGroup> |
| 33 | + <actionGroup ref="resetProductGridToDefaultView" stepKey="resetFiltersIfExist"/> |
| 34 | + <actionGroup ref="logout" stepKey="logoutOfUser"/> |
| 35 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 36 | + <!--Delete created data--> |
| 37 | + <comment userInput="Delete created data" stepKey="commentDeleteCreatedData"/> |
| 38 | + <amOnPage url="{{AdminRolesPage.url}}" stepKey="navigateToUserRoleGrid" /> |
| 39 | + <waitForPageLoad stepKey="waitForRolesGridLoad" /> |
| 40 | + <actionGroup ref="AdminDeleteRoleActionGroup" stepKey="deleteUserRole"> |
| 41 | + <argument name="role" value="adminRole"/> |
| 42 | + </actionGroup> |
| 43 | + <amOnPage url="{{AdminUsersPage.url}}" stepKey="goToAllUsersPage"/> |
| 44 | + <waitForPageLoad stepKey="waitForUsersGridLoad" /> |
| 45 | + <actionGroup ref="AdminDeleteNewUserActionGroup" stepKey="deleteUser"> |
| 46 | + <argument name="userName" value="{{admin2.username}}"/> |
| 47 | + </actionGroup> |
| 48 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 49 | + <actionGroup ref="logout" stepKey="logoutOfAdmin"/> |
| 50 | + </after> |
| 51 | + <!--Create user role--> |
| 52 | + <comment userInput="Create user role" stepKey="commentCreateUserRole"/> |
| 53 | + <actionGroup ref="AdminFillUserRoleRequiredData" stepKey="fillUserRoleRequiredData"> |
| 54 | + <argument name="User" value="adminRole"/> |
| 55 | + <argument name="restrictedRole" value="Stores"/> |
| 56 | + </actionGroup> |
| 57 | + <click selector="{{AdminEditRoleInfoSection.roleResourcesTab}}" stepKey="clickRoleResourcesTab" /> |
| 58 | + <actionGroup ref="AdminAddRestrictedRole" stepKey="addRestrictedRoleStores"> |
| 59 | + <argument name="User" value="adminRole"/> |
| 60 | + <argument name="restrictedRole" value="Stores"/> |
| 61 | + </actionGroup> |
| 62 | + <actionGroup ref="AdminAddRestrictedRole" stepKey="addRestrictedRoleProducts"> |
| 63 | + <argument name="User" value="adminRole"/> |
| 64 | + <argument name="restrictedRole" value="Products"/> |
| 65 | + </actionGroup> |
| 66 | + <click selector="{{AdminEditRoleInfoSection.saveButton}}" stepKey="clickSaveRoleButton" /> |
| 67 | + <see userInput="You saved the role." stepKey="seeUserRoleSavedMessage"/> |
| 68 | + <!--Create user and assign role to it--> |
| 69 | + <comment userInput="Create user and assign role to it" stepKey="commentCreateUser"/> |
| 70 | + <actionGroup ref="AdminCreateUserActionGroup" stepKey="createAdminUser"> |
| 71 | + <argument name="role" value="adminRole"/> |
| 72 | + <argument name="User" value="admin2"/> |
| 73 | + </actionGroup> |
| 74 | + <!--Log out of admin and login with newly created user--> |
| 75 | + <comment userInput="Log out of admin and login with newly created user" stepKey="commentLoginWithNewUser"/> |
| 76 | + <actionGroup ref="logout" stepKey="logoutOfAdmin"/> |
| 77 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsNewUser"> |
| 78 | + <argument name="adminUser" value="admin2"/> |
| 79 | + </actionGroup> |
| 80 | + <!--Go to create product page--> |
| 81 | + <comment userInput="Go to create product page" stepKey="commentGoCreateProductPage"/> |
| 82 | + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"/> |
| 83 | + <dontSeeElement selector="{{AdminProductFormSection.newCategoryButton}}" stepKey="dontSeeNewCategoryButton"/> |
| 84 | + <!--Fill product data and assign to category--> |
| 85 | + <comment userInput="Fill product data and assign to category" stepKey="commentFillProductData"/> |
| 86 | + <actionGroup ref="fillMainProductForm" stepKey="fillMainProductForm"/> |
| 87 | + <actionGroup ref="SetCategoryByName" stepKey="addCategoryToProduct"> |
| 88 | + <argument name="categoryName" value="$$createCategory.name$$"/> |
| 89 | + </actionGroup> |
| 90 | + <actionGroup ref="saveProductForm" stepKey="saveProduct"/> |
| 91 | + <!--Assert that category exist in field--> |
| 92 | + <comment userInput="Assert that category exist in field" stepKey="commentAssertion"/> |
| 93 | + <grabTextFrom selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="grabCategoryName"/> |
| 94 | + <assertContains stepKey="assertThatCategory"> |
| 95 | + <expectedResult type="variable">$$createCategory.name$$</expectedResult> |
| 96 | + <actualResult type="variable">$grabCategoryName</actualResult> |
| 97 | + </assertContains> |
| 98 | + <!--Remove the category from the product and assert that it removed--> |
| 99 | + <comment userInput="Remove the category from the product and assert that it removed" stepKey="assertCategoryRemoved"/> |
| 100 | + <actionGroup ref="removeCategoryFromProduct" stepKey="removeCategoryFromProduct"> |
| 101 | + <argument name="categoryName" value="$$createCategory.name$$"/> |
| 102 | + </actionGroup> |
| 103 | + <actionGroup ref="saveProductForm" stepKey="saveProductAfterRemovingCategory"/> |
| 104 | + <grabTextFrom selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="grabCategoryFieldContent"/> |
| 105 | + <assertNotContains stepKey="assertThatCategoryRemoved"> |
| 106 | + <expectedResult type="variable">$$createCategory.name$$</expectedResult> |
| 107 | + <actualResult type="variable">$grabCategoryFieldContent</actualResult> |
| 108 | + </assertNotContains> |
| 109 | + </test> |
| 110 | +</tests> |
0 commit comments