/**
  * Assert that product is displayed in related products section.
  *
  * @param Browser $browser
  * @param CatalogProductSimple $product
  * @param InjectableFixture[] $relatedProducts
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 public function processAssert(Browser $browser, CatalogProductSimple $product, array $relatedProducts, CatalogProductView $catalogProductView)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     foreach ($relatedProducts as $relatedProduct) {
         \PHPUnit_Framework_Assert::assertTrue($catalogProductView->getRelatedProductBlock()->getItemBlock($relatedProduct)->isVisible(), "Product {$relatedProduct->getName()} is absent in related products.");
     }
 }
 /**
  * Assert that redirect from newCategory/oldProduct is correct to new product.
  *
  * @param InjectableFixture $product
  * @param InjectableFixture $initialProduct
  * @param Browser $browser
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 public function processAssert(InjectableFixture $product, InjectableFixture $initialProduct, Browser $browser, CatalogProductView $catalogProductView)
 {
     $category = $product->getDataFieldConfig('category_ids')['source']->getProductCategory();
     $productUrl = $_ENV['app_frontend_url'] . $category->getUrlKey() . '/' . $initialProduct->getUrlKey() . '.html';
     $browser->open($productUrl);
     \PHPUnit_Framework_Assert::assertEquals($catalogProductView->getViewBlock()->getProductName(), strtoupper($product->getName()));
 }
 /**
  * Assert that products' MAP has been applied before checkout.
  *
  * @param CatalogCategory $category
  * @param Customer $customer
  * @param Address $address
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $cart
  * @param CheckoutOnepage $checkoutOnePage
  * @param array $products
  * @return void
  */
 public function processAssert(CatalogCategory $category, Customer $customer, Address $address, CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, CatalogProductView $catalogProductView, CheckoutCart $cart, CheckoutOnepage $checkoutOnePage, array $products)
 {
     for ($i = 0; $i < count($products); $i++) {
         $cart->getCartBlock()->clearShoppingCart();
         $productName = $products[$i]->getName();
         $cmsIndex->open();
         $cmsIndex->getTopmenu()->selectCategory($category->getName());
         // Check that price is not present on category page.
         $listProductBlock = $catalogCategoryView->getListProductBlock();
         $productPriceBlock = $listProductBlock->getProductPriceBlock($productName);
         $productPriceBlock->clickForPrice();
         \PHPUnit_Framework_Assert::assertFalse($productPriceBlock->getMapBlock()->isPriceVisible(), 'Price is present in MSRP dialog on category page.');
         // Check that price is not present on product page.
         $listProductBlock->openProductViewPage($productName);
         \PHPUnit_Framework_Assert::assertFalse($catalogProductView->getViewBlock()->getPriceBlock()->isRegularPriceVisible(), 'Price is present in View block on product page.');
         // Check that price is not present on cart.
         $catalogProductView->getViewBlock()->addToCart($products[$i]);
         \PHPUnit_Framework_Assert::assertTrue($cart->getCartBlock()->getCartItem($products[$i])->isMsrpVisible(), "MSRP link is not visible in cart.");
         // Check that price is present on review block in onepage checkout page.
         $cart->getCartBlock()->getProceedToCheckoutBlock()->proceedToCheckout();
         $checkoutMethodBlock = $checkoutOnePage->getLoginBlock();
         $billingBlock = $checkoutOnePage->getBillingBlock();
         $paymentMethodBlock = $checkoutOnePage->getPaymentMethodsBlock();
         $shippingBlock = $checkoutOnePage->getShippingMethodBlock();
         $checkoutMethodBlock->guestCheckout();
         $checkoutMethodBlock->clickContinue();
         $billingBlock->fillBilling($address, $customer);
         $billingBlock->clickContinue();
         $shippingBlock->selectShippingMethod(['shipping_service' => 'Flat Rate', 'shipping_method' => 'Fixed']);
         $shippingBlock->clickContinue();
         $paymentMethodBlock->selectPaymentMethod(['method' => 'checkmo']);
         $paymentMethodBlock->clickContinue();
         \PHPUnit_Framework_Assert::assertEquals(number_format($products[$i]->getPrice(), 2), $checkoutOnePage->getReviewBlock()->getTotalBlock()->getData('subtotal'), "Subtotal in checkout one page for {$productName} is not equal to expected.");
     }
 }
 /**
  * Assert that products are displayed in up-sell section.
  *
  * @param Browser $browser
  * @param FixtureInterface $product
  * @param array $upSellProducts
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 public function processAssert(Browser $browser, FixtureInterface $product, array $upSellProducts, CatalogProductView $catalogProductView)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     foreach ($upSellProducts as $upSellProduct) {
         \PHPUnit_Framework_Assert::assertTrue($catalogProductView->getUpsellBlock()->getItemBlock($upSellProduct)->isVisible(), "Product {$upSellProduct->getName()} is absent in up-sells products.");
     }
 }
 /**
  * Add products to the wish list.
  *
  * @return void
  */
 public function run()
 {
     foreach ($this->products as $product) {
         $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
         $viewBlock = $this->catalogProductView->getViewBlock();
         $this->configure ? $viewBlock->addToWishlist($product) : $viewBlock->clickAddToWishlist();
     }
 }
 /**
  * Assert that gift card usable in frontend.
  *
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param CatalogProductSimple $product
  * @param Browser $browser
  * @param string $code
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, CatalogProductSimple $product, Browser $browser, $code)
 {
     $this->checkoutCart = $checkoutCart;
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->clickAddToCart();
     $checkoutCart->getGiftCardAccountBlock()->addGiftCard($code);
     $this->assert();
 }
 /**
  * Check whether there is an opportunity to compare products using given attribute.
  *
  * @param InjectableFixture $product
  * @param CatalogProductAttribute $attribute
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductCompare $catalogProductCompare
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProductAttribute $attribute, BrowserInterface $browser, CatalogProductView $catalogProductView, CatalogProductCompare $catalogProductCompare)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->clickAddToCompare();
     $catalogProductCompare->open();
     $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
     \PHPUnit_Framework_Assert::assertTrue($catalogProductCompare->getCompareProductsBlock()->isAttributeVisible($label), 'Attribute is absent on product compare page.');
 }
 /**
  * Assertion that the product is correctly displayed in cart.
  *
  * @param CatalogProductView $catalogProductView
  * @param InjectableFixture $product
  * @param Browser $browser
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, InjectableFixture $product, Browser $browser, CheckoutCart $checkoutCart)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $checkoutData = $product->getCheckoutData();
     $price = $checkoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price');
     \PHPUnit_Framework_Assert::assertEquals($checkoutData['cartItem']['price'], $price, 'Product price in shopping cart is not correct.');
 }
 /**
  * Assertion that the product is correctly displayed in cart.
  *
  * @param CatalogProductView $catalogProductView
  * @param InjectableFixture $product
  * @param Browser $browser
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, InjectableFixture $product, Browser $browser, CheckoutCart $checkoutCart)
 {
     // Add product to cart
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     // Check price
     $this->assertOnShoppingCart($product, $checkoutCart);
 }
 /**
  * Add to cart.
  *
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param InjectableFixture $productCheck
  * @return void
  */
 protected function addToCartFromCrossSell(CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, InjectableFixture $productCheck)
 {
     $crossSellBlock = $checkoutCart->getCrosssellBlock();
     $crossSellBlock->getItemBlock($productCheck)->addToCart();
     if ($catalogProductView->getViewBlock()->isVisible()) {
         $catalogProductView->getViewBlock()->addToCart($productCheck);
     }
 }
 /**
  * Assert that product can be configured and added to cart after added this product to cart by sku.
  *
  * @param CheckoutCart $checkoutCart
  * @param CatalogProductView $catalogProductView
  * @param array $requiredAttentionProducts
  * @return void
  */
 public function processAssert(CheckoutCart $checkoutCart, CatalogProductView $catalogProductView, array $requiredAttentionProducts)
 {
     foreach ($requiredAttentionProducts as $product) {
         $checkoutCart->open()->getAdvancedCheckoutCart()->clickSpecifyProductOptionsLink($product);
         $catalogProductView->getViewBlock()->addToCart($product);
         \PHPUnit_Framework_Assert::assertEquals(sprintf(self::SUCCESS_MESSAGE, $product->getName()), $checkoutCart->getMessagesBlock()->getSuccessMessages());
     }
 }
 /**
  * Assert that price stored in fixture equals to product price on product page.
  *
  * @param CatalogProductSimple $productSimple
  * @param Browser $browser
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 public function processAssert(CatalogProductSimple $productSimple, Browser $browser, CatalogProductView $catalogProductView)
 {
     $productSimple->persist();
     $browser->open($_ENV['app_frontend_url'] . $productSimple->getUrlKey() . '.html');
     $productPriceFromFixture = $productSimple->getPrice();
     $productPrice = number_format($catalogProductView->getViewBlock()->getPriceBlock()->getPrice(), 2);
     \PHPUnit_Framework_Assert::assertEquals($productPrice, $productPriceFromFixture);
 }
 /**
  * Assertion that commodity options are displayed correctly.
  *
  * @param CatalogProductView $catalogProductView
  * @param InjectableFixture $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, InjectableFixture $product, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $fixtureCustomOptions = $this->prepareOptions($product);
     $formCustomOptions = $catalogProductView->getViewBlock()->getOptions($product)['custom_options'];
     $error = $this->verifyData($fixtureCustomOptions, $formCustomOptions);
     \PHPUnit_Framework_Assert::assertEmpty($error, $error);
 }
 /**
  * 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 BundleProduct $product
  * @param CheckoutCart $checkoutCartView
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, BundleProduct $product, CheckoutCart $checkoutCartView, Browser $browser)
 {
     $this->product = $product;
     $checkoutCartView->open()->getCartBlock()->clearShoppingCart();
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     //Process assertions
     $this->assertPrice($checkoutCartView);
 }
 /**
  * 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 InjectableFixture $product
  * @return void
  */
 public function processAssert(Browser $browser, CatalogProductView $catalogProductView, InjectableFixture $product)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $this->product = $product;
     $this->productView = $catalogProductView->getViewBlock();
     $this->catalogProductView = $catalogProductView;
     $errors = $this->verify();
     \PHPUnit_Framework_Assert::assertEmpty($errors, "\nFound the following errors:\n" . implode(" \n", $errors));
 }
 /**
  * Assert that default qty for sub products in grouped product displays according to dataset on product page.
  *
  * @param CatalogProductView $groupedProductView
  * @param GroupedProduct $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $groupedProductView, GroupedProduct $product, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $pageOptions = $groupedProductView->getViewBlock()->getOptions($product);
     $fixtureQtyData = $this->prepareFixtureQtyData($product);
     $pageQtyData = $this->prepareFormQtyData($pageOptions);
     $error = $this->verifyData($fixtureQtyData, $pageQtyData);
     \PHPUnit_Framework_Assert::assertEmpty($error, $error);
 }
 /**
  * Assert that Samples links are present on the downloadable product on front-end.
  *
  * @param CatalogProductView $productView
  * @param DownloadableProduct $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $productView, DownloadableProduct $product, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $fixtureSampleLinks = $this->prepareFixtureData($product);
     $pageOptions = $productView->getViewBlock()->getOptions($product);
     $pageSampleLinks = isset($pageOptions['downloadable_options']['downloadable_sample']) ? $this->preparePageData($pageOptions['downloadable_options']['downloadable_sample']) : [];
     $error = $this->verifyData($fixtureSampleLinks, $pageSampleLinks);
     \PHPUnit_Framework_Assert::assertEmpty($error, $error);
 }
 /**
  * Assert that Catalog Price Rule is applied for product(s) in Shopping Cart
  * according to Priority(Priority/Stop Further Rules Processing).
  *
  * @param InjectableFixture $product
  * @param CatalogProductView $pageCatalogProductView
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CheckoutCart $pageCheckoutCart
  * @param array $prices
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProductView $pageCatalogProductView, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CheckoutCart $pageCheckoutCart, array $prices)
 {
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
     $catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName());
     $pageCatalogProductView->getViewBlock()->addToCart($product);
     $actualGrandTotal = $pageCheckoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price');
     \PHPUnit_Framework_Assert::assertEquals($prices['grand_total'], $actualGrandTotal);
 }
 /**
  * Assert that product can be added to active gift registry from shopping cart.
  *
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param InjectableFixture $product
  * @param GiftRegistry $giftRegistry
  * @param GiftRegistryItems $giftRegistryItems
  * @param BrowserInterface $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, InjectableFixture $product, GiftRegistry $giftRegistry, GiftRegistryItems $giftRegistryItems, BrowserInterface $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $catalogProductView->getMessagesBlock()->waitSuccessMessage();
     $checkoutCart->open();
     $checkoutCart->getGiftRegistryBlock()->addToGiftRegistry($giftRegistry);
     \PHPUnit_Framework_Assert::assertTrue($giftRegistryItems->getGiftRegistryItemsBlock()->isProductInGrid($product), "Product can not be added to active gift registry '{$giftRegistry->getTitle()}' from shopping cart.");
 }
 /**
  * Assert that product is not displayed in up-sell section.
  *
  * @param BrowserInterface $browser
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param InjectableFixture[]|null $promotedProducts
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogProductSimple $product, CatalogProductView $catalogProductView, array $promotedProducts = null)
 {
     if (!$promotedProducts) {
         $promotedProducts = $product->hasData('up_sell_products') ? $product->getDataFieldConfig('up_sell_products')['source']->getProducts() : [];
     }
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     foreach ($promotedProducts as $promotedProduct) {
         \PHPUnit_Framework_Assert::assertFalse($catalogProductView->getUpsellBlock()->isUpsellProductVisible($promotedProduct), 'Product \'' . $promotedProduct->getName() . '\' is exist in up-sells products.');
     }
 }
 /**
  * Assert that displayed product bundle items data on product page equals passed from fixture preset.
  *
  * @param CatalogProductView $catalogProductView
  * @param BundleProduct $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, BundleProduct $product, Browser $browser)
 {
     $this->product = $product;
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $productOptions = $this->prepareBundleOptions();
     $formOptions = $catalogProductView->getViewBlock()->getOptions($product)['bundle_options'];
     $formOptions = $this->prepareFormData($formOptions);
     $error = $this->verifyData($productOptions, $formOptions);
     \PHPUnit_Framework_Assert::assertEmpty($error, $error);
 }
 /**
  * Assert prices on the product view Page
  *
  * @param BundleProduct $product
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 protected function assertPrice(BundleProduct $product, CatalogProductView $catalogProductView)
 {
     $priceData = $product->getDataFieldConfig('price')['source']->getPreset();
     $priceBlock = $catalogProductView->getBundleViewBlock()->getPriceBlock();
     $priceLow = $product->getPriceView() == 'Price Range' ? $priceBlock->getPriceFrom() : $priceBlock->getRegularPrice();
     \PHPUnit_Framework_Assert::assertEquals($priceData['price_from'], $priceLow);
     if ($product->getPriceView() == 'Price Range') {
         \PHPUnit_Framework_Assert::assertEquals($priceData['price_to'], $priceBlock->getPriceTo());
     }
 }
 /**
  * Assert that created gift card account can be verified on the frontend in Shopping Cart.
  *
  * @param Customer $customer
  * @param Browser $browser
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param GiftCardAccount $giftCardAccount
  * @param CheckoutCart $checkoutCart
  * @param string $code
  * @return void
  */
 public function processAssert(Customer $customer, Browser $browser, CatalogProductSimple $product, CatalogProductView $catalogProductView, GiftCardAccount $giftCardAccount, CheckoutCart $checkoutCart, $code)
 {
     $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->clickAddToCart();
     $data = $giftCardAccount->getData();
     $checkoutCart->getGiftCardAccountBlock()->checkStatusAndBalance($code);
     $fixtureData = ['code' => $code, 'balance' => $data['balance'], 'date_expires' => $data['date_expires']];
     \PHPUnit_Framework_Assert::assertEquals($fixtureData, $checkoutCart->getCheckBlock()->getGiftCardAccountData($fixtureData));
 }
 /**
  * Verify product price on grouped product view page.
  *
  * @param GroupedProduct $product
  * @param CatalogProductView $catalogProductView
  * @param AssertPriceOnProductPageInterface $object
  * @param Browser $browser
  * @param string $typePrice [optional]
  * @return void
  */
 protected function processAssertPrice(GroupedProduct $product, CatalogProductView $catalogProductView, AssertPriceOnProductPageInterface $object, Browser $browser, $typePrice = '')
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $groupedData = $product->getDataFieldConfig('associated')['source']->getProducts();
     foreach ($groupedData as $key => $subProduct) {
         $catalogProductView->getGroupedProductViewBlock()->{'item' . $typePrice . 'PriceProductBlock'}(++$key);
         $object->setErrorMessage(sprintf($this->errorMessage, $subProduct->getName()));
         $object->assertPrice($subProduct, $catalogProductView->getGroupedProductViewBlock(), 'Grouped');
     }
 }
 /**
  * Assert that product review available on product page.
  *
  * @param CatalogProductView $catalogProductView
  * @param Review $review
  * @param FixtureInterface $product
  * @param BrowserInterface $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, Review $review, FixtureInterface $product, BrowserInterface $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $reviewBlock = $catalogProductView->getReviewsBlock();
     $catalogProductView->getViewBlock()->openCustomInformationTab('Reviews');
     $formReview = $reviewBlock->getItems()[0];
     $fixtureReview = $this->prepareReview($review);
     $errors = $this->verifyData($fixtureReview, $formReview);
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
 /**
  * Assert that add view review links are present on product page.
  *
  * @param Browser $browser
  * @param CatalogProductView $catalogProductView
  * @param InjectableFixture $product
  * @param Review $review
  * @return void
  */
 public function processAssert(Browser $browser, CatalogProductView $catalogProductView, InjectableFixture $product, Review $review)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     // Verify add review link
     \PHPUnit_Framework_Assert::assertTrue($catalogProductView->getReviewViewBlock()->getAddReviewLink()->isVisible(), 'Add review link is not visible on product page.');
     // Verify view review link
     $viewReviewLink = $catalogProductView->getReviewViewBlock()->getViewReviewLink($review);
     \PHPUnit_Framework_Assert::assertTrue($viewReviewLink->isVisible(), 'View review link is not visible on product page.');
     \PHPUnit_Framework_Assert::assertContains('1', $viewReviewLink->getText(), 'There is more than 1 approved review.');
 }
 /**
  * Assert that banner is absent on Shopping Cart page.
  *
  * @param Browser $browser
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param Banner $banner
  * @param CheckoutCart $checkoutCart
  * @param Cache $adminCache
  * @return void
  */
 public function processAssert(Browser $browser, CatalogProductSimple $product, CatalogProductView $catalogProductView, Banner $banner, CheckoutCart $checkoutCart, Cache $adminCache)
 {
     // Flush cache
     $adminCache->open();
     $adminCache->getPageActions()->flushCacheStorage();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     \PHPUnit_Framework_Assert::assertFalse($checkoutCart->getBannerViewBlock()->checkWidgetBanners($banner), 'Banner is present on Shopping Cart page.');
 }
 /**
  * Assert that product is not displayed in related products section.
  *
  * @param BrowserInterface $browser
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param InjectableFixture[]|null $promotedProducts
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogProductSimple $product, CatalogProductView $catalogProductView, array $promotedProducts = null)
 {
     if (!$promotedProducts) {
         $promotedProducts = $product->hasData('related_products') ? $product->getDataFieldConfig('related_products')['source']->getProducts() : [];
     }
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     foreach ($promotedProducts as $promotedProduct) {
         \PHPUnit_Framework_Assert::assertFalse($catalogProductView->getRelatedProductBlock()->getItemBlock($promotedProduct)->isVisible(), "Product {$promotedProduct->getName()} is exist in related products.");
     }
 }
 /**
  * Assert that product available by new URL on the frontend.
  *
  * @param Browser $browser
  * @param UrlRewrite $urlRewrite
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param CmsIndex $cmsIndex
  * @param Cache $cachePage
  * @return void
  */
 public function processAssert(Browser $browser, UrlRewrite $urlRewrite, CatalogProductSimple $product, CatalogProductView $catalogProductView, CmsIndex $cmsIndex, Cache $cachePage)
 {
     $cachePage->open()->getPageActions()->flushCacheStorage();
     if ($urlRewrite->hasData('store_id')) {
         $storePath = explode('/', $urlRewrite->getStoreId());
         $cmsIndex->open();
         $cmsIndex->getHeaderBlock()->selectStore($storePath[2]);
     }
     $browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath());
     \PHPUnit_Framework_Assert::assertEquals($catalogProductView->getViewBlock()->getProductName(), strtoupper($product->getName()), 'URL rewrite product redirect false.');
 }
 /**
  * Assert that product rating is displayed on product review page(frontend).
  *
  * @param CatalogProductView $catalogProductView
  * @param ReviewProductList $reviewProductList
  * @param BrowserInterface $browser
  * @param CatalogProductSimple $product
  * @param Review $review
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, ReviewProductList $reviewProductList, BrowserInterface $browser, CatalogProductSimple $product, Review $review)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->openCustomInformationTab('Reviews');
     $catalogProductView->getReviewsBlock()->clickAddReviewLink();
     $reviewForm = $reviewProductList->getReviewFormBlock();
     $ratings = $review->getDataFieldConfig('ratings')['source']->getRatings();
     foreach ($ratings as $rating) {
         \PHPUnit_Framework_Assert::assertTrue($reviewForm->isVisibleRating($rating), 'Product rating "' . $rating->getRatingCode() . '" is not displayed on review product page.');
     }
 }