Skip to content

Commit

Permalink
MFTF has been added.
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Hotel committed Aug 18, 2020
1 parent 1b39196 commit 9a98048
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@
<element name="storeViewDropdown" type="text" selector="//select[@name='store_id']/option[contains(.,'{{storeView}}')]" parameterized="true"/>
<element name="inputByCodeRangeFrom" type="input" selector="input.admin__control-text[name='{{code}}[from]']" parameterized="true"/>
<element name="inputByCodeRangeTo" type="input" selector="input.admin__control-text[name='{{code}}[to]']" parameterized="true"/>
<element name="storeViewOptions" type="text" selector=".admin__data-grid-outer-wrap select[name='store_id'] > option[value='{{value}}']" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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="AdminCheckStoreViewOptionsActionGroup">
<annotations>
<description>Goes to the Catalog->Product filters and check store view options at the Store View dropdown</description>
</annotations>
<arguments>
<argument name="storeViewId" type="string"/>
</arguments>
<amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/>
<waitForPageLoad stepKey="waitForProductCatalogPage"/>
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="clickFiltersButton"/>
<click selector="{{AdminProductFiltersSection.storeViewDropDown}}" stepKey="clickStoreViewSwitchDropdown"/>
<waitForElementVisible selector="{{AdminProductFiltersSection.storeViewDropDown}}" stepKey="waitForWebsiteAreVisible"/>
<seeElement selector="{{AdminProductGridFilterSection.storeViewOptions(storeViewId)}}" stepKey="seeStoreViewOption"/>
</actionGroup>
</actionGroups>
19 changes: 19 additions & 0 deletions app/code/Magento/Store/Test/Mftf/Data/StoreData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,23 @@
<data key="store_type">store</data>
<data key="store_action">add</data>
</entity>
<!--Stores views with same name-->
<entity name="customStoreViewSameNameFirst" type="store">
<data key="name">sameNameStoreView</data>
<data key="code" unique="suffix">storeViewCode</data>
<data key="is_active">1</data>
<data key="store_id">null</data>
<data key="store_action">add</data>
<data key="store_type">store</data>
<requiredEntity type="storeGroup">customStoreGroup</requiredEntity>
</entity>
<entity name="customStoreViewSameNameSecond" type="store">
<data key="name">sameNameStoreView</data>
<data key="code" unique="suffix">storeViewCode</data>
<data key="is_active">1</data>
<data key="store_id">null</data>
<data key="store_action">add</data>
<data key="store_type">store</data>
<requiredEntity type="storeGroup">customStoreGroup</requiredEntity>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
<element name="emptyText" type="text" selector="//tr[@class='data-grid-tr-no-data even']/td[@class='empty-text']"/>
<element name="websiteName" type="text" selector="//td[@class='a-left col-website_title ']/a[contains(.,'{{websiteName}}')]" parameterized="true"/>
<element name="gridCell" type="text" selector="//table[@class='data-grid']//tr[{{row}}]//td[count(//table[@class='data-grid']//tr//th[contains(., '{{column}}')]/preceding-sibling::th) +1 ]" parameterized="true"/>
<element name="storeViewLinkInNthRow" type="text" selector="tr:nth-of-type({{row}}) &gt; .col-store_title &gt; a" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?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="AdminCreateDuplicateNameStoreViewTest">
<annotations>
<features value="Store"/>
<stories value="Create a store view in admin"/>
<title value="Admin should be able to create a Store View with the same name"/>
<description value="Admin should be able to create a Store View with the same name"/>
<group value="storeView"/>
<severity value="AVERAGE"/>
</annotations>
<before>
<!--Create two store views with same name, but different codes-->
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createFirstStoreView">
<argument name="StoreGroup" value="_defaultStoreGroup"/>
<argument name="customStore" value="customStoreViewSameNameFirst"/>
</actionGroup>
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createSecondStoreView">
<argument name="StoreGroup" value="_defaultStoreGroup"/>
<argument name="customStore" value="customStoreViewSameNameSecond"/>
</actionGroup>
</before>
<after>
<!--Delete both store views-->
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteFirstStoreView">
<argument name="customStore" value="customStoreViewSameNameFirst"/>
</actionGroup>
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteSecondStoreView">
<argument name="customStore" value="customStoreViewSameNameSecond"/>
</actionGroup>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!--Get Id of store views-->
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToStoreViews"/>
<click selector="{{AdminStoresGridSection.storeViewLinkInNthRow('2')}}" stepKey="openFirstViewPAge" />
<grabFromCurrentUrl stepKey="getStoreViewIdFirst" regex="~/store_id/(\d+)/~"/>
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToStoreViewsAgain"/>
<click selector="{{AdminStoresGridSection.storeViewLinkInNthRow('3')}}" stepKey="openSecondViewPAge" />
<grabFromCurrentUrl stepKey="getStoreViewIdSecond" regex="~/store_id/(\d+)/~"/>
<!--Go to catalog -> product grid, open the filter and check the listed store view-->
<actionGroup ref="AdminCheckStoreViewOptionsActionGroup" stepKey="checkFirstStoreView">
<argument name="storeViewId" value="{$getStoreViewIdFirst}"/>
</actionGroup>
<actionGroup ref="AdminCheckStoreViewOptionsActionGroup" stepKey="checkSecondStoreView">
<argument name="storeViewId" value="{$getStoreViewIdSecond}"/>
</actionGroup>
</test>
</tests>

0 comments on commit 9a98048

Please sign in to comment.