Skip to content

Commit 9a98048

Browse files
committed
MFTF has been added.
1 parent 1b39196 commit 9a98048

File tree

5 files changed

+100
-0
lines changed

5 files changed

+100
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@
3838
<element name="storeViewDropdown" type="text" selector="//select[@name='store_id']/option[contains(.,'{{storeView}}')]" parameterized="true"/>
3939
<element name="inputByCodeRangeFrom" type="input" selector="input.admin__control-text[name='{{code}}[from]']" parameterized="true"/>
4040
<element name="inputByCodeRangeTo" type="input" selector="input.admin__control-text[name='{{code}}[to]']" parameterized="true"/>
41+
<element name="storeViewOptions" type="text" selector=".admin__data-grid-outer-wrap select[name='store_id'] > option[value='{{value}}']" parameterized="true"/>
4142
</section>
4243
</sections>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminCheckStoreViewOptionsActionGroup">
11+
<annotations>
12+
<description>Goes to the Catalog->Product filters and check store view options at the Store View dropdown</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="storeViewId" type="string"/>
16+
</arguments>
17+
<amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/>
18+
<waitForPageLoad stepKey="waitForProductCatalogPage"/>
19+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="clickFiltersButton"/>
20+
<click selector="{{AdminProductFiltersSection.storeViewDropDown}}" stepKey="clickStoreViewSwitchDropdown"/>
21+
<waitForElementVisible selector="{{AdminProductFiltersSection.storeViewDropDown}}" stepKey="waitForWebsiteAreVisible"/>
22+
<seeElement selector="{{AdminProductGridFilterSection.storeViewOptions(storeViewId)}}" stepKey="seeStoreViewOption"/>
23+
</actionGroup>
24+
</actionGroups>

app/code/Magento/Store/Test/Mftf/Data/StoreData.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,23 @@
206206
<data key="store_type">store</data>
207207
<data key="store_action">add</data>
208208
</entity>
209+
<!--Stores views with same name-->
210+
<entity name="customStoreViewSameNameFirst" type="store">
211+
<data key="name">sameNameStoreView</data>
212+
<data key="code" unique="suffix">storeViewCode</data>
213+
<data key="is_active">1</data>
214+
<data key="store_id">null</data>
215+
<data key="store_action">add</data>
216+
<data key="store_type">store</data>
217+
<requiredEntity type="storeGroup">customStoreGroup</requiredEntity>
218+
</entity>
219+
<entity name="customStoreViewSameNameSecond" type="store">
220+
<data key="name">sameNameStoreView</data>
221+
<data key="code" unique="suffix">storeViewCode</data>
222+
<data key="is_active">1</data>
223+
<data key="store_id">null</data>
224+
<data key="store_action">add</data>
225+
<data key="store_type">store</data>
226+
<requiredEntity type="storeGroup">customStoreGroup</requiredEntity>
227+
</entity>
209228
</entities>

app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection/AdminStoresGridSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
<element name="emptyText" type="text" selector="//tr[@class='data-grid-tr-no-data even']/td[@class='empty-text']"/>
2323
<element name="websiteName" type="text" selector="//td[@class='a-left col-website_title ']/a[contains(.,'{{websiteName}}')]" parameterized="true"/>
2424
<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"/>
25+
<element name="storeViewLinkInNthRow" type="text" selector="tr:nth-of-type({{row}}) &gt; .col-store_title &gt; a" parameterized="true"/>
2526
</section>
2627
</sections>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
9+
<test name="AdminCreateDuplicateNameStoreViewTest">
10+
<annotations>
11+
<features value="Store"/>
12+
<stories value="Create a store view in admin"/>
13+
<title value="Admin should be able to create a Store View with the same name"/>
14+
<description value="Admin should be able to create a Store View with the same name"/>
15+
<group value="storeView"/>
16+
<severity value="AVERAGE"/>
17+
</annotations>
18+
<before>
19+
<!--Create two store views with same name, but different codes-->
20+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
21+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createFirstStoreView">
22+
<argument name="StoreGroup" value="_defaultStoreGroup"/>
23+
<argument name="customStore" value="customStoreViewSameNameFirst"/>
24+
</actionGroup>
25+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createSecondStoreView">
26+
<argument name="StoreGroup" value="_defaultStoreGroup"/>
27+
<argument name="customStore" value="customStoreViewSameNameSecond"/>
28+
</actionGroup>
29+
</before>
30+
<after>
31+
<!--Delete both store views-->
32+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteFirstStoreView">
33+
<argument name="customStore" value="customStoreViewSameNameFirst"/>
34+
</actionGroup>
35+
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteSecondStoreView">
36+
<argument name="customStore" value="customStoreViewSameNameSecond"/>
37+
</actionGroup>
38+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
39+
</after>
40+
<!--Get Id of store views-->
41+
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToStoreViews"/>
42+
<click selector="{{AdminStoresGridSection.storeViewLinkInNthRow('2')}}" stepKey="openFirstViewPAge" />
43+
<grabFromCurrentUrl stepKey="getStoreViewIdFirst" regex="~/store_id/(\d+)/~"/>
44+
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToStoreViewsAgain"/>
45+
<click selector="{{AdminStoresGridSection.storeViewLinkInNthRow('3')}}" stepKey="openSecondViewPAge" />
46+
<grabFromCurrentUrl stepKey="getStoreViewIdSecond" regex="~/store_id/(\d+)/~"/>
47+
<!--Go to catalog -> product grid, open the filter and check the listed store view-->
48+
<actionGroup ref="AdminCheckStoreViewOptionsActionGroup" stepKey="checkFirstStoreView">
49+
<argument name="storeViewId" value="{$getStoreViewIdFirst}"/>
50+
</actionGroup>
51+
<actionGroup ref="AdminCheckStoreViewOptionsActionGroup" stepKey="checkSecondStoreView">
52+
<argument name="storeViewId" value="{$getStoreViewIdSecond}"/>
53+
</actionGroup>
54+
</test>
55+
</tests>

0 commit comments

Comments
 (0)