/**
  * Assert that product rating is not displayed on frontend on product review
  *
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductSimple $product
  * @param Rating $productRating
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CatalogProductSimple $product, Rating $productRating, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getReviewSummary()->getAddReviewLink()->click();
     $reviewForm = $catalogProductView->getReviewFormBlock();
     \PHPUnit_Framework_Assert::assertFalse($reviewForm->isVisibleRating($productRating), 'Product rating "' . $productRating->getRatingCode() . '" is displayed.');
 }
 /**
  * Assert that the category cannot be accessed from the navigation bar in the frontend
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogCategory $category
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogCategory $category, Browser $browser)
 {
     $cmsIndex->open();
     \PHPUnit_Framework_Assert::assertFalse($cmsIndex->getTopmenu()->isCategoryVisible($category->getName()), 'Category can be accessed from the navigation bar in the frontend.');
     $browser->open($_ENV['app_frontend_url'] . $category->getUrlKey() . '.html');
     \PHPUnit_Framework_Assert::assertEquals(self::NOT_FOUND_MESSAGE, $cmsIndex->getTitleBlock()->getTitle(), 'Wrong page is displayed.');
 }
 /**
  * Assert that displayed category data on category page equals to passed from fixture
  *
  * @param CatalogCategory $category
  * @param CatalogCategory $initialCategory
  * @param FixtureFactory $fixtureFactory
  * @param CatalogCategoryView $categoryView
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogCategory $category, CatalogCategory $initialCategory, FixtureFactory $fixtureFactory, CatalogCategoryView $categoryView, Browser $browser)
 {
     $product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'default', 'data' => ['category_ids' => ['category' => $initialCategory]]]);
     $categoryData = array_merge($initialCategory->getData(), $category->getData());
     $product->persist();
     $url = $_ENV['app_frontend_url'] . strtolower($category->getUrlKey()) . '.html';
     $browser->open($url);
     \PHPUnit_Framework_Assert::assertEquals($url, $browser->getUrl(), 'Wrong page URL.' . "\nExpected: " . $url . "\nActual: " . $browser->getUrl());
     if (isset($categoryData['name'])) {
         $title = $categoryView->getTitleBlock()->getTitle();
         \PHPUnit_Framework_Assert::assertEquals($categoryData['name'], $title, 'Wrong page title.' . "\nExpected: " . $categoryData['name'] . "\nActual: " . $title);
     }
     if (isset($categoryData['description'])) {
         $description = $categoryView->getViewBlock()->getDescription();
         \PHPUnit_Framework_Assert::assertEquals($categoryData['description'], $description, 'Wrong category description.' . "\nExpected: " . $categoryData['description'] . "\nActual: " . $description);
     }
     if (isset($categoryData['default_sort_by'])) {
         $sortBy = strtolower($categoryData['default_sort_by']);
         $sortType = $categoryView->getTopToolbar()->getSelectSortType();
         \PHPUnit_Framework_Assert::assertEquals($sortBy, $sortType, 'Wrong sorting type.' . "\nExpected: " . $sortBy . "\nActual: " . $sortType);
     }
     if (isset($categoryData['available_sort_by'])) {
         $availableSortType = array_filter($categoryData['available_sort_by'], function (&$value) {
             return $value !== '-' && ucfirst($value);
         });
         if ($availableSortType) {
             $availableSortType = array_values($availableSortType);
             $availableSortTypeOnPage = $categoryView->getTopToolbar()->getSortType();
             \PHPUnit_Framework_Assert::assertEquals($availableSortType, $availableSortTypeOnPage, 'Wrong available sorting type.' . "\nExpected: " . implode(PHP_EOL, $availableSortType) . "\nActual: " . implode(PHP_EOL, $availableSortTypeOnPage));
         }
     }
 }
 /**
  * Assert that displayed product bundle items data on product page equals passed from fixture preset
  *
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductBundle $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CatalogProductBundle $product, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->clickCustomize();
     $result = $this->displayedBundleBlock($catalogProductView, $product);
     \PHPUnit_Framework_Assert::assertTrue(empty($result), $result);
 }
 /**
  * Assert Link block for downloadable product on front-end
  *
  * @param CatalogProductView $downloadableProductView
  * @param CatalogProductDownloadable $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $downloadableProductView, CatalogProductDownloadable $product, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $linksBlock = $downloadableProductView->getDownloadableViewBlock()->getDownloadableLinksBlock();
     $fields = $product->getData();
     // Title for for Link block
     \PHPUnit_Framework_Assert::assertEquals($linksBlock->getTitleForLinkBlock(), $fields['downloadable_links']['title'], 'Title for for Link block for downloadable product on front-end is not correct.');
     $this->sortDownloadableArray($fields['downloadable_links']['downloadable']['link']);
     foreach ($fields['downloadable_links']['downloadable']['link'] as $index => $link) {
         $index++;
         // Titles for each links
         // Links are displaying according to Sort Order
         \PHPUnit_Framework_Assert::assertEquals($linksBlock->getItemTitle($index), $link['title'], 'Link item ' . $index . ' with title "' . $link['title'] . '" is not visible.');
         // If Links can be Purchase Separately, check-nob is presented near each link
         // If Links CANNOT be Purchase Separately, check-nob is not presented near each link
         if ($fields['downloadable_links']['links_purchased_separately'] == "Yes") {
             \PHPUnit_Framework_Assert::assertTrue($linksBlock->isVisibleItemCheckbox($index), 'Item ' . $index . ' link block CANNOT be Purchase Separately.');
             // Price is equals passed according to fixture
             $link['price'] = sprintf('$%1.2f', $link['price']);
             \PHPUnit_Framework_Assert::assertEquals($linksBlock->getItemPrice($index), $link['price'], 'Link item ' . $index . ' price is not visible.');
         } elseif ($fields['downloadable_links']['links_purchased_separately'] == "No") {
             \PHPUnit_Framework_Assert::assertFalse($linksBlock->isVisibleItemCheckbox($index), 'Item ' . $index . ' link block can be Purchase Separately.');
         }
     }
 }
 /**
  * Assert that created entity was found on search page
  *
  * @param UrlRewrite $initialRewrite
  * @param UrlRewrite $urlRewrite
  * @param Browser $browser
  * @param CatalogCategoryView $categoryView
  * @return void
  */
 public function processAssert(UrlRewrite $initialRewrite, UrlRewrite $urlRewrite, Browser $browser, CatalogCategoryView $categoryView)
 {
     $urlRequestPath = $urlRewrite->hasData('request_path') ? $urlRewrite->getRequestPath() : $initialRewrite->getRequestPath();
     $browser->open($_ENV['app_frontend_url'] . $urlRequestPath);
     $entity = $initialRewrite->getDataFieldConfig('id_path')['source']->getEntity()->getName();
     \PHPUnit_Framework_Assert::assertTrue($categoryView->getListProductBlock()->isProductVisible($entity), "Created entity '{$entity}' isn't found.");
 }
