Skip to content

Commit

Permalink
Merge pull request #86 from magento-pangolin/MC-4439
Browse files Browse the repository at this point in the history
  • Loading branch information
tomreece authored Apr 9, 2019
2 parents 643eb80 + 5746022 commit cb215ff
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminCatalogSearchTermNewSection">
<element name="searchQuery" type="text" selector="//div[@class='admin__field-control control']/input[@id='query_text']"/>
<element name="store" type="text" selector="//select[@id='store_id']"/>
<element name="searchQuery" type="text" selector="#query_text"/>
<element name="store" type="text" selector="#store_id"/>
<element name="numberOfResults" type="button" selector="#num_results"/>
<element name="numberOfUses" type="button" selector="#popularity"/>
<element name="redirectUrl" type="text" selector="//div[@class='admin__field-control control']/input[@id='redirect']"/>
<element name="displayInSuggestedTerm" type="select" selector="//select[@name='display_in_terms']"/>
<element name="saveSearchButton" type="button" selector="//button[@id='save']/span[@class='ui-button-text']" timeout="30"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?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="StorefrontUpdateSearchTermEntityTest">
<annotations>
<stories value="Storefront Search"/>
<title value="Update Storefront Search Results"/>
<description value="You should see the updated Search Term on the Storefront via the Admin."/>
<testCaseId value="MC-13987"/>
<severity value="CRITICAL"/>
<group value="search"/>
<group value="mtf_migrated"/>
</annotations>

<before>
<createData entity="_defaultCategory" stepKey="createCategory1"/>
<createData entity="SimpleProduct" stepKey="createProduct1">
<requiredEntity createDataKey="createCategory1"/>
</createData>

<amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage1"/>
<waitForPageLoad stepKey="waitForPageLoad1"/>
</before>
<after>
<actionGroup ref="logout" stepKey="logoutOfAdmin1"/>

<deleteData createDataKey="createProduct1" stepKey="deleteSimpleProduct1"/>
<deleteData createDataKey="createCategory1" stepKey="deleteCategory1"/>
</after>

<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByProductName1">
<argument name="phrase" value="$$createProduct1.name$$"/>
</actionGroup>

<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/>

<amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openAdminCatalogSearchTermIndexPage1"/>
<waitForPageLoad stepKey="waitForPageLoad1"/>

<actionGroup ref="searchTermFilterBySearchQuery" stepKey="filterByFirstSearchQuery1">
<argument name="searchQuery" value="$$createProduct1.name$$"/>
</actionGroup>

<click selector="{{AdminGridRow.editByValue($$createProduct1.name$$)}}" stepKey="clickOnSearchResult1"/>
<waitForPageLoad stepKey="waitForPageLoad2"/>

<actionGroup ref="AdminFillAllSearchTermFieldsActionGroup" stepKey="searchForSearchTerm1">
<argument name="searchTerm" value="UpdatedSearchTermData1"/>
</actionGroup>

<amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openAdminCatalogSearchTermIndexPage2"/>
<waitForPageLoad stepKey="waitForPageLoad3"/>

<actionGroup ref="searchTermFilterBySearchQuery" stepKey="filterByFirstSearchQuery2">
<argument name="searchQuery" value="{{UpdatedSearchTermData1.query_text}}"/>
</actionGroup>

<amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage2"/>
<waitForPageLoad stepKey="waitForPageLoad4"/>

<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByProductName2">
<argument name="phrase" value="{{UpdatedSearchTermData1.query_text}}"/>
</actionGroup>
</test>
</tests>
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="AdminFillAllSearchTermFieldsActionGroup">
<arguments>
<argument name="searchTerm" type="entity"/>
</arguments>

<fillField selector="{{AdminCatalogSearchTermNewSection.searchQuery}}" userInput="{{searchTerm.query_text}}" stepKey="fillSearchQuery1"/>
<selectOption selector="{{AdminCatalogSearchTermNewSection.store}}" userInput="{{searchTerm.store_id}}" stepKey="selectStore1"/>
<fillField selector="{{AdminCatalogSearchTermNewSection.numberOfResults}}" userInput="{{searchTerm.number_of_results}}" stepKey="fillNumberOfResults1"/>
<fillField selector="{{AdminCatalogSearchTermNewSection.numberOfUses}}" userInput="{{searchTerm.number_of_uses}}" stepKey="fillNumberOfUses1"/>
<selectOption selector="{{AdminCatalogSearchTermNewSection.displayInSuggestedTerm}}" userInput="{{searchTerm.display_in_suggested_term}}" stepKey="selectDisplayInSuggestedTerms1"/>

<click selector="{{AdminConfigSection.saveButton}}" stepKey="clickOnSaveButton1"/>
</actionGroup>
</actionGroups>
8 changes: 8 additions & 0 deletions app/code/Magento/Search/Test/Mftf/Data/SearchTermData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@
<data key="redirect" unique="suffix">http://example.com/</data>
<data key="display_in_terms">0</data>
</entity>
<entity name="UpdatedSearchTermData1" type="searchTerm">
<data key="query_text" unique="suffix">UpdatedSearchTerm</data>
<data key="store_id">Default Store View</data>
<data key="number_of_results">1</data>
<data key="number_of_uses">20</data>
<data key="redirect_url">http://example.com</data>
<data key="display_in_suggested_term">No</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<data name="searchTerm/data/popularity" xsi:type="string">20</data>
<data name="searchTerm/data/redirect" xsi:type="string">http://example.com/</data>
<data name="searchTerm/data/display_in_terms" xsi:type="string">No</data>
<data name="tag" xsi:type="string">mftf_migrated:yes</data>
<constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermSuccessSaveMessage" />
<constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermForm" />
<constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermInGrid" />
Expand Down

0 comments on commit cb215ff

Please sign in to comment.