Skip to content

Commit

Permalink
Cover MFTF test
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Echo committed Feb 17, 2020
1 parent 0b94121 commit b0c0c59
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="ChangeSeoUrlKeyForSubCategoryWithoutRedirectActionGroup" extends="ChangeSeoUrlKeyForSubCategoryActionGroup">
<annotations>
<description>Requires navigation to subcategory creation/edit. Updates the Search Engine Optimization with uncheck Redirect Checkbox .</description>
</annotations>
<arguments>
<argument name="value" type="string"/>
</arguments>

<uncheckOption selector="{{AdminCategorySEOSection.UrlKeyRedirectCheckbox}}" stepKey="uncheckRedirectCheckbox" after="enterURLKey"/>
</actionGroup>
</actionGroups>
16 changes: 16 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@
<data key="is_active">false</data>
<data key="include_in_menu">false</data>
</entity>
<entity name="_defaultCategoryDifferentUrlStore" type="category">
<data key="name" unique="suffix">SimpleCategory</data>
<data key="name_lwr" unique="suffix">simplecategory</data>
<data key="is_active">true</data>
<data key="url_key_default_store" unique="suffix">default-simplecategory</data>
<data key="url_key_custom_store" unique="suffix">custom-simplecategory</data>
</entity>
<entity name="SimpleSubCategoryDifferentUrlStore" type="category">
<data key="name" unique="suffix">SimpleSubCategory</data>
<data key="name_lwr" unique="suffix">simplesubcategory</data>
<data key="is_active">true</data>
<data key="url_key_default_store" unique="suffix">default-simplesubcategory</data>
<data key="url_key_custom_store" unique="suffix">custom-simplesubcategory</data>
<data key="include_in_menu">true</data>
<var key="parent_id" entityType="category" entityKey="id" />
</entity>
<!-- Category from file "prepared-for-sample-data.csv"-->
<entity name="Gear" type="category">
<data key="name">Gear</data>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontAssertProductRewriteUrlSubCategoryActionGroup">
<annotations>
<description>Validates that the provided Product Title is present on the Rewrite URL with a subcategory page.</description>
</annotations>
<arguments>
<argument name="category" defaultValue="_defaultCategory"/>
<argument name="subCategory" defaultValue="SimpleSubCategory"/>
<argument name="product" defaultValue="SimpleProduct" />
</arguments>

<amOnPage url="{{category.url_key_default_store}}/{{subCategory.url_key_default_store}}/{{product.urlKey}}2.html" stepKey="goToProductPage"/>
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{product.name}}" stepKey="seeProductNameInStoreFront"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,12 @@
<data key="label">No</data>
<data key="value">0</data>
</entity>
<entity name="EnableCategoriesPathProductUrls">
<data key="path">catalog/seo/product_use_categories</data>
<data key="value">1</data>
</entity>
<entity name="DisableCategoriesPathProductUrls">
<data key="path">catalog/seo/product_use_categories</data>
<data key="value">0</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminRewriteProductWithTwoStoreTest">
<annotations>
<title value="Rewriting URL of product"/>
<description value="Rewriting URL of product. Verify the full URL address"/>
<group value="CatalogUrlRewrite"/>
</annotations>

<before>
<magentoCLI command="config:set {{EnableCategoriesPathProductUrls.path}} {{EnableCategoriesPathProductUrls.value}}" stepKey="enableUseCategoriesPath"/>
<magentoCLI command="cache:flush" stepKey="flushCache"/>

<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView" />
<createData entity="_defaultCategoryDifferentUrlStore" stepKey="defaultCategory"/>
<createData entity="SimpleSubCategoryDifferentUrlStore" stepKey="subCategory">
<requiredEntity createDataKey="defaultCategory"/>
</createData>
<createData entity="SimpleProduct" stepKey="simpleProduct">
<requiredEntity createDataKey="subCategory"/>
</createData>
</before>

<after>
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"/>
<actionGroup ref="logout" stepKey="logout"/>
<deleteData createDataKey="subCategory" stepKey="deleteSubCategory"/>
<deleteData createDataKey="defaultCategory" stepKey="deleteNewRootCategory"/>

<magentoCLI command="config:set {{DisableCategoriesPathProductUrls.path}} {{DisableCategoriesPathProductUrls.value}}" stepKey="disableUseCategoriesPath"/>
<magentoCLI command="cache:flush" stepKey="flushCache"/>
</after>

<actionGroup ref="NavigateToCreatedCategoryActionGroup" stepKey="navigateToCreatedDefaultCategory">
<argument name="Category" value="$$defaultCategory$$"/>
</actionGroup>
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="AdminSwitchDefaultStoreViewForDefaultCategory">
<argument name="storeView" value="_defaultStore.name"/>
</actionGroup>
<actionGroup ref="ChangeSeoUrlKeyForSubCategoryWithoutRedirectActionGroup" stepKey="changeSeoUrlKeyForDefaultCategoryDefaultStore">
<argument name="value" value="{{_defaultCategoryDifferentUrlStore.url_key_default_store}}"/>
</actionGroup>
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="AdminSwitchCustomStoreViewForDefaultCategory">
<argument name="storeView" value="customStore.name"/>
</actionGroup>
<actionGroup ref="ChangeSeoUrlKeyForSubCategoryWithoutRedirectActionGroup" stepKey="changeSeoUrlKeyForDefaultCategoryCustomStore">
<argument name="value" value="{{_defaultCategoryDifferentUrlStore.url_key_custom_store}}"/>
</actionGroup>

<actionGroup ref="NavigateToCreatedCategoryActionGroup" stepKey="navigateToCreatedSubCategory">
<argument name="Category" value="$$subCategory$$"/>
</actionGroup>
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="AdminSwitchDefaultStoreViewForSubCategory">
<argument name="storeView" value="_defaultStore.name"/>
</actionGroup>
<actionGroup ref="ChangeSeoUrlKeyForSubCategoryWithoutRedirectActionGroup" stepKey="changeSeoUrlKeyForSubCategoryDefaultStore">
<argument name="value" value="{{SimpleSubCategoryDifferentUrlStore.url_key_default_store}}"/>
</actionGroup>
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="AdminSwitchCustomStoreViewForSubCategory">
<argument name="storeView" value="customStore.name"/>
</actionGroup>
<actionGroup ref="ChangeSeoUrlKeyForSubCategoryWithoutRedirectActionGroup" stepKey="changeSeoUrlKeyForSubCategoryCustomStore">
<argument name="value" value="{{SimpleSubCategoryDifferentUrlStore.url_key_custom_store}}"/>
</actionGroup>

<actionGroup ref="StorefrontAssertProductRewriteUrlSubCategoryActionGroup" stepKey="validatesRewriteUrl">
<argument name="category" value="_defaultCategoryDifferentUrlStore"/>
<argument name="subCategory" value="SimpleSubCategoryDifferentUrlStore" />
<argument name="product" value="SimpleProduct" />
</actionGroup>

</test>
</tests>

0 comments on commit b0c0c59

Please sign in to comment.