예제 #1
0
 /**
  * Assert that after save a term search on edit term search page displays:
  *  - correct Search Query field passed from fixture
  *  - correct Store
  *  - correct Results
  *  - correct Uses
  *  - correct Synonym
  *  - correct Redirect URL
  *  - correct Suggested Terms
  *
  * @param CatalogSearchIndex $indexPage
  * @param CatalogSearchQuery $searchTerm
  * @return void
  */
 public function processAssert(CatalogSearchIndex $indexPage, CatalogSearchQuery $searchTerm)
 {
     $grid = $indexPage->open()->getGrid();
     $filters = ['search_query' => $searchTerm->getQueryText(), 'store_id' => $searchTerm->getStoreId(), 'results_from' => $searchTerm->getNumResults(), 'popularity_from' => $searchTerm->getPopularity(), 'synonym_for' => $searchTerm->getSynonymFor(), 'redirect' => $searchTerm->getRedirect(), 'display_in_terms' => strtolower($searchTerm->getDisplayInTerms())];
     $grid->search($filters);
     unset($filters['store_id']);
     \PHPUnit_Framework_Assert::assertTrue($grid->isRowVisible($filters, false), 'Row terms according to the filters is not found.');
 }
 /**
  * Assert that after delete a search term on grid page not displayed
  *
  * @param CatalogSearchIndex $indexPage
  * @param CatalogSearchQuery $searchTerm
  * @return void
  */
 public function processAssert(CatalogSearchIndex $indexPage, CatalogSearchQuery $searchTerm)
 {
     $queryText = $searchTerm->getQueryText();
     $grid = $indexPage->open()->getGrid();
     $filters = ['search_query' => $queryText, 'store_id' => $searchTerm->getStoreId(), 'results_from' => $searchTerm->getNumResults(), 'popularity_from' => $searchTerm->getPopularity(), 'redirect' => $searchTerm->getRedirect(), 'display_in_terms' => strtolower($searchTerm->getDisplayInTerms())];
     $grid->search($filters);
     unset($filters['store_id']);
     \PHPUnit_Framework_Assert::assertFalse($grid->isRowVisible($filters, false), 'Search term "' . $queryText . '" was found in grid.');
 }
 /**
  * Assert that after save a search term:
  *  - it displays in the Search field at the top of the page if type set of characters passed from fixture
  *  - after click 'Go' of Search field opens a results page if it was not specified Redirect URL
  *  - after click 'Go' of Search field a customer search redirects to a specific page (passed from fixture)
  *    if it was specified Redirect URL
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogSearchQuery $searchTerm
  * @param BrowserInterface $browser
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogSearchQuery $searchTerm, BrowserInterface $browser)
 {
     $errors = [];
     $this->searchBlock = $cmsIndex->open()->getSearchBlock();
     if ($searchTerm->hasData('display_in_terms') && $searchTerm->getDisplayInTerms() === 'Yes') {
         $errors = $this->checkSuggestSearch($searchTerm);
     }
     $this->searchBlock->search($searchTerm->getQueryText());
     $windowUrl = $browser->getUrl();
     $redirectUrl = $searchTerm->getRedirect();
     if ($windowUrl !== $redirectUrl) {
         $errors[] = '- url window (' . $windowUrl . ') does not match the url redirect(' . $redirectUrl . ')';
     }
     \PHPUnit_Framework_Assert::assertEmpty($errors, 'When checking on the frontend "Search terms" arose following errors:' . PHP_EOL . implode(PHP_EOL, $errors));
 }