Skip to content

Commit 72841f2

Browse files
Lusine-PapyanVeronikaYarats
authored andcommitted
MAGETWO-69893: Error appears when restricted user tries to add new category from product page
- Updated automated test script
1 parent 8e16a67 commit 72841f2

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,15 @@
428428
</arguments>
429429
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{categoryName}}]" stepKey="searchAndSelectCategory"/>
430430
</actionGroup>
431+
<!--Remove category from product in ProductFrom Page-->
432+
<actionGroup name="removeCategoryFromProduct">
433+
<arguments>
434+
<argument name="categoryName" type="string" defaultValue="{{_defaultCategory.name}}"/>
435+
</arguments>
436+
<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/>
437+
<click selector="{{AdminProductFormSection.unselectCategories(categoryName)}}" stepKey="unselectCategories"/>
438+
<click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneAdvancedCategory"/>
439+
</actionGroup>
431440

432441
<actionGroup name="expandAdminProductSection">
433442
<arguments>

app/code/Magento/Catalog/Test/Mftf/Test/AdminRestrictedUserAddCategoryFromProductPageTest.xml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@
7474
<!--Log out of admin and login with newly created user-->
7575
<comment userInput="Log out of admin and login with newly created user" stepKey="commentLoginWithNewUser"/>
7676
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
77-
<actionGroup ref="LoginNewUser" stepKey="loginActionGroup">
78-
<argument name="user" value="admin2"/>
77+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsNewUser">
78+
<argument name="adminUser" value="admin2"/>
7979
</actionGroup>
8080
<!--Go to create product page-->
8181
<comment userInput="Go to create product page" stepKey="commentGoCreateProductPage"/>
@@ -88,5 +88,23 @@
8888
<argument name="categoryName" value="$$createCategory.name$$"/>
8989
</actionGroup>
9090
<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>
91109
</test>
92110
</tests>

0 commit comments

Comments
 (0)