/**
  * Assert that after save a term search on edit term search page displays:
  *  - correct Search Query field passed from fixture
  *  - correct Synonym
  *  - correct Redirect URL
  *  - correct Suggested Terms
  *
  * @param CatalogSearchIndex $indexPage
  * @param CatalogSearchQuery $searchTerm
  * @return void
  */
 public function processAssert(CatalogSearchIndex $indexPage, CatalogSearchQuery $searchTerm)
 {
     $indexPage->open();
     $filters = ['search_query' => $searchTerm->getQueryText(), 'synonym_for' => $searchTerm->getSynonymFor(), 'redirect' => $searchTerm->getRedirect(), 'display_in_terms' => $searchTerm->getDisplayInTerms()];
     $indexPage->getGrid()->search($filters);
     \PHPUnit_Framework_Assert::assertTrue($indexPage->getGrid()->isRowVisible($filters, false), 'Row terms according to the filters is not found.');
 }
 /**
  * Check that after input some text(e.g. product name) into search field, drop-down window is appeared.
  * Window contains requested entity and number of quantity.
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogSearchQuery $catalogSearch
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogSearchQuery $catalogSearch)
 {
     $cmsIndex->open();
     $searchBlock = $cmsIndex->getSearchBlock();
     $queryText = $catalogSearch->getQueryText();
     $searchBlock->fillSearch($queryText);
     $isVisible = $catalogSearch->hasData('num_results') ? $searchBlock->isSuggestSearchVisible($queryText, $catalogSearch->getNumResults()) : $searchBlock->isSuggestSearchVisible($queryText);
     \PHPUnit_Framework_Assert::assertTrue($isVisible, 'Block "Suggest Search" when searching was not found.');
 }
 /**
  * Check suggest block visibility.
  *
  * @param CatalogSearchQuery $searchTerm
  * @return bool
  */
 protected function isSugestSearchIsVisible(CatalogSearchQuery $searchTerm)
 {
     $queryText = $searchTerm->getQueryText();
     $this->searchBlock->fillSearch($queryText);
     if ($searchTerm->hasData('num_results')) {
         $isVisible = $this->searchBlock->isSuggestSearchVisible($queryText, $searchTerm->getNumResults());
     } else {
         $isVisible = $this->searchBlock->isSuggestSearchVisible($queryText);
     }
     return $isVisible;
 }
 /**
  * Run suggest searching result test.
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogSearchQuery $catalogSearch
  * @return void
  */
 public function test(CmsIndex $cmsIndex, CatalogSearchQuery $catalogSearch)
 {
     // Steps:
     $cmsIndex->open();
     $cmsIndex->getSearchBlock()->search($catalogSearch->getQueryText());
 }
 /**
  * Assert that after save a search term on edit term search page displays:
  *  - correct Search Query field passed from fixture
  *  - correct Synonym For
  *  - correct Redirect URL
  *  - correct Display in Suggested Terms
  *
  * @param CatalogSearchIndex $indexPage
  * @param CatalogSearchEdit $editPage
  * @param CatalogSearchQuery $searchTerm
  * @return void
  */
 public function processAssert(CatalogSearchIndex $indexPage, CatalogSearchEdit $editPage, CatalogSearchQuery $searchTerm)
 {
     $indexPage->open()->getGrid()->searchAndOpen(['search_query' => $searchTerm->getQueryText()]);
     \PHPUnit_Framework_Assert::assertEquals($searchTerm->getData(), $editPage->getForm()->getData($searchTerm), 'This form "Search Term" does not match the fixture data.');
 }
 /**
  * Assert that you will be redirected to url from dataset.
  *
  * @param CmsIndex $cmsIndex
  * @param Browser $browser
  * @param CatalogSearchQuery $searchTerm
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, Browser $browser, CatalogSearchQuery $searchTerm)
 {
     $cmsIndex->open()->getSearchBlock()->search($searchTerm->getSynonymFor());
     \PHPUnit_Framework_Assert::assertEquals($searchTerm->getRedirect(), $browser->getUrl(), 'Redirect by synonym was not executed.');
 }