/**
  * Verify product displaying on frontend
  *
  * @param FixtureInterface $product
  * @return array
  */
 protected function isNotDisplayingOnFrontendAssert(FixtureInterface $product)
 {
     $errors = [];
     // Check the product page is not available
     // TODO fix initialization url for frontend page
     $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $titleBlock = $this->catalogProductView->getTitleBlock();
     if ($titleBlock->getTitle() !== self::NOT_FOUND_MESSAGE) {
         $errors[] = '- the headline on the page does not match, the text should be -> "' . self::NOT_FOUND_MESSAGE . '".';
     }
     $this->cmsIndex->open();
     $this->cmsIndex->getSearchBlock()->search($product->getSku());
     if ($this->catalogSearchResult->getListProductBlock()->isProductVisible($product->getName())) {
         $errors[] = '- successful product search.';
     }
     $categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $this->category->getName();
     $this->cmsIndex->open();
     $this->cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
     $isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
     while (!$isProductVisible && $this->catalogCategoryView->getBottomToolbar()->nextPage()) {
         $isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
     }
     if ($isProductVisible) {
         $errors[] = "- product with name '{$product->getName()}' is found in this category.";
     }
     return $errors;
 }
コード例 #2
0
 /**
  * Run test creation for advanced search entity.
  *
  * @param CatalogProductSimple $productSearch
  * @param CmsIndex $cmsIndex
  * @param AdvancedSearch $searchPage
  * @return void
  */
 public function test(CatalogProductSimple $productSearch, CmsIndex $cmsIndex, AdvancedSearch $searchPage)
 {
     $cmsIndex->open();
     $cmsIndex->getSearchBlock()->clickAdvancedSearchButton();
     $searchForm = $searchPage->getForm();
     $searchForm->fill($productSearch);
     $searchForm->submit();
 }
コード例 #3
0
 /**
  * Run test creation for advanced search entity
  *
  * @param array $products
  * @param CatalogProductSimple $productSearch
  * @param CmsIndex $cmsIndex
  * @param AdvancedSearch $searchPage
  * @return void
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function testSearch(array $products, CatalogProductSimple $productSearch, CmsIndex $cmsIndex, AdvancedSearch $searchPage)
 {
     $this->markTestIncomplete('MAGETWO-27664');
     $cmsIndex->open();
     $cmsIndex->getSearchBlock()->clickAdvancedSearchButton();
     $searchForm = $searchPage->getForm();
     $searchForm->fill($productSearch);
     $searchForm->submit();
 }
コード例 #4
0
 /**
  * Assert that product attribute is searchable on Frontend.
  *
  * @param CatalogProductAttribute $attribute
  * @param CmsIndex $cmsIndex
  * @param InjectableFixture $product
  * @param CatalogsearchResult $catalogSearchResult
  * @return void
  */
 public function processAssert(CatalogProductAttribute $attribute, CmsIndex $cmsIndex, InjectableFixture $product, CatalogsearchResult $catalogSearchResult)
 {
     $searchValue = $this->getSearchValue($attribute);
     $cmsIndex->open();
     $cmsIndex->getSearchBlock()->search($searchValue);
     $isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible();
     while (!$isVisible && $catalogSearchResult->getBottomToolbar()->nextPage()) {
         $isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible();
     }
     \PHPUnit_Framework_Assert::assertTrue($isVisible, 'Product attribute is not searchable on Frontend.');
 }
コード例 #5
0
 /**
  * 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);
     if ($catalogSearch->hasData('num_results')) {
         $isVisible = $searchBlock->isSuggestSearchVisible($queryText, $catalogSearch->getNumResults());
     } else {
         $isVisible = $searchBlock->isSuggestSearchVisible($queryText);
     }
     \PHPUnit_Framework_Assert::assertTrue($isVisible, 'Block "Suggest Search" when searching was not found');
 }
コード例 #6
0
 /**
  * Assert that product can be searched via Quick Search using searchable product attributes (Search by SKU)
  *
  * @param CatalogsearchResult $catalogSearchResult
  * @param CmsIndex $cmsIndex
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)
 {
     $cmsIndex->open();
     $cmsIndex->getSearchBlock()->search($product->getSku());
     $isInStock = $product->getQuantityAndStockStatus();
     if ($product->getVisibility() === 'Catalog' || isset($isInStock['is_in_stock']) && $isInStock['is_in_stock'] === 'Out of Stock') {
         $isVisible = !$catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
         $this->errorMessage = 'Product successfully found by SKU.';
         $this->successfulMessage = 'The product has not been found by SKU.';
     } else {
         $isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
     }
     \PHPUnit_Framework_Assert::assertTrue($isVisible, $this->errorMessage);
 }
コード例 #7
0
 /**
  * Assert that locale options can be changed and checks new text on index page.
  *
  * @param SystemConfig $systemConfig
  * @param Store $store
  * @param CmsIndex $cmsIndex
  * @param string $locale
  * @param string $welcomeText
  * @return void
  */
 public function processAssert(SystemConfig $systemConfig, Store $store, CmsIndex $cmsIndex, $locale, $welcomeText)
 {
     // Set locale options
     $systemConfig->open();
     $systemConfig->getPageActions()->selectStore($store->getGroupId() . "/" . $store->getName());
     $configGroup = $systemConfig->getForm()->getGroup('Locale Options');
     $configGroup->open();
     $configGroup->setValue('select-groups-locale-fields-code-value', $locale);
     $systemConfig->getPageActions()->save();
     $systemConfig->getMessagesBlock()->waitSuccessMessage();
     // Check presents income text on index page
     $cmsIndex->open();
     $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName());
     \PHPUnit_Framework_Assert::assertTrue($cmsIndex->getSearchBlock()->isPlaceholderContains($welcomeText), "Locale not applied.");
 }
