Skip to content

Commit 0c9623a

Browse files
committed
add MFTF test
1 parent fbf5d3e commit 0c9623a

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<element name="sectionHeader" type="button" selector="div[data-index='search-engine-optimization']" timeout="30"/>
1313
<element name="urlKeyInput" type="input" selector="input[name='product[url_key]']"/>
1414
<element name="useDefaultUrl" type="checkbox" selector="input[name='use_default[url_key]']"/>
15+
<element name="urlKeyRedirectCheckbox" type="checkbox" selector="input[name='product[url_key_create_redirect]']"/>
1516
<element name="metaTitleInput" type="input" selector="input[name='product[meta_title]']"/>
1617
<element name="metaKeywordsInput" type="textarea" selector="textarea[name='product[meta_keyword]']"/>
1718
<element name="metaDescriptionInput" type="textarea" selector="textarea[name='product[meta_description]']"/>

app/code/Magento/CatalogUrlRewrite/Test/Mftf/Data/GenerateCategoryProductUrlRewriteConfigData.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,12 @@
2727
<data key="path">catalog/seo/product_use_categories</data>
2828
<data key="value">0</data>
2929
</entity>
30+
<entity name="EnableCreatePermanentRedirect">
31+
<data key="path">catalog/seo/save_rewrites_history</data>
32+
<data key="value">1</data>
33+
</entity>
34+
<entity name="DisableCreatePermanentRedirect">
35+
<data key="path">catalog/seo/save_rewrites_history</data>
36+
<data key="value">0</data>
37+
</entity>
3038
</entities>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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="AdminVerifyCheckboxIsDisabledCreatePermanentRedirectSetNoTest">
11+
<annotations>
12+
<features value="CatalogUrlRewrite"/>
13+
<stories value="Url rewrites"/>
14+
<title value="Verify checkbox is disabled 'Create Permanent Redirect' set 'No'"/>
15+
<description value="Verify checkbox is disabled 'Create Permanent Redirect' set 'No' on category and product edit page."/>
16+
</annotations>
17+
<before>
18+
<magentoCLI command="config:set {{DisableCreatePermanentRedirect.path}} {{DisableCreatePermanentRedirect.value}}" stepKey="enableCreatePermanentRedirect"/>
19+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
20+
<createData entity="_defaultCategory" stepKey="createDefaultCategory"/>
21+
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
22+
<requiredEntity createDataKey="createDefaultCategory"/>
23+
</createData>
24+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
25+
</before>
26+
<after>
27+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
28+
<deleteData createDataKey="createDefaultCategory" stepKey="deleteDefaultCategory"/>
29+
<magentoCLI command="config:set {{EnableCreatePermanentRedirect.path}} {{EnableCreatePermanentRedirect.value}}" stepKey="disableCreatePermanentRedirect"/>
30+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
31+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
32+
</after>
33+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage">
34+
<argument name="productId" value="$$createSimpleProduct.id$$"/>
35+
</actionGroup>
36+
<scrollTo selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="scrollToSeoSection" x="0" y="-120" />
37+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
38+
<grabValueFrom selector="{{AdminProductSEOSection.urlKeyRedirectCheckbox}}" stepKey="grabValue"/>
39+
<assertEmpty stepKey="checkUrlKeyRedirectCheckbox">
40+
<actualResult type="string">$grabValue</actualResult>
41+
</assertEmpty>
42+
43+
<actionGroup ref="NavigateToCreatedCategoryActionGroup" stepKey="openCreatedSubCategory">
44+
<argument name="Category" value="$$createDefaultCategory$$"/>
45+
</actionGroup>
46+
<scrollTo selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="scrollToSeoSection1" x="0" y="-120" />
47+
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection1"/>
48+
<grabValueFrom selector="{{AdminCategorySEOSection.UrlKeyRedirectCheckbox}}" stepKey="grabValue1"/>
49+
<assertEmpty stepKey="checkUrlKeyRedirectCheckbox1">
50+
<actualResult type="string">$grabValue1</actualResult>
51+
</assertEmpty>
52+
</test>
53+
</tests>

0 commit comments

Comments
 (0)