Skip to content

Commit 3f37b18

Browse files
committed
MFTF test
1 parent 20d6fdf commit 3f37b18

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminCategorySearchTest">
12+
<annotations>
13+
<features value="Search Category"/>
14+
<stories value="Search categories in admin panel"/>
15+
<title value="Search for categories"/>
16+
<description value="Global search in backend can search into Categories."/>
17+
<severity value="MINOR"/>
18+
<group value="Search"/>
19+
</annotations>
20+
<before>
21+
<!-- Login as admin -->
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
24+
<!-- Create Simple Category -->
25+
<createData entity="SimpleSubCategory" stepKey="createSimpleCategory"/>
26+
</before>
27+
<after>
28+
<!-- Delete created category -->
29+
<deleteData createDataKey="createSimpleCategory" stepKey="deleteCreatedCategory"/>
30+
31+
<!-- Log out -->
32+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
33+
</after>
34+
<!-- Add created category name in the search field-->
35+
<actionGroup ref="AdminSetGlobalSearchValueActionGroup" stepKey="setSearch">
36+
<argument name="textSearch" value="$$createSimpleCategory.name$$"/>
37+
</actionGroup>
38+
39+
<!-- Wait for suggested results-->
40+
<waitForElementVisible selector="{{AdminGlobalSearchSection.globalSearchSuggestedCategoryText}}" stepKey="waitForSuggestions"/>
41+
42+
<!-- Click on suggested result in category URL-->
43+
<click selector="{{AdminGlobalSearchSection.globalSearchSuggestedCategoryLink}}" stepKey="openCategory"/>
44+
45+
<!-- Wait for suggested results-->
46+
<waitForPageLoad stepKey="waitForPageLoad"/>
47+
48+
<!-- Loaded page should be edit page of created category -->
49+
<seeInField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="$$createSimpleCategory.name$$" stepKey="checkCategoryName"/>
50+
</test>
51+
</tests>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="AdminSetGlobalSearchValueActionGroup">
12+
<arguments>
13+
<argument name="textSearch" type="string" defaultValue=""/>
14+
</arguments>
15+
16+
<click selector="{{AdminGlobalSearchSection.globalSearch}}" stepKey="clickSearchBtn"/>
17+
<waitForElementVisible selector="{{AdminGlobalSearchSection.globalSearchActive}}" stepKey="waitForSearchInputVisible"/>
18+
<fillField selector="{{AdminGlobalSearchSection.globalSearchInput}}" userInput="{{textSearch}}" stepKey="fillSearch"/>
19+
</actionGroup>
20+
</actionGroups>

app/code/Magento/Search/Test/Mftf/Section/AdminGlobalSearchSection.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
<section name="AdminGlobalSearchSection">
1212
<element name="globalSearch" type="button" selector=".search-global-label"/>
1313
<element name="globalSearchActive" type="block" selector=".search-global-field._active"/>
14+
<element name="globalSearchInput" type="input" selector=".search-global-input"/>
15+
<element name="globalSearchSuggestedCategoryText" type="text" selector="//span[contains(text(), 'Category')]"/>
16+
<element name="globalSearchSuggestedCategoryLink" type="text" selector="//span[contains(text(), 'Category')]/preceding-sibling::a"/>
1417
</section>
1518
</sections>

0 commit comments

Comments
 (0)