Skip to content

Commit 7d74789

Browse files
committed
MC-4897: Convert CreateCategoryRewriteEntityTest to MFTF
1 parent 47d89b7 commit 7d74789

10 files changed

+294
-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
@@ -263,4 +263,16 @@
263263
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
264264
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessage"/>
265265
</actionGroup>
266+
<actionGroup name="OpenCategoryFromCategoryTree">
267+
<arguments>
268+
<argument name="category" type="string"/>
269+
</arguments>
270+
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
271+
<waitForPageLoad stepKey="waitForCategoryPageToLoad"/>
272+
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/>
273+
<waitForPageLoad stepKey="waitForCategoryToLoad"/>
274+
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(category)}}" stepKey="selectCategory"/>
275+
<waitForPageLoad stepKey="waitForPageToLoad"/>
276+
<waitForElementVisible selector="{{AdminCategoryContentSection.categoryPageTitle}}" stepKey="waitForCategoryTitle"/>
277+
</actionGroup>
266278
</actionGroups>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminAddUrlRewrite">
12+
<arguments>
13+
<argument name="category" type="string"/>
14+
<argument name="customUrlRewriteValue" type="string"/>
15+
<argument name="storeValue" type="string"/>
16+
<argument name="requestPath" type="string"/>
17+
<argument name="redirectTypeValue" type="string"/>
18+
<argument name="description" type="string"/>
19+
</arguments>
20+
<amOnPage url="{{AdminUrlRewriteEditPage.url}}" stepKey="openUrlRewriteEditPage"/>
21+
<waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/>
22+
<click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewrite}}" stepKey="clickOnCustonUrlRewrite"/>
23+
<click selector="{{AdminUrlRewriteEditSection.createCustomUrlRewriteValue('customUrlRewriteValue')}}" stepKey="selectForCategory"/>
24+
<waitForPageLoad stepKey="waitForCategoryEditSectionToLoad"/>
25+
<click selector="{{AdminUrlRewriteEditSection.categoryInTree($$category.name$$)}}" stepKey="selectCategoryInTree"/>
26+
<waitForPageLoad stepKey="waitForPageToLoad"/>
27+
<click selector="{{AdminUrlRewriteEditSection.store}}" stepKey="clickOnStore"/>
28+
<click selector="{{AdminUrlRewriteEditSection.storeValue('storeValue')}}" stepKey="clickOnStoreValue"/>
29+
<fillField selector="{{AdminUrlRewriteEditSection.requestPath}}" userInput="{{requestPath}}" stepKey="fillRequestPath"/>
30+
<click selector="{{AdminUrlRewriteEditSection.redirectType}}" stepKey="selectRedirectType"/>
31+
<click selector="{{AdminUrlRewriteEditSection.redirectTypeValue('redirectTypeValue')}}" stepKey="clickOnRedirectTypeValue"/>
32+
<fillField selector="{{AdminUrlRewriteEditSection.description}}" userInput="{{description}}" stepKey="fillDescription"/>
33+
<click selector="{{AdminUrlRewriteEditSection.saveButton}}" stepKey="clickOnSaveButton"/>
34+
<seeElement selector="{{AdminUrlRewriteIndexSection.successMessage}}" stepKey="seeSuccessSaveMessage"/>
35+
</actionGroup>
36+
</actionGroups>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminSearchByRequestPath">
12+
<arguments>
13+
<argument name="redirectPath" type="string"/>
14+
<argument name="redirectType" type="string"/>
15+
<argument name="targetPath" type="string"/>
16+
</arguments>
17+
<amOnPage url="{{AdminUrlRewriteIndexPage.url}}" stepKey="openUrlRewriteEditPage"/>
18+
<waitForPageLoad stepKey="waitForUrlRewriteEditPageToLoad"/>
19+
<click selector="{{AdminUrlRewriteIndexSection.resetButton}}" stepKey="clickOnResetButton"/>
20+
<waitForPageLoad stepKey="waitForPageToLoad"/>
21+
<fillField selector="{{AdminUrlRewriteIndexSection.requestPathFilter}}" userInput="{{redirectPath}}" stepKey="fillRedirectPathFilter"/>
22+
<click selector="{{AdminUrlRewriteIndexSection.searchButton}}" stepKey="clickOnSearchButton"/>
23+
<waitForPageLoad stepKey="waitForPageToLoad1"/>
24+
<see selector="{{AdminUrlRewriteIndexSection.requestPathColumn('1')}}" userInput="{{redirectPath}}" stepKey="seeTheRedirectPathForOldUrl"/>
25+
<see selector="{{AdminUrlRewriteIndexSection.targetPathColumn('1')}}" userInput="{{targetPath}}" stepKey="seeTheTargetPath" />
26+
<see selector="{{AdminUrlRewriteIndexSection.redirectTypeColumn('1')}}" userInput="{{redirectType}}" stepKey="seeTheRedirectTypeForOldUrl" />
27+
</actionGroup>
28+
</actionGroups>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontUrlRewriteRedirect">
12+
<arguments>
13+
<argument name="category" type="string"/>
14+
<argument name="newRequestPath" type="string"/>
15+
</arguments>
16+
<amOnPage url="{{newRequestPath}}" stepKey="openCategoryInStorefront"/>
17+
<waitForPageLoad stepKey="waitForCategoryPageToLoad"/>
18+
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(category)}}" stepKey="seeCategoryOnStoreNavigationBar"/>
19+
<seeElement selector="{{StorefrontCategoryMainSection.CategoryTitle(category)}}" stepKey="seeCategoryInTitle"/>
20+
</actionGroup>
21+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminUrlRewriteEditPage" url="admin/url_rewrite/edit/id" area="admin" module="Magento_UrlRewrite">
12+
<section name="AdminUrlRewriteEditSection"/>
13+
</page>
14+
</pages>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminUrlRewriteEditSection">
12+
<element name="createCustomUrlRewrite" type="select" selector="//select[@id='entity-type-selector']" />
13+
<element name="createCustomUrlRewriteValue" type="text" selector="//select[@id='entity-type-selector']/option[contains(.,'{{var}}')]" parameterized="true"/>
14+
<element name="store" type="select" selector="//select[@id='store_id']"/>
15+
<element name="storeValue" type="select" selector="//select[@id='store_id']//option[contains(., '{{var}}')]" parameterized="true" />
16+
<element name="requestPath" type="input" selector="//input[@id='request_path']"/>
17+
<element name="targetPath" type="input" selector="//input[@id='target_path']"/>
18+
<element name="redirectType" type="select" selector="//select[@id='redirect_type']"/>
19+
<element name="redirectTypeValue" type="select" selector="//select[@id='redirect_type']//option[contains(., '{{Var}}')]" parameterized="true"/>
20+
<element name="description" type="input" selector="#description"/>
21+
<element name="categoryInTree" type="text" selector="//li[contains(@class,'active-category jstree-open')]/a[contains(., '{{var}}')]" parameterized="true"/>
22+
<element name="saveButton" type="button" selector="#save" timeout="30"/>
23+
<element name="deleteButton" type="button" selector="#delete" timeout="30"/>
24+
<element name="okButton" type="button" selector="//button[@class='action-primary action-accept']" timeout="30"/>
25+
</section>
26+
</sections>

