Skip to content

Commit

Permalink
ENGCOM-7487: covered mftf test to create new search term #26704
Browse files Browse the repository at this point in the history
  • Loading branch information
slavvka committed Apr 30, 2020
2 parents 6e81326 + 6dd0719 commit c135b2a
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?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="AdminFillSearchTermActionGroup">
<annotations>
<description>Fills the search terms form with sample data.</description>
</annotations>
<arguments>
<argument name="searchQuery" type="string"/>
<argument name="store" type="string"/>
<argument name="redirectUrl" type="string"/>
<argument name="suggestedTerms" type="string"/>
</arguments>
<!-- Fill form fields -->
<fillField selector="{{AdminSearchTermsPageFormFieldsSection.query_text}}" userInput="{{searchQuery}}" stepKey="fillFieldSearchQuery"/>
<selectOption selector="{{AdminSearchTermsPageFormFieldsSection.store_id}}" userInput="{{store}}" stepKey="selectStoreView"/>
<fillField selector="{{AdminSearchTermsPageFormFieldsSection.redirect}}" userInput="{{redirectUrl}}" stepKey="fillFieldRedirectUrl"/>
<selectOption selector="{{AdminSearchTermsPageFormFieldsSection.display_in_terms}}" userInput="{{suggestedTerms}}" stepKey="selectSuggestedTerms" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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="AdminOpenNewSearchTermsPageActionGroup">
<annotations>
<description>Navigate to search terms form page.</description>
</annotations>
<amOnPage url="{{AdminSearchTermsFormPage.url}}" stepKey="amOnSearchTermsForm"/>
<waitForPageLoad stepKey="waitForPageLoad1"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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="AdminSaveSearchTermActionGroup">
<annotations>
<description>Save a new search term from Magento admin.</description>
</annotations>
<!-- Click save action and verify success message -->
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveSearchButton"/>
</actionGroup>
</actionGroups>
17 changes: 17 additions & 0 deletions app/code/Magento/AdvancedSearch/Test/Mftf/Data/SearchTermsData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
<entity name="SearchTerms">
<data key="searchQuery" unique="suffix">books</data>
<data key="store">Default Store View</data>
<data key="redirectUrl">http://sample.com</data>
<data key="suggestedTerms">1</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminSearchTermsFormPage" url="search/term/new/" area="admin" module="Magento_AdvancedSearch">
<section name="AdminSearchTermsPageFormFieldsSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminSearchTermsPageFormFieldsSection">
<element name="query_text" type="input" selector="#query_text"/>
<element name="store_id" type="select" selector="#store_id"/>
<element name="redirect" type="input" selector="#redirect"/>
<element name="display_in_terms" type="select" selector="#display_in_terms"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?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="AdminAddSearchTermTest">
<annotations>
<features value="AdvancedSearch"/>
<stories value="Add a new search term"/>
<title value="Admin should be able to create a new search term"/>
<description value="Admin should be able to create a new search term using search terms grid"/>
<severity value="CRITICAL"/>
<group value="AdvancedSearch"/>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</before>
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<actionGroup ref="AdminOpenNewSearchTermsPageActionGroup" stepKey="navigateToSearchTermPage"/>
<actionGroup ref="AdminFillSearchTermActionGroup" stepKey="fillNewSearchTermData">
<argument name="searchQuery" value="{{SearchTerms.searchQuery}}"/>
<argument name="store" value="{{SearchTerms.store}}"/>
<argument name="redirectUrl" value="{{SearchTerms.redirectUrl}}"/>
<argument name="suggestedTerms" value="{{SearchTerms.suggestedTerms}}"/>
</actionGroup>
<actionGroup ref="AdminSaveSearchTermActionGroup" stepKey="saveSearchTerm"/>
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSaveSearchTermSuccessMessage">
<argument name="message" value="You saved the search term."/>
<argument name="messageType" value="success"/>
</actionGroup>
</test>
</tests>

0 comments on commit c135b2a

Please sign in to comment.