10 use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
11 use Magento\Cms\Test\Page\CmsIndex;
12 use Magento\Mtf\Constraint\AbstractConstraint;
13 use Magento\Mtf\Fixture\FixtureInterface;
30 CatalogCategoryView $catalogCategoryView,
37 if (
$product->hasData(
'category_ids')) {
38 $categoryIds =
$product->getCategoryIds();
39 $categoryName = is_array($categoryIds) ? reset($categoryIds) : $categoryName;
42 $cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
44 $isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem(
$product)->isVisible();
45 while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
46 $isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem(
$product)->isVisible();
49 \PHPUnit\Framework\Assert::assertTrue(
51 'Product is absent on category page.' 67 $priceBlock = $catalogCategoryView->getListProductBlock()->getProductItem(
$product)->getPriceBlock();
69 \PHPUnit\Framework\Assert::assertEquals(
70 number_format(
$product->getPrice(), 2,
'.',
''),
71 $priceBlock->isOldPriceVisible() ? $priceBlock->getOldPrice() : $priceBlock->getPrice(),
72 'Product regular price on category page is not correct.' 75 if (
$product->hasData(
'special_price')) {
76 \PHPUnit\Framework\Assert::assertEquals(
77 number_format(
$product->getSpecialPrice(), 2,
'.',
''),
78 $priceBlock->getSpecialPrice(),
79 'Product special price on category page is not correct.' 91 return 'Product price on category page correct.';
assertPrice(FixtureInterface $product, CatalogCategoryView $catalogCategoryView)
processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, FixtureInterface $product, Category $category)