app/code/Magento/UrlRewrite/Test/Mftf/Section/AdminUrlRewriteIndexSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<element name="redirectTypeColumn" type="text" selector="//tr[@data-role='row'][{{var1}}]/td[@data-column='redirect_type']" parameterized="true"/>
2020
<element name="requestPathColumn" type="text" selector="//tr[@data-role='row'][{{var1}}]/td[@data-column='request_path']" parameterized="true"/>
2121
<element name="emptyRecords" type="text" selector="//td[@class='empty-text']"/>
22+
<element name="successMessage" type="text" selector="#messages"/>
2223
</section>
2324
</sections>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateCategoryUrlRewriteAndAddNoRedirectTest">
11+
<annotations>
12+
<stories value="Create category URL rewrite"/>
13+
<title value="Create category URL rewrite, with no redirect"/>
14+
<description value="Login as admin and create category UrlRewrite with No redirect"/>
15+
<testCaseId value="MC-5335"/>
16+
<severity value="CRITICAL"/>
17+
<group value="mtf_migrated"/>
18+
</annotations>
19+
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/>
22+
<createData entity="_defaultCategory" stepKey="category"/>
23+
</before>
24+
<after>
25+
<deleteData createDataKey="category" stepKey="deleteRootCategory"/>
26+
<actionGroup ref="logout" stepKey="logout"/>
27+
</after>
28+
29+
<!--Open Url Rewrite Index Page and update the Custom Url Rewrite, Store, Request Path, Redirect Type and Description -->
30+
<actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewrite">
31+
<argument name="category" value="$$category.name$$"/>
32+
<argument name="customUrlRewriteValue" value="For Category'"/>
33+
<argument name="storeValue" value="Default Store View"/>
34+
<argument name="requestPath" value="newrequestpath.html"/>
35+
<argument name="redirectTypeValue" value="No"/>
36+
<argument name="description" value="End To End Test"/>
37+
</actionGroup>
38+
39+
<!-- Get Category ID -->
40+
<actionGroup ref="OpenCategoryFromCategoryTree" stepKey="getCategoryId">
41+
<argument name="category" value="$$category.name$$"/>
42+
</actionGroup>
43+
<grabFromCurrentUrl stepKey="categoryId" regex="#\/([0-9]*)?\/$#"/>
44+
45+
<!-- Assert Redirect path, Target Path and Redirect type in grid -->
46+
<actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath">
47+
<argument name="redirectPath" value="newrequestpath.html" />
48+
<argument name="redirectType" value="No" />
49+
<argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/>
50+
</actionGroup>
51+
</test>
52+
</tests>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateCategoryUrlRewriteAndAddPermanentRedirectTest">
11+
<annotations>
12+
<stories value="Create category URL rewrite"/>
13+
<title value="Create category URL rewrite, add permanent redirect for category"/>
14+
<description value="Login as admin and create category UrlRewrite with Permanent redirect"/>
15+
<testCaseId value="MC-5334"/>
16+
<severity value="CRITICAL"/>
17+
<group value="mtf_migrated"/>
18+
</annotations>
19+
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/>
22+
<createData entity="_defaultCategory" stepKey="category"/>
23+
</before>
24+
<after>
25+
<deleteData createDataKey="category" stepKey="deleteRootCategory"/>
26+
<actionGroup ref="logout" stepKey="logout"/>
27+
</after>
28+
29+
<!--Open Url Rewrite Index Page and update the Custom Url Rewrite, Store, Request Path, Redirect Type and Description -->
30+
<actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewrite">
31+
<argument name="category" value="$$category.name$$"/>
32+
<argument name="customUrlRewriteValue" value="For Category'"/>
33+
<argument name="storeValue" value="Default Store View"/>
34+
<argument name="requestPath" value="newrequestpath.html"/>
35+
<argument name="redirectTypeValue" value="Permanent (301)"/>
36+
<argument name="description" value="End To End Test"/>
37+
</actionGroup>
38+
39+
<!-- Assert Redirect path, Target Path and Redirect type in grid -->
40+
<actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath">
41+
<argument name="redirectPath" value="newrequestpath.html" />
42+
<argument name="redirectType" value="Permanent (301)" />
43+
<argument name="targetPath" value="$$category.name_lwr$$.html"/>
44+
</actionGroup>
45+
46+
<!--Assert Updated path directs to the category storefront -->
47+
<actionGroup ref="StorefrontUrlRewriteRedirect" stepKey="openStorefrontUrlRedirectPath">
48+
<argument name="category" value="$$category.name$$"/>
49+
<argument name="newRequestPath" value="newrequestpath.html"/>
50+
</actionGroup>
51+
</test>
52+
</tests>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateCategoryUrlRewriteAndAddTemporaryRedirectTest">
11+
<annotations>
12+
<stories value="Create category URL rewrite"/>
13+
<title value="Create category URL rewrite, with temporary redirect"/>
14+
<description value="Login as admin and create category UrlRewrite with Temporary redirect"/>
15+
<testCaseId value="MC-5336"/>
16+
<severity value="CRITICAL"/>
17+
<group value="mtf_migrated"/>
18+
</annotations>
19+
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/>
22+
<createData entity="_defaultCategory" stepKey="category"/>
23+
</before>
24+
<after>
25+
<deleteData createDataKey="category" stepKey="deleteRootCategory"/>
26+
<actionGroup ref="logout" stepKey="logout"/>
27+
</after>
28+
29+
<!--Open Url Rewrite Index Page and update the Custom Url Rewrite, Store, Request Path, Redirect Type and Description -->
30+
<actionGroup ref="AdminAddUrlRewrite" stepKey="addUrlRewrite">
31+
<argument name="category" value="$$category.name$$"/>
32+
<argument name="customUrlRewriteValue" value="For Category'"/>
33+
<argument name="storeValue" value="Default Store View"/>
34+
<argument name="requestPath" value="newrequestpath.html"/>
35+
<argument name="redirectTypeValue" value="Temporary (302)"/>
36+
<argument name="description" value="End To End Test"/>
37+
</actionGroup>
38+
39+
<!-- Assert Redirect path, Target Path and Redirect type in grid -->
40+
<actionGroup ref="AdminSearchByRequestPath" stepKey="searchByRequestPath">
41+
<argument name="redirectPath" value="newrequestpath.html" />
42+
<argument name="redirectType" value="Temporary (302)" />
43+
<argument name="targetPath" value="$$category.name_lwr$$.html"/>
44+
</actionGroup>
45+
46+
<!--Assert Updated path directs to the category storefront -->
47+
<actionGroup ref="StorefrontUrlRewriteRedirect" stepKey="openStorefrontUrlRedirectPath">
48+
<argument name="category" value="$$category.name$$"/>
49+
<argument name="newRequestPath" value="newrequestpath.html"/>
50+
</actionGroup>
51+
</test>
52+
</tests>

0 commit comments

Comments
 (0)