Skip to content

Commit 24889de

Browse files
committed
MAGETWO-69825: [GITHUB #9891] Subcategory "liquid-hand-soap" is not opened in category "soap"
- Added automated test script
1 parent 7c86433 commit 24889de

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,18 @@
139139
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandToSeeAllCategories"/>
140140
<dontSee selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="dontSeeCategoryInTree"/>
141141
</actionGroup>
142+
<actionGroup name="deleteCategoryByName" extends="DeleteCategory">
143+
<arguments>
144+
<argument name="categoryName" type="string" defaultValue="category1"/>
145+
</arguments>
146+
<remove keyForRemoval="clickCategoryLink"/>
147+
<remove keyForRemoval="dontSeeCategoryInTree"/>
148+
<remove keyForRemoval="expandToSeeAllCategories"/>
149+
<conditionalClick selector="{{AdminCategorySidebarTreeSection.expandAll}}" dependentSelector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" visible="false" stepKey="expandCategories" after="waitForCategoryPageLoad"/>
150+
<click selector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" stepKey="clickCategory" after="expandCategories"/>
151+
<conditionalClick selector="{{AdminCategorySidebarTreeSection.expandAll}}" dependentSelector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" visible="false" stepKey="expandCategoriesToSeeAll" after="seeDeleteSuccess"/>
152+
<dontSee selector="{{AdminCategorySidebarTreeSection.categoryByName(categoryName)}}" stepKey="dontSeeCategory" after="expandCategoriesToSeeAll"/>
153+
</actionGroup>
142154

143155
<!-- Actions to fill out a new category from the product page-->
144156
<!-- The action assumes that you are already on an admin product configuration page -->

app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
<element name="lastCreatedCategory" type="block" selector=".x-tree-root-ct li li:last-child" />
1818
<element name="treeContainer" type="block" selector=".tree-holder" />
1919
<element name="expandRootCategory" type="text" selector="img.x-tree-elbow-end-plus"/>
20+
<element name="categoryByName" type="text" selector="//div[contains(@class, 'categories-side-col')]//a/span[contains(text(), '{{categoryName}}')]" parameterized="true" timeout="30"/>
2021
</section>
2122
</sections>
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCategoryWithRestrictedUrlKeyNotCreatedTest">
11+
<annotations>
12+
<features value="CatalogUrlRewrite"/>
13+
<title value="Category with restricted Url Key cannot be created"/>
14+
<description value="Category with restricted Url Key cannot be created"/>
15+
<severity value="MAJOR"/>
16+
<testCaseId value="MAGETWO-71221"/>
17+
<useCaseId value="MAGETWO-69825"/>
18+
<group value="CatalogUrlRewrite"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
22+
</before>
23+
<after>
24+
<!--Delete created categories-->
25+
<comment userInput="Delete created categories" stepKey="commentDeleteCreatedCategories"/>
26+
<actionGroup ref="deleteCategoryByName" stepKey="deleteAdminCategory">
27+
<argument name="categoryName" value="admin"/>
28+
</actionGroup>
29+
<actionGroup ref="deleteCategoryByName" stepKey="deleteSoapCategory">
30+
<argument name="categoryName" value="soap"/>
31+
</actionGroup>
32+
<actionGroup ref="deleteCategoryByName" stepKey="deleteRestCategory">
33+
<argument name="categoryName" value="rest"/>
34+
</actionGroup>
35+
<actionGroup ref="deleteCategoryByName" stepKey="deleteGraphQlCategory">
36+
<argument name="categoryName" value="graphql"/>
37+
</actionGroup>
38+
<actionGroup ref="logout" stepKey="logout"/>
39+
</after>
40+
<!--Check category creation with restricted url key 'admin'-->
41+
<comment userInput="Check category creation with restricted url key 'admin'" stepKey="commentCheckAdminCategoryCreation"/>
42+
<actionGroup ref="goToCreateCategoryPage" stepKey="goToCreateAdminCategoryPage"/>
43+
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillAdminFirstCategoryForm">
44+
<argument name="categoryName" value="admin"/>
45+
<argument name="categoryUrlKey" value=""/>
46+
</actionGroup>
47+
<see userInput='URL key "admin" conflicts with reserved endpoint names: admin, soap, rest, graphql. Try another url key.' stepKey="seeAdminFirstErrorMessage"/>
48+
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillAdminSecondCategoryForm">
49+
<argument name="categoryName" value="{{SimpleSubCategory.name}}"/>
50+
<argument name="categoryUrlKey" value="admin"/>
51+
</actionGroup>
52+
<see userInput='URL key "admin" conflicts with reserved endpoint names: admin, soap, rest, graphql. Try another url key.' stepKey="seeAdminSecondErrorMessage"/>
53+
<!--Create category with 'admin' name-->
54+
<comment userInput="Create category with 'admin' name" stepKey="commentAdminCategoryCreation"/>
55+
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillAdminThirdCategoryForm">
56+
<argument name="categoryName" value="admin"/>
57+
<argument name="categoryUrlKey" value="{{SimpleSubCategory.name}}"/>
58+
</actionGroup>
59+
<see userInput="You saved the category." stepKey="seeAdminSuccessMessage"/>
60+
<seeElement selector="{{AdminCategorySidebarTreeSection.categoryByName('admin')}}" stepKey="seeAdminCategoryInTree"/>
61+
<!--Check category creation with restricted url key 'soap'-->
62+
<comment userInput="Check category creation with restricted url key 'soap'" stepKey="commentCheckSoapCategoryCreation"/>
63+
<actionGroup ref="goToCreateCategoryPage" stepKey="goToCreateSoapCategoryPage"/>
64+
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillSoapFirstCategoryForm">
65+
<argument name="categoryName" value="soap"/>
66+
<argument name="categoryUrlKey" value=""/>
67+
</actionGroup>
68+
<see userInput='URL key "soap" conflicts with reserved endpoint names: admin, soap, rest, graphql. Try another url key.' stepKey="seeSoapFirstErrorMessage"/>
69+
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillSoapSecondCategoryForm">
70+
<argument name="categoryName" value="{{ApiCategory.name}}"/>
71+
<argument name="categoryUrlKey" value="soap"/>
72+
</actionGroup>
73+
<see userInput='URL key "soap" conflicts with reserved endpoint names: admin, soap, rest, graphql. Try another url key.' stepKey="seeSoapSecondErrorMessage"/>
74+
<!--Create category with 'soap' name-->
75+
<comment userInput="Create category with 'soap' name" stepKey="commentSoapCategoryCreation"/>
76+
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillSoapThirdCategoryForm">
77+
<argument name="categoryName" value="soap"/>
78+
<argument name="categoryUrlKey" value="{{ApiCategory.name}}"/>
79+
</actionGroup>
80+
<see userInput="You saved the category." stepKey="seeSoapSuccessMessage"/>
81+
<seeElement selector="{{AdminCategorySidebarTreeSection.categoryByName('soap')}}" stepKey="seeSoapCategoryInTree"/>
82+
<!--Check category creation with restricted url key 'rest'-->
83+
<comment userInput="Check category creation with restricted url key 'rest'" stepKey="commentCheckRestCategoryCreation"/>
84+
<actionGroup ref="goToCreateCategoryPage" stepKey="goToCreateRestCategoryPage"/>
85+
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillRestFirstCategoryForm">
86+
<argument name="categoryName" value="rest"/>
87+
<argument name="categoryUrlKey" value=""/>
88+
</actionGroup>
89+
<see userInput='URL key "rest" conflicts with reserved endpoint names: admin, soap, rest, graphql. Try another url key.' stepKey="seeRestFirstErrorMessage"/>
90+
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillRestSecondCategoryForm">
91+
<argument name="categoryName" value="{{SubCategoryWithParent.name}}"/>
92+
<argument name="categoryUrlKey" value="rest"/>
93+
</actionGroup>
94+
<see userInput='URL key "rest" conflicts with reserved endpoint names: admin, soap, rest, graphql. Try another url key.' stepKey="seeRestSecondErrorMessage"/>
95+
<!--Create category with 'rest' name-->
96+
<comment userInput="Create category with 'rest' name" stepKey="commentRestCategoryCreation"/>
97+
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillRestThirdCategoryForm">
98+
<argument name="categoryName" value="rest"/>
99+
<argument name="categoryUrlKey" value="{{SubCategoryWithParent.name}}"/>
100+
</actionGroup>
101+
<see userInput="You saved the category." stepKey="seeRestSuccessMesdgssage"/>
102+
<seeElement selector="{{AdminCategorySidebarTreeSection.categoryByName('rest')}}" stepKey="seeRestCategoryInTree"/>
103+
<!--Check category creation with restricted url key 'graphql'-->
104+
<comment userInput="Check category creation with restricted url key 'graphql'" stepKey="commentCheckGraphQlCategoryCreation"/>
105+
<actionGroup ref="goToCreateCategoryPage" stepKey="goToCreateCategoryPage"/>
106+
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillGraphQlFirstCategoryForm">
107+
<argument name="categoryName" value="graphql"/>
108+
<argument name="categoryUrlKey" value=""/>
109+
</actionGroup>
110+
<see userInput='URL key "graphql" conflicts with reserved endpoint names: admin, soap, rest, graphql. Try another url key.' stepKey="seeGraphQlFirstErrorMessage"/>
111+
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillGraphQlSecondCategoryForm">
112+
<argument name="categoryName" value="{{NewSubCategoryWithParent.name}}"/>
113+
<argument name="categoryUrlKey" value="graphql"/>
114+
</actionGroup>
115+
<see userInput='URL key "graphql" conflicts with reserved endpoint names: admin, soap, rest, graphql. Try another url key.' stepKey="seeGraphQlSecondErrorMessage"/>
116+
<!--Create category with 'graphql' name-->
117+
<comment userInput="Create category with 'graphql' name" stepKey="commentGraphQlCategoryCreation"/>
118+
<actionGroup ref="FillCategoryNameAndUrlKeyAndSave" stepKey="fillGraphQlThirdCategoryForm">
119+
<argument name="categoryName" value="graphql"/>
120+
<argument name="categoryUrlKey" value="{{NewSubCategoryWithParent.name}}"/>
121+
</actionGroup>
122+
<see userInput="You saved the category." stepKey="seeGraphQlSuccessMessage"/>
123+
<seeElement selector="{{AdminCategorySidebarTreeSection.categoryByName('graphql')}}" stepKey="seeGraphQlCategoryInTree"/>
124+
</test>
125+
</tests>

0 commit comments

Comments
 (0)