コード例 #8
0
 /**
  * Assert that product can be searched via Quick Search using searchable product attributes (Search by SKU)
  *
  * @param CatalogsearchResult $catalogSearchResult
  * @param CmsIndex $cmsIndex
  * @param FixtureInterface $product
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)
 {
     $cmsIndex->open();
     $sku = $product->hasData('sku') !== false ? $product->getSku() : $product->getName();
     $cmsIndex->getSearchBlock()->search($sku);
     $quantityAndStockStatus = $product->getQuantityAndStockStatus();
     $stockStatus = isset($quantityAndStockStatus['is_in_stock']) ? $quantityAndStockStatus['is_in_stock'] : null;
     $isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible();
     while (!$isVisible && $catalogSearchResult->getBottomToolbar()->nextPage()) {
         $isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible();
     }
     if ($product->getVisibility() === 'Catalog' || $stockStatus === 'Out of Stock') {
         $isVisible = !$isVisible;
         list($this->errorMessage, $this->successfulMessage) = [$this->successfulMessage, $this->errorMessage];
     }
     \PHPUnit_Framework_Assert::assertTrue($isVisible, $this->errorMessage);
 }
 /**
  * Assert that products generated during configurable product creation - are not visible on frontend(by default).
  *
  * @param CatalogSearchResult $catalogSearchResult
  * @param CmsIndex $cmsIndex
  * @param ConfigurableProduct $product
  * @return void
  */
 public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, ConfigurableProduct $product)
 {
     $configurableAttributesData = $product->getConfigurableAttributesData();
     $errors = [];
     $cmsIndex->open();
     foreach ($configurableAttributesData['matrix'] as $variation) {
         $cmsIndex->getSearchBlock()->search($variation['sku']);
         $isVisibleProduct = $catalogSearchResult->getListProductBlock()->isProductVisible($variation['name']);
         while (!$isVisibleProduct && $catalogSearchResult->getBottomToolbar()->nextPage()) {
             $isVisibleProduct = $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
         }
         if ($isVisibleProduct) {
             $errors[] = sprintf("\nChild product with sku: \"%s\" is visible on frontend(by default).", $variation['sku']);
         }
     }
     \PHPUnit_Framework_Assert::assertEmpty($errors, implode(' ', $errors));
 }
コード例 #10
0
 /**
  * Assert that locale options can be changed and checks new text on index page.
  *
  * @param SystemConfig $systemConfig
  * @param Store $store
  * @param CmsIndex $cmsIndex
  * @param AdminCache $adminCache
  * @param string $locale
  * @param string $welcomeText
  */
 public function processAssert(SystemConfig $systemConfig, Store $store, CmsIndex $cmsIndex, AdminCache $adminCache, $locale, $welcomeText)
 {
     // Set locale options
     $systemConfig->open();
     $systemConfig->getPageActions()->selectStore($store->getGroupId() . "/" . $store->getName());
     $systemConfig->getModalBlock()->acceptAlert();
     $configGroup = $systemConfig->getForm()->getGroup('general', 'locale', 'code');
     $configGroup->setValue('general', 'locale', 'code', $locale);
     $systemConfig->getPageActions()->save();
     $systemConfig->getMessagesBlock()->waitSuccessMessage();
     // Flush cache
     $adminCache->open();
     $adminCache->getActionsBlock()->flushMagentoCache();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     // Check presents income text on index page
     $cmsIndex->open();
     if ($cmsIndex->getFooterBlock()->isStoreGroupSwitcherVisible() && $cmsIndex->getFooterBlock()->isStoreGroupVisible($store)) {
         $cmsIndex->getFooterBlock()->selectStoreGroup($store);
     }
     $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName());
     \PHPUnit_Framework_Assert::assertTrue($cmsIndex->getSearchBlock()->isPlaceholderContains($welcomeText), "Locale not applied.");
 }
コード例 #11
0
 /**
  * Run searching result test.
  *
  * @param CatalogSearchQuery $catalogSearch
  * @return void
  */
 public function test(CatalogSearchQuery $catalogSearch)
 {
     $this->cmsIndex->open();
     $this->cmsIndex->getSearchBlock()->search($catalogSearch->getQueryText());
 }
コード例 #12
0
 /**
  * Assert that product cannot be found via Quick Search using searchable product attributes.
  *
  * @param CatalogsearchResult $catalogSearchResult
  * @param CmsIndex $cmsIndex
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)
 {
     $cmsIndex->open();
     $cmsIndex->getSearchBlock()->search($product->getSku());
     \PHPUnit_Framework_Assert::assertFalse($catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible(), 'Product was found by SKU.');
 }
コード例 #13
0
 /**
  * Search products.
  *
  * @param string $productName
  * @param int $countSearch
  * @return void
  */
 protected function searchProducts($productName, $countSearch)
 {
     for ($i = 0; $i < $countSearch; $i++) {
         $this->cmsIndex->getSearchBlock()->search($productName);
     }
 }
コード例 #14
0
 /**
  * Run suggest searching result test
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogSearchQuery $catalogSearch
  * @return void
  */
 public function testSearch(CmsIndex $cmsIndex, CatalogSearchQuery $catalogSearch)
 {
     $cmsIndex->open();
     $cmsIndex->getSearchBlock()->search($catalogSearch->getQueryText());
 }