Esempio n. 7
0
 /**
  * @param CatalogProductView $catalogProductView
  * @param Browser $browser
  * @param CatalogProductSimple $product
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, Browser $browser, CatalogProductSimple $product)
 {
     //Open product view page
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     //Process assertions
     $this->assertOnProductView($product, $catalogProductView);
 }
 /**
  * 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;
 }
 /**
  * Assert that displayed price for bundle items on shopping cart page equals to passed from fixture.
  *   Price for bundle items has two options:
  *   1. Fixed (price of bundle product)
  *   2. Dynamic (price of bundle item)
  *
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductBundle $product
  * @param CheckoutCart $checkoutCartView
  * @param Browser $browser
  * @param CatalogProductBundle $originalProduct [optional]
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CatalogProductBundle $product, CheckoutCart $checkoutCartView, Browser $browser, CatalogProductBundle $originalProduct = null)
 {
     $checkoutCartView->open()->getCartBlock()->clearShoppingCart();
     //Open product view page
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     //Process assertions
     $this->assertPrice($product, $catalogProductView, $checkoutCartView, $originalProduct);
 }
 /**
  * Assert that outside redirect was success
  *
  * @param UrlRewrite $urlRewrite
  * @param Browser $browser
  * @param UrlRewrite|null $initialRewrite [optional]
  * @return void
  */
 public function processAssert(UrlRewrite $urlRewrite, Browser $browser, UrlRewrite $initialRewrite = null)
 {
     $urlRequestPath = $urlRewrite->hasData('request_path') ? $urlRewrite->getRequestPath() : $initialRewrite->getRequestPath();
     $urlTargetPath = $urlRewrite->hasData('target_path') ? $urlRewrite->getTargetPath() : $initialRewrite->getTargetPath();
     $browser->open($_ENV['app_frontend_url'] . $urlRequestPath);
     $browserUrl = $browser->getUrl();
     \PHPUnit_Framework_Assert::assertEquals($browserUrl, $urlTargetPath, 'URL rewrite redirect false.' . "\nExpected: " . $urlTargetPath . "\nActual: " . $browserUrl);
 }
 /**
  * Assert that product rating is not displayed on frontend on product review
  *
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductSimple $product
  * @param Rating $productRating
  * @param Browser $browser
  * @param ReviewInjectable $review
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CatalogProductSimple $product, Rating $productRating, Browser $browser, ReviewInjectable $review = null)
 {
     $product = $review === null ? $product : $review->getDataFieldConfig('entity_id')['source']->getEntity();
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getReviewSummary()->getAddReviewLink()->click();
     $reviewForm = $catalogProductView->getReviewFormBlock();
     \PHPUnit_Framework_Assert::assertFalse($reviewForm->isVisibleRating($productRating), 'Product rating "' . $productRating->getRatingCode() . '" is displayed.');
 }
 /**
  * Assertion that tier prices are displayed correctly
  *
  * @param CatalogProductView $catalogProductView
  * @param Browser $browser
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, Browser $browser, FixtureInterface $product)
 {
     // TODO fix initialization url for frontend page
     //Open product view page
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     //Process assertions
     $this->assertPrice($product, $catalogProductView);
 }
 /**
  * Assert check URL rewrite custom redirect
  *
  * @param UrlRewrite $urlRewrite
  * @param Browser $browser
  * @param CmsIndex $cmsIndex
  * @return void
  */
 public function processAssert(UrlRewrite $urlRewrite, Browser $browser, CmsIndex $cmsIndex)
 {
     $browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath());
     $entity = $urlRewrite->getDataFieldConfig('id_path')['source']->getEntity();
     $title = $entity->hasData('name') ? $entity->getName() : $entity->getTitle();
     $pageTitle = $cmsIndex->getTitleBlock()->getTitle();
     \PHPUnit_Framework_Assert::assertEquals($pageTitle, $title, 'URL rewrite product redirect false.' . "\nExpected: " . $title . "\nActual: " . $pageTitle);
 }
 /**
  * Assert that displayed product data on product page(front-end) equals passed from fixture:
  * 1. Product Name
  * 2. Price
  * 3. Special price
  * 4. SKU
  * 5. Description
  * 6. Short Description
  *
  * @param Browser $browser
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(Browser $browser, CatalogProductView $catalogProductView, FixtureInterface $product)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $this->product = $product;
     $this->productView = $catalogProductView->getViewBlock();
     $errors = $this->verify();
     \PHPUnit_Framework_Assert::assertEmpty($errors, "\nFound the following errors:\n" . implode(" \n", $errors));
 }
 /**
  * Assertion that the product is correctly displayed in cart
  *
  * @param Browser $browser
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param ConfigurableProductInjectable $product
  * @return void
  */
 public function processAssert(Browser $browser, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, ConfigurableProductInjectable $product)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $checkoutData = $product->getCheckoutData();
     $price = $checkoutCart->getCartBlock()->getCartItem($product)->getPrice();
     \PHPUnit_Framework_Assert::assertEquals($checkoutData['cartItem']['price'], $price, 'Product price in shopping cart is not correct.');
 }
 /**
  * Check that product available by new URL on the front
  *
  * @param UrlRewrite $urlRewrite
  * @param CatalogProductView $catalogProductView
  * @param Browser $browser
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(UrlRewrite $urlRewrite, CatalogProductView $catalogProductView, Browser $browser, InjectableFixture $product = null)
 {
     $browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath());
     if ($product === null) {
         $product = $urlRewrite->getDataFieldConfig('id_path')['source']->getEntity();
     }
     \PHPUnit_Framework_Assert::assertEquals($catalogProductView->getTitleBlock()->getTitle(), $product->getName(), 'URL rewrite product redirect false.' . "\nExpected: " . $product->getName() . "\nActual: " . $catalogProductView->getTitleBlock()->getTitle());
 }
 /**
  * Assert that displayed assigned products on category page equals passed from fixture
  *
  * @param CatalogCategory $category
  * @param CatalogCategoryView $categoryView
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogCategory $category, CatalogCategoryView $categoryView, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . strtolower($category->getUrlKey()) . '.html');
     $products = $category->getDataFieldConfig('category_products')['source']->getProducts();
     foreach ($products as $productFixture) {
         \PHPUnit_Framework_Assert::assertTrue($categoryView->getListProductBlock()->isProductVisible($productFixture->getName()), "Products '{$productFixture->getName()}' not find.");
     }
 }
 /**
  * Assert that default qty for sub products in grouped product displays according to dataset on product page.
  *
  * @param CatalogProductView $groupedProductView
  * @param CatalogProductGrouped $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $groupedProductView, CatalogProductGrouped $product, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $groupedBlock = $groupedProductView->getGroupedViewBlock()->getGroupedProductBlock();
     $groupedProduct = $product->getData();
     foreach ($groupedProduct['associated']['assigned_products'] as $item) {
         \PHPUnit_Framework_Assert::assertEquals($groupedBlock->getQty($item['id']), $item['qty'], 'Default qty for sub product "' . $item['name'] . '" in grouped product according to dataset.');
     }
 }
 /**
  * Assertion that the product is correctly displayed in cart
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @param Browser $browser
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, Browser $browser, CheckoutCart $checkoutCart)
 {
     // Add product to cart
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->fillOptions($product);
     $catalogProductView->getViewBlock()->clickAddToCart();
     // Check price
     $this->assertOnShoppingCart($product, $checkoutCart);
 }
 /**
  * Assert that product review Not available on product page
  *
  * @param CatalogProductView $catalogProductView
  * @param ReviewInjectable $reviewInitial
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, ReviewInjectable $reviewInitial, Browser $browser)
 {
     /** @var CatalogProductSimple $product */
     $product = $reviewInitial->getDataFieldConfig('entity_id')['source']->getEntity();
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $reviewBlock = $catalogProductView->getCustomerReviewBlock();
     $catalogProductView->getViewBlock()->selectTab('Reviews');
     \PHPUnit_Framework_Assert::assertFalse($reviewBlock->isVisibleReviewItem(), 'Error, product review is displayed.');
 }
 /**
  * Assertion that tier prices are displayed correctly
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, Browser $browser)
 {
     //Open product view page
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $viewBlock = $catalogProductView->getViewBlock();
     $viewBlock->clickCustomize();
     //Process assertions
     $this->assertPrice($product, $catalogProductView);
 }
 /**
  * Assert Link block for downloadable product on front-end
  *
  * @param CatalogProductView $catalogProductView
  * @param DownloadableProductInjectable $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, DownloadableProductInjectable $product, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $fixtureDownloadableLinks = $this->prepareFixtureData($product);
     $pageOptions = $catalogProductView->getViewBlock()->getOptions($product);
     $pageDownloadableLinks = $this->preparePageData($pageOptions['downloadable_options']['downloadable_links']);
     $error = $this->verifyData($fixtureDownloadableLinks, $pageDownloadableLinks);
     \PHPUnit_Framework_Assert::assertEmpty($error, $error);
 }
Esempio n. 23
0
 /**
  * Add products to the cart
  *
  * @return void
  */
 public function run()
 {
     // Ensure that shopping cart is empty
     $this->checkoutCart->open()->getCartBlock()->clearShoppingCart();
     foreach ($this->products as $product) {
         $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
         $this->catalogProductView->getViewBlock()->clickAddToCart();
     }
 }
 /**
  * Open products
  *
  * @param array $products
  * @param string $total
  * @return void
  */
 protected function openProducts(array $products, $total)
 {
     $total = explode(', ', $total);
     foreach ($products as $key => $product) {
         for ($i = 0; $i < $total[$key]; $i++) {
             $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
         }
     }
 }
 /**
  * Assert that Compare Products block is presented on CMS pages.
  * Block contains information about compared products
  *
  * @param array $products
  * @param CmsIndex $cmsIndex
  * @param FixtureFactory $fixtureFactory
  * @param Browser $browser
  * @return void
  */
 public function processAssert(array $products, CmsIndex $cmsIndex, FixtureFactory $fixtureFactory, Browser $browser)
 {
     $newCmsPage = $fixtureFactory->createByCode('cmsPage', ['dataSet' => '3_column_template']);
     $newCmsPage->persist();
     $browser->open($_ENV['app_frontend_url'] . $newCmsPage->getIdentifier());
     foreach ($products as &$product) {
         $product = $product->getName();
     }
     \PHPUnit_Framework_Assert::assertEquals($products, $cmsIndex->getCompareProductsBlock()->getProducts(), 'Compare product block contains NOT valid information about compared products.');
 }
 /**
  * Add products to compare list
  *
  * @param array $products
  * @param AbstractConstraint $assert
  * @return void
  */
 protected function addProducts(array $products, AbstractConstraint $assert = null)
 {
     foreach ($products as $itemProduct) {
         $this->browser->open($_ENV['app_frontend_url'] . $itemProduct->getUrlKey() . '.html');
         $this->catalogProductView->getViewBlock()->clickAddToCompare();
         if ($assert !== null) {
             $this->productCompareAssert($assert, $itemProduct);
         }
     }
 }
 /**
  * Assert that product rating is displayed on product review(frontend)
  *
  * @param CatalogProductView $catalogProductView
  * @param Browser $browser
  * @param CatalogProductSimple $product
  * @param ReviewInjectable|null $review [optional]
  * @param Rating|null $productRating [optional]
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, Browser $browser, CatalogProductSimple $product, ReviewInjectable $review = null, Rating $productRating = null)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $reviewSummaryBlock = $catalogProductView->getReviewSummary();
     if ($reviewSummaryBlock->isVisible()) {
         $reviewSummaryBlock->getAddReviewLink()->click();
     }
     $rating = $productRating ? $productRating : $review->getDataFieldConfig('ratings')['source']->getRatings()[0];
     $reviewForm = $catalogProductView->getReviewFormBlock();
     \PHPUnit_Framework_Assert::assertTrue($reviewForm->isVisibleRating($rating), 'Product rating "' . $rating->getRatingCode() . '" is not displayed.');
 }
Esempio n. 28
0
 /**
  * Assertion that the product page is displayed correctly
  *
  * @param CatalogProductView $catalogProductView
  * @param Browser $browser
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, Browser $browser, FixtureInterface $product)
 {
     $this->product = $product;
     // TODO fix initialization url for frontend page
     //Open product view page
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $data = $this->prepareData($catalogProductView);
     $badValues = array_diff($data['onPage'], $data['fixture']);
     $errors = array_intersect_key($this->errorsMessages, array_keys($badValues));
     $errors += $this->verifySpecialPrice($catalogProductView);
     \PHPUnit_Framework_Assert::assertEmpty($errors, PHP_EOL . 'Found the following errors:' . PHP_EOL . implode(' ' . PHP_EOL, $this->errorsMessages));
 }
 /**
  * Verify product price on grouped product view page
  *
  * @param CatalogProductGrouped $product
  * @param CatalogProductView $catalogProductView
  * @param AssertPriceOnProductPageInterface $object
  * @param Browser $browser
  * @param string $typePrice [optional]
  * @return bool|string
  */
 protected function processAssertPrice(CatalogProductGrouped $product, CatalogProductView $catalogProductView, AssertPriceOnProductPageInterface $object, Browser $browser, $typePrice = '')
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $groupedData = $product->getAssociated();
     /** @var InjectableFixture $subProduct */
     foreach ($groupedData['products'] as $key => $subProduct) {
         //Process assertions
         $catalogProductView->getGroupedViewBlock()->{'item' . $typePrice . 'PriceProductBlock'}(++$key);
         $object->setErrorMessage(sprintf($this->errorMessage, $subProduct->getData('name')));
         $object->assertPrice($subProduct, $catalogProductView, 'Grouped');
     }
 }
 /**
  * Assertion that commodity options are displayed correctly
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $actualPrice = null;
     if ($this->isPrice) {
         $prices = $catalogProductView->getViewBlock()->getPriceBlock()->getPrice();
         $actualPrice = isset($prices['price_special_price']) ? $prices['price_special_price'] : $prices['price_regular_price'];
     }
     $fixtureCustomOptions = $this->prepareOptions($product, $actualPrice);
     $formCustomOptions = $catalogProductView->getViewBlock()->getOptions($product)['custom_options'];
     $error = $this->verifyData($fixtureCustomOptions, $formCustomOptions);
     \PHPUnit_Framework_Assert::assertEmpty($error, $error);
 }