Skip to content

Commit dd03a6d

Browse files
committed
Merge remote-tracking branch 'origin/MC-4383' into mtf-eol
2 parents be30ae9 + a667f22 commit dd03a6d

File tree

2 files changed

+118
-2
lines changed

2 files changed

+118
-2
lines changed

app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
</entity>
4545
<entity name="FirstLevelSubCat" type="category">
4646
<data key="name" unique="suffix">FirstLevelSubCategory</data>
47-
<data key="name_lwr" unique="suffix">subcategory</data>
47+
<data key="name_lwr" unique="suffix">firstlevelsubcategory</data>
4848
</entity>
4949
<entity name="SecondLevelSubCat" type="category">
5050
<data key="name" unique="suffix">SecondLevelSubCategory</data>
51-
<data key="name_lwr" unique="suffix">subcategory</data>
51+
<data key="name_lwr" unique="suffix">secondlevelsubcategory</data>
5252
</entity>
5353
<entity name="ThirdLevelSubCat" type="category">
5454
<data key="name" unique="suffix">ThirdLevelSubCategory</data>
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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="AdminMoveCategoryToAnotherPositionInCategoryTreeTest">
12+
<annotations>
13+
<stories value="Move categories"/>
14+
<title value="Move Category to Another Position in Category Tree"/>
15+
<description value="Test log in to Move Category and Move Category to Another Position in Category Tree"/>
16+
<testCaseId value="MC-13612"/>
17+
<severity value="CRITICAL"/>
18+
<group value="catalog"/>
19+
<group value="mtf_migrated"/>
20+
</annotations>
21+
22+
<before>
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/>
24+
<createData entity="_defaultCategory" stepKey="createDefaultCategory"/>
25+
</before>
26+
<after>
27+
<deleteData createDataKey="createDefaultCategory" stepKey="deleteDefaultCategory"/>
28+
<actionGroup ref="DeleteCategory" stepKey="SecondLevelSubCat">
29+
<argument name="categoryEntity" value="SecondLevelSubCat"/>
30+
</actionGroup>
31+
<actionGroup ref="logout" stepKey="logout"/>
32+
</after>
33+
34+
<!-- Open Category Page -->
35+
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
36+
<waitForPageLoad stepKey="waitForPageToLoaded"/>
37+
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickExpandTree"/>
38+
<waitForPageLoad stepKey="waitForCategoryToLoad"/>
39+
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(_defaultCategory.name)}}" stepKey="selectCategory"/>
40+
<waitForPageLoad stepKey="waitForPageToLoad"/>
41+
<!-- Create three level deep sub Category -->
42+
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickAddSubCategoryButton"/>
43+
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{FirstLevelSubCat.name}}" stepKey="fillSubCategoryName"/>
44+
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveFirstLevelSubCategory"/>
45+
<waitForPageLoad stepKey="waitForFirstLevelCategoryToSave"/>
46+
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/>
47+
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButtonAgain"/>
48+
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SecondLevelSubCat.name}}" stepKey="fillSecondLevelSubCategoryName"/>
49+
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSecondLevelSubCategory"/>
50+
<waitForPageLoad stepKey="waitForSecondLevelCategoryToSave"/>
51+
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSaveSuccessMessage"/>
52+
<grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#" />
53+
54+
<!-- Move Category to another position in category tree, but click cancel button -->
55+
<dragAndDrop selector1="{{AdminCategorySidebarTreeSection.categoryInTree(SecondLevelSubCat.name)}}" selector2="{{AdminCategorySidebarTreeSection.categoryInTree('Default Category')}}" stepKey="moveCategory"/>
56+
<see selector="{{AdminCategoryModalSection.message}}" userInput="This operation can take a long time" stepKey="seeWarningMessage"/>
57+
<click selector="{{AdminCategoryModalSection.cancel}}" stepKey="clickCancelButtonOnWarningPopup"/>
58+
<!-- Verify Category in store front page after clicking cancel button -->
59+
<amOnPage url="/$$createDefaultCategory.name$$/{{FirstLevelSubCat.name}}/{{SecondLevelSubCat.name}}.html" stepKey="seeTheCategoryInStoreFrontPage"/>
60+
<waitForPageLoad stepKey="waitForStoreFrontPageLoad"/>
61+
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(_defaultCategory.name)}}" stepKey="seeDefaultCategoryOnStoreNavigationBar"/>
62+
<dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="dontSeeSubCategoryOnStoreNavigationBar"/>
63+
<!-- Verify breadcrumbs in store front page after clicking cancel button -->
64+
<grabMultiple selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="breadcrumbs"/>
65+
<assertEquals stepKey="verifyTheCategoryInStoreFrontPage">
66+
<expectedResult type="array">['Home', $$createDefaultCategory.name$$,{{FirstLevelSubCat.name}},{{SecondLevelSubCat.name}}]</expectedResult>
67+
<actualResult type="variable">breadcrumbs</actualResult>
68+
</assertEquals>
69+
70+
<!-- Move Category to another position in category tree and click ok button-->
71+
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openTheAdminCategoryIndexPage"/>
72+
<waitForPageLoad stepKey="waitTillPageLoad"/>
73+
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/>
74+
<waitForPageLoad stepKey="waitForPageLoad"/>
75+
<dragAndDrop selector1="{{AdminCategorySidebarTreeSection.categoryInTree(SecondLevelSubCat.name)}}" selector2="{{AdminCategorySidebarTreeSection.categoryInTree('Default Category')}}" stepKey="DragCategory"/>
76+
<see selector="{{AdminCategoryModalSection.message}}" userInput="This operation can take a long time" stepKey="seeWarningMessageForOneMoreTime"/>
77+
<click selector="{{AdminCategoryModalSection.ok}}" stepKey="clickOkButtonOnWarningPopup"/>
78+
<waitForPageLoad stepKey="waitTheForPageToLoad"/>
79+
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You moved the category." stepKey="seeSuccessMoveMessage"/>
80+
<amOnPage url="/{{SimpleSubCategory.name}}.html" stepKey="seeCategoryNameInStoreFrontPage"/>
81+
<waitForPageLoad stepKey="waitForStoreFrontPageToLoad"/>
82+
<!-- Verify Category in store front after moving category to another position in category tree -->
83+
<amOnPage url="{{StorefrontCategoryPage.url(SecondLevelSubCat.name)}}" stepKey="amOnCategoryPage"/>
84+
<waitForPageLoad stepKey="waitForPageToBeLoaded"/>
85+
<seeElement selector="{{StorefrontCategoryMainSection.CategoryTitle(SecondLevelSubCat.name)}}" stepKey="seeCategoryInTitle"/>
86+
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SecondLevelSubCat.name)}}" stepKey="seeCategoryOnStoreNavigationBarAfterMove"/>
87+
<!-- Verify breadcrumbs in store front page after moving category to another position in category tree -->
88+
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SecondLevelSubCat.name)}}" stepKey="clickCategoryOnNavigation"/>
89+
<waitForPageLoad stepKey="waitForCategoryLoad"/>
90+
<grabMultiple selector="{{StorefrontNavigationSection.categoryBreadcrumbs}}" stepKey="breadcrumbsAfterMove"/>
91+
<assertEquals stepKey="verifyBreadcrumbsInFrontPageAfterMove">
92+
<expectedResult type="array">['Home',{{SecondLevelSubCat.name}}]</expectedResult>
93+
<actualResult type="variable">breadcrumbsAfterMove</actualResult>
94+
</assertEquals>
95+
96+
<!-- Open Url Rewrite page and see the url rewrite for the moved category -->
97+
<amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteIndexPage"/>
98+
<waitForPageLoad stepKey="waitForUrlRewritePageLoad"/>
99+
<fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{SecondLevelSubCat.name_lwr}}.html" stepKey="fillCategoryUrlKey"/>
100+
<click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/>
101+
<waitForPageLoad stepKey="waitForUrlPageToLoad"/>
102+
<!-- Verify new Redirect Path after move -->
103+
<see selector="{{AdminUrlRewriteIndexSection.requestPathColumn('2')}}" userInput="{{SecondLevelSubCat.name_lwr}}.html" stepKey="verifyTheRequestPathAfterMove"/>
104+
<!-- Verify new Target Path after move -->
105+
<see selector="{{AdminUrlRewriteIndexSection.targetPathColumn('2')}}" userInput="catalog/category/view/id/{$categoryId}" stepKey="verifyTheTargetPathAfterMove"/>
106+
<!-- Verify new RedirectType after move -->
107+
<see selector="{{AdminUrlRewriteIndexSection.redirectTypeColumn('2')}}" userInput="No" stepKey="verifyTheRedirectTypeAfterMove"/>
108+
<!-- Verify before move Redirect Path displayed with associated Target Path and Redirect Type-->
109+
<fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{SecondLevelSubCat.name_lwr}}" stepKey="fillTheCategoryUrlKey"/>
110+
<click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton2"/>
111+
<waitForPageLoad stepKey="waitForSearch"/>
112+
<see selector="{{AdminUrlRewriteIndexSection.redirectTypeColumn('1')}}" userInput="Permanent (301)" stepKey="verifyTheRedirectTypeBeforeMove"/>
113+
<see selector="{{AdminUrlRewriteIndexSection.requestPathColumn('1')}}" userInput="{{_defaultCategory.name_lwr}}2/{{FirstLevelSubCat.name_lwr}}/{{SecondLevelSubCat.name_lwr}}.html" stepKey="verifyTheRequestPathBeforeMove"/>
114+
<see selector="{{AdminUrlRewriteIndexSection.targetPathColumn('1')}}" userInput="{{SecondLevelSubCat.name_lwr}}.html" stepKey="verifyTheTargetPathBeforeMove"/>
115+
</test>
116+
</tests>

0 commit comments

Comments
 (0)