10 use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
11 use Magento\Catalog\Test\Page\Product\CatalogProductView;
12 use Magento\CatalogSearch\Test\Page\CatalogsearchResult;
13 use Magento\Cms\Test\Page\CmsIndex;
14 use Magento\Mtf\Client\BrowserInterface;
15 use Magento\Mtf\Constraint\AbstractConstraint;
16 use Magento\Mtf\Fixture\FixtureInterface;
101 \PHPUnit\Framework\Assert::assertEmpty(
103 "In the process of checking product availability on the frontend, found the following errors:\n" 119 $this->browser->open($_ENV[
'app_frontend_url'] .
$product->getUrlKey() .
'.html');
120 $titleBlock = $this->catalogProductView->getTitleBlock();
123 $errors[] =
'- the headline on the page does not match, the text should be -> "' 124 . self::NOT_FOUND_MESSAGE .
'".';
127 $this->cmsIndex->open();
128 $this->cmsIndex->getSearchBlock()->search(
$product->getSku());
129 if ($this->catalogSearchResult->getListProductBlock()->getProductItem(
$product)->isVisible()) {
130 $errors[] =
'- successful product search.';
133 $categoryName = (
$product->hasData(
'category_ids'))
135 : $this->category->getName();
136 $this->cmsIndex->open();
137 $this->cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
138 $isProductVisible = $this->catalogCategoryView->getListProductBlock()->getProductItem(
$product)->isVisible();
139 while (!$isProductVisible && $this->catalogCategoryView->getBottomToolbar()->nextPage()) {
140 $isProductVisible = $this->catalogCategoryView->getListProductBlock()
141 ->getProductItem(
$product)->isVisible();
144 if ($isProductVisible) {
145 $errors[] =
"- product with name '{$product->getName()}' is found in this category.";
158 return 'Assertion that the product is not available on the pages of the frontend.';
processAssert(CatalogProductView $catalogProductView, CatalogsearchResult $catalogSearchResult, CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, $product, BrowserInterface $browser, Category $category=null)
isNotDisplayingOnFrontendAssert(FixtureInterface $product)