Skip to content

Commit dbdb75c

Browse files
committed
MAGETWO-94172: Elasticsearch 5.0+ exception is shown if customer searches product before reindexing
- added functional test for covering the use case
1 parent 4f755e6 commit dbdb75c

File tree

6 files changed

+176
-0
lines changed

6 files changed

+176
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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="ChooseElasticSearchAsSearchEngine">
12+
<amOnPage url="{{AdminCatalogSearchConfigurationPage.url}}" stepKey="configureSearchEngine"/>
13+
<waitForPageLoad stepKey="waitForConfigPage"/>
14+
<scrollTo selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" stepKey="scrollToCatalogSearchTab"/>
15+
<conditionalClick selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" dependentSelector="{{AdminCatalogSearchConfigurationSection.checkIfCatalogSearchTabExpand}}" visible="true" stepKey="expandCatalogSearchTab"/>
16+
<waitForElementVisible selector="{{AdminCatalogSearchConfigurationSection.searchEngine}}" stepKey="waitForDropdownToBeVisible"/>
17+
<uncheckOption selector="{{AdminCatalogSearchConfigurationSection.searchEngineDefaultSystemValue}}" stepKey="uncheckUseSystemValue"/>
18+
<selectOption selector="{{AdminCatalogSearchConfigurationSection.searchEngine}}" userInput="elasticsearch5" stepKey="chooseES5"/>
19+
<!--<scrollTo selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" stepKey="scrollToCatalogSearchTab2"/>-->
20+
<!--<click selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" stepKey="collapseCatalogSearchTab"/>-->
21+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration"/>
22+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the configuration." stepKey="seeConfigurationSuccessMessage"/>
23+
</actionGroup>
24+
<actionGroup name="ResetSearchEngineConfiguration">
25+
<amOnPage url="{{AdminCatalogSearchConfigurationPage.url}}" stepKey="resetSearchEngine"/>
26+
<waitForPageLoad stepKey="waitForConfigPage2"/>
27+
<scrollTo selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" stepKey="scrollToCatalogSearchTab2"/>
28+
<conditionalClick selector="{{AdminCatalogSearchConfigurationSection.catalogSearchTab}}" dependentSelector="{{AdminCatalogSearchConfigurationSection.checkIfCatalogSearchTabExpand}}" visible="true" stepKey="expandCatalogSearchTab2"/>
29+
<waitForElementVisible selector="{{AdminCatalogSearchConfigurationSection.searchEngine}}" stepKey="waitForDropdownToBeVisible2"/>
30+
<selectOption selector="{{AdminCatalogSearchConfigurationSection.searchEngine}}" userInput="mysql" stepKey="chooseMySQL"/>
31+
<checkOption selector="{{AdminCatalogSearchConfigurationSection.searchEngineDefaultSystemValue}}" stepKey="checkUseSystemValue"/>
32+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration2"/>
33+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the configuration." stepKey="seeConfigurationSuccessMessage2"/>
34+
</actionGroup>
35+
36+
</actionGroups>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
9+
<page name="AdminCatalogSearchConfigurationPage" url="admin/system_config/edit/section/catalog/" area="admin" module="Magento_Config">
10+
<section name="AdminCatalogSearchConfigurationSection"/>
11+
</page>
12+
</pages>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
9+
<section name="AdminCatalogSearchConfigurationSection">
10+
<element name="catalogSearchTab" type="button" selector="#catalog_search-head"/>
11+
<element name="checkIfCatalogSearchTabExpand" type="button" selector="#catalog_search-head:not(.open)"/>
12+
<element name="searchEngineDefaultSystemValue" type="checkbox" selector="#catalog_search_engine_inherit"/>
13+
<element name="searchEngine" type="select" selector="#catalog_search_engine"/>
14+
</section>
15+
</sections>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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="ProductQuickSearchUsingElasticSearchTest">
12+
<annotations>
13+
<features value="Search"/>
14+
<stories value="Quick Search of products on Storefront when ES 5.0+ is enabled"/>
15+
<title value="Product quick search doesn't throw exception after ES is chosen as search engine"/>
16+
<description value="Verify no elastic search exception is thrown when searching for product before catalogsearch reindexing"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MAGETWO-94995"/>
19+
<group value="Catalog"/>
20+
</annotations>
21+
<before>
22+
<createData entity="SimpleSubCategory" stepKey="categoryFirst"/>
23+
<createData entity="SimpleProduct" stepKey="simpleProduct1">
24+
<requiredEntity createDataKey="categoryFirst"/>
25+
</createData>
26+
</before>
27+
28+
<after>
29+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
30+
<deleteData createDataKey="categoryFirst" stepKey="deleteCategory"/>
31+
<actionGroup ref="ResetSearchEngineConfiguration" stepKey="resetCatalogSearchConfiguration"/>
32+
<actionGroup ref="updateIndexerOnSave" stepKey="resetIndexerBackToOriginalState">
33+
<argument name="indexerName" value="catalogsearch_fulltext"/>
34+
</actionGroup>
35+
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
36+
</after>
37+
38+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
39+
<comment userInput="Change Catalog search engine option to Elastic Search 5.0+" stepKey="chooseElasticSearch5"/>
40+
<actionGroup ref="ChooseElasticSearchAsSearchEngine" stepKey="chooseES5"/>
41+
<actionGroup ref="ClearPageCacheActionGroup" stepKey="clearing"/>
42+
<actionGroup ref="updateIndexerBySchedule" stepKey="updateAnIndexerBySchedule">
43+
<argument name="indexerName" value="catalogsearch_fulltext"/>
44+
</actionGroup>
45+
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
46+
<!--Navigate to storefront and do a quick search for the product -->
47+
<comment userInput="Navigate to Storefront to check if quick search works" stepKey="commentCheckQuickSearch" />
48+
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/>
49+
50+
<waitForPageLoad stepKey="waitForHomePageToLoad" time="30"/>
51+
<fillField userInput="Simple" selector="{{StorefrontQuickSearchSection.searchPhrase}}" stepKey="fillSearchBar"/>
52+
<waitForPageLoad stepKey="wait2" time="30"/>
53+
<click selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="clickSearchButton"/>
54+
<seeInCurrentUrl url="{{StorefrontCatalogSearchPage.url}}" stepKey="checkUrl"/>
55+
<seeInTitle userInput="Search results for: 'Simple'" stepKey="assertQuickSearchTitle"/>
56+
<see userInput="Search results for: 'Simple'" selector="{{StorefrontCatalogSearchMainSection.SearchTitle}}" stepKey="assertQuickSearchName"/>
57+
<comment userInput="End of searching products" stepKey="endOfSearchingProducts"/>
58+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin2"/>
59+
</test>
60+
</tests>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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="updateIndexerBySchedule">
12+
<arguments>
13+
<argument name="indexerName" type="string"/>
14+
</arguments>
15+
<amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/indexer/indexer/list/" stepKey="amOnIndexManagementPage"/>
16+
<waitForPageLoad stepKey="waitForIndexManagementPageToLoad"/>
17+
<click selector="{{AdminIndexManagementSection.indexerCheckbox(indexerName)}}" stepKey="selectIndexer1"/>
18+
<selectOption selector="{{AdminIndexManagementSection.massActionSelect}}" userInput="change_mode_changelog" stepKey="selectUpdateBySchedule"/>
19+
<click selector="{{AdminIndexManagementSection.massActionSubmit}}" stepKey="submitIndexerForm"/>
20+
<!-- No re-indexing is done as part of this actionGroup since the test required no re-indexing -->
21+
<waitForPageLoad stepKey="waitForSave"/>
22+
</actionGroup>
23+
<actionGroup name="updateIndexerOnSave">
24+
<arguments>
25+
<argument name="indexerName" type="string"/>
26+
</arguments>
27+
<amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}/indexer/indexer/list/" stepKey="amOnIndexManagementPage2"/>
28+
<waitForPageLoad stepKey="waitForIndexManagementPageToLoad2"/>
29+
<click selector="{{AdminIndexManagementSection.indexerCheckbox(indexerName)}}" stepKey="selectIndexer2"/>
30+
<selectOption selector="{{AdminIndexManagementSection.massActionSelect}}" userInput="change_mode_onthefly" stepKey="selectUpdateOnSave"/>
31+
<click selector="{{AdminIndexManagementSection.massActionSubmit}}" stepKey="submitIndexerForm2"/>
32+
<!-- No re-indexing is done as part of this actionGroup since the test required no re-indexing -->
33+
<waitForPageLoad stepKey="waitForSave2"/>
34+
35+
</actionGroup>
36+
</actionGroups>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminIndexManagementSection">
12+
<!--<element name="catalogSearchCheckbox" type="checkbox" selector="input[value='catalogsearch_fulltext']"/>-->
13+
<element name="indexerCheckbox" type="checkbox" selector="input[value='{{var1}}']" parameterized="true"/>
14+
<element name="massActionSelect" type="select" selector="#gridIndexer_massaction-select"/>
15+
<element name="massActionSubmit" type="button" selector="#gridIndexer_massaction-form button"/>
16+
</section>
17+
</sections>

0 commit comments

Comments
 (0)