/**
  * 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.');
         }
     }
 }
示例#2
0
 /**
  * Assert that product is not displayed in up-sell section
  *
  * @param BrowserInterface $browser
  * @param CatalogProductSimple $product
  * @param InjectableFixture[] $relatedProducts
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogProductSimple $product, array $relatedProducts, CatalogProductView $catalogProductView)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     foreach ($relatedProducts as $relatedProduct) {
         \PHPUnit_Framework_Assert::assertFalse($catalogProductView->getUpsellBlock()->isUpsellProductVisible($relatedProduct->getName()), 'Product \'' . $relatedProduct->getName() . '\' is exist in up-sells products.');
     }
 }
 /**
  * Assert that product rating is not displayed on frontend on product review
  *
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductSimple $product
  * @param Rating $productRating
  * @param BrowserInterface $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CatalogProductSimple $product, Rating $productRating, BrowserInterface $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.');
 }
示例#4
0
 /**
  * Assert prices on the product view page and shopping cart page.
  *
  * @param BundleProduct $product
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCartView
  * @param BundleProduct $originalProduct [optional]
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function assertPrice(BundleProduct $product, CatalogProductView $catalogProductView, CheckoutCart $checkoutCartView, BundleProduct $originalProduct = null)
 {
     $customerGroup = 'NOT LOGGED IN';
     $bundleData = $product->getData();
     $this->productPriceType = $originalProduct !== null ? $originalProduct->getPriceType() : $product->getPriceType();
     $catalogProductView->getViewBlock()->addToCart($product);
     $catalogProductView->getMessagesBlock()->waitSuccessMessage();
     $checkoutCartView->open();
     $cartItem = $checkoutCartView->getCartBlock()->getCartItem($product);
     $specialPrice = 0;
     if (isset($bundleData['group_price'])) {
         $specialPrice = $bundleData['group_price'][array_search($customerGroup, $bundleData['group_price'])]['price'] / 100;
     }
     $optionPrice = [];
     $fillData = $product->getCheckoutData();
     foreach ($fillData['options']['bundle_options'] as $key => $data) {
         $subProductPrice = 0;
         foreach ($bundleData['bundle_selections']['products'][$key] as $productKey => $itemProduct) {
             if (strpos($itemProduct->getName(), $data['value']['name']) !== false) {
                 $data['value']['key'] = $productKey;
                 $subProductPrice = $itemProduct->getPrice();
             }
         }
         $optionPrice[$key]['price'] = $this->productPriceType == 'Fixed' ? number_format($bundleData['bundle_selections']['bundle_options'][$key]['assigned_products'][$data['value']['key']]['data']['selection_price_value'], 2) : number_format($subProductPrice, 2);
     }
     foreach ($optionPrice as $index => $item) {
         $item['price'] -= $item['price'] * $specialPrice;
         \PHPUnit_Framework_Assert::assertEquals(number_format($item['price'], 2), $cartItem->getPriceBundleOptions($index + 1), 'Bundle item ' . ($index + 1) . ' options on frontend don\'t equal to fixture.');
     }
     $sumOptionsPrice = $product->getDataFieldConfig('price')['source']->getPriceData()['cart_price'];
     $subTotal = number_format($cartItem->getPrice(), 2);
     \PHPUnit_Framework_Assert::assertEquals($sumOptionsPrice, $subTotal, 'Bundle unit price on frontend doesn\'t equal to fixture.');
 }
 /**
  * Assert that In Stock status is displayed on product page
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product)
 {
     // TODO fix initialization url for frontend page
     $catalogProductView->init($product);
     $catalogProductView->open();
     \PHPUnit_Framework_Assert::assertEquals(self::STOCK_AVAILABILITY, $catalogProductView->getViewBlock()->stockAvailability(), 'Control \'' . self::STOCK_AVAILABILITY . '\' is not visible.');
 }
 /**
  * Open product on frontend and click Checkout with PayPal button.
  *
  * @return void
  */
 public function run()
 {
     $product = reset($this->products);
     $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $parentWindow = $this->catalogProductView->getViewBlock()->braintreePaypalCheckout();
     $this->catalogProductView->getBraintreePaypalBlock()->process($parentWindow);
 }
 /**
  * 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 BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(BrowserInterface $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));
 }
 /**
  * Check that product available by new URL on the front
  *
  * @param UrlRewrite $urlRewrite
  * @param CatalogProductView $catalogProductView
  * @param BrowserInterface $browser
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(UrlRewrite $urlRewrite, CatalogProductView $catalogProductView, BrowserInterface $browser, InjectableFixture $product = null)
 {
     $browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath());
     if ($product === null) {
         $product = $urlRewrite->getDataFieldConfig('target_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 product is displayed in related products section
  *
  * @param CatalogProductSimple $product1
  * @param CatalogProductSimple $product2
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 public function processAssert(CatalogProductSimple $product1, CatalogProductSimple $product2, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView)
 {
     $categoryName = $product1->getCategoryIds()[0];
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
     $catalogCategoryView->getListProductBlock()->openProductViewPage($product1->getName());
     \PHPUnit_Framework_Assert::assertTrue($catalogProductView->getRelatedProductBlock()->isRelatedProductVisible($product2->getName()), 'Product \'' . $product2->getName() . '\' is absent in related products.');
 }
 /**
  * Assertion that tier prices are displayed correctly
  *
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogProductView $catalogProductView, 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->getViewBlock());
 }
 /**
  * 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.');
 }
 /**
  * Assert that product rating is not displayed on frontend on product review
  *
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductSimple $product
  * @param Rating $productRating
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CatalogProductSimple $product, Rating $productRating)
 {
     $catalogProductView->init($product);
     $catalogProductView->open();
     $catalogProductView->getReviewSummaryBlock()->getAddReviewLink()->click();
     $reviewForm = $catalogProductView->getReviewFormBlock();
     \PHPUnit_Framework_Assert::assertFalse($reviewForm->isVisibleRating($productRating), 'Product rating "' . $productRating->getRatingCode() . '" is displayed.');
 }
 /**
  * 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.');
 }
 /**
  * Verify product special price on product view page
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @param string $block [optional]
  * @return void
  */
 public function assertPrice(FixtureInterface $product, CatalogProductView $catalogProductView, $block = '')
 {
     $fields = $product->getData();
     $specialPrice = $catalogProductView->getViewBlock()->getPriceBlock()->getSpecialPrice();
     if (isset($fields['special_price'])) {
         \PHPUnit_Framework_Assert::assertEquals(number_format($fields['special_price'], 2), $specialPrice, $this->errorMessage);
     }
 }
 /**
  * Assert that product is not displayed in up-sell section
  *
  * @param CatalogProductSimple $product1
  * @param CatalogProductSimple $product2
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 public function processAssert(CatalogProductSimple $product1, CatalogProductSimple $product2, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView)
 {
     $categoryName = $product1->getCategoryIds()[0]['name'];
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
     $catalogCategoryView->getListProductBlock()->openProductViewPage($product1->getName());
     \PHPUnit_Framework_Assert::assertFalse($catalogProductView->getUpsellBlock()->isUpsellProductVisible($product2->getName()), 'Product \'' . $product2->getName() . '\' is exist in up-sells products.');
 }
 /**
  * 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
  */
 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(in_array($label, $catalogProductCompare->getCompareProductsBlock()->getComparableAttributes()), 'Attribute is absent on product compare page.');
 }
 /**
  * Assert that product rating is displayed on product review(frontend)
  *
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductSimple $product
  * @param ReviewInjectable|null $review [optional]
  * @param Rating|null $productRating [optional]
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CatalogProductSimple $product, ReviewInjectable $review = null, Rating $productRating = null)
 {
     $catalogProductView->init($product);
     $catalogProductView->open();
     $catalogProductView->getReviewSummaryBlock()->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.');
 }
 /**
  * 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.');
     }
 }
 /**
  * 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.');
 }
 /**
  * Assert that deleted configurable attributes are absent on product page on frontend.
  *
  * @param CatalogProductAttribute[] $deletedProductAttributes
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param ConfigurableProduct $product
  * @return void
  */
 public function processAssert(array $deletedProductAttributes, BrowserInterface $browser, CatalogProductView $catalogProductView, ConfigurableProduct $product)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $pageOptions = $catalogProductView->getViewBlock()->getOptions($product)['configurable_options'];
     foreach ($deletedProductAttributes as $attribute) {
         $attributeLabel = $attribute->getFrontendLabel();
         \PHPUnit_Framework_Assert::assertFalse(isset($pageOptions[$attributeLabel]), "Configurable attribute '{$attributeLabel}' found on product page on frontend.");
     }
 }
 /**
  * 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 Sample block for downloadable product on front-end
  *
  * @param CatalogProductView $productView
  * @param DownloadableProduct $product
  * @param BrowserInterface $browser
  * @return void
  */
 public function processAssert(CatalogProductView $productView, DownloadableProduct $product, BrowserInterface $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);
 }
 /**
  * Assertion that tier prices are displayed correctly
  *
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogProductView $catalogProductView, FixtureInterface $product)
 {
     //Open product view page
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $viewBlock = $catalogProductView->getBundleViewBlock();
     $viewBlock->clickCustomize();
     //Process assertions
     $this->assertPrice($product, $viewBlock);
 }
 /**
  * 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()->getProductItem($promotedProduct)->isVisible(), 'Product \'' . $promotedProduct->getName() . '\' is exist in up-sells products.');
     }
 }
 /**
  * Assert that after applying changes, currency symbol changed on Product Details Page.
  *
  * @param CatalogProductSimple $product
  * @param BrowserInterface $browser
  * @param CmsIndex $cmsIndex
  * @param CatalogProductView $catalogProductView
  * @param CurrencySymbolEntity $currencySymbol
  * @return void
  */
 public function processAssert(CatalogProductSimple $product, BrowserInterface $browser, CmsIndex $cmsIndex, CatalogProductView $catalogProductView, CurrencySymbolEntity $currencySymbol)
 {
     $cmsIndex->open();
     $cmsIndex->getCurrencyBlock()->switchCurrency($currencySymbol);
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $price = $catalogProductView->getViewBlock()->getPriceBlock()->getPrice();
     preg_match('`(.*?)\\d`', $price, $matches);
     $symbolOnPage = isset($matches[1]) ? $matches[1] : null;
     \PHPUnit_Framework_Assert::assertEquals($currencySymbol->getCustomCurrencySymbol(), $symbolOnPage, 'Wrong Currency Symbol is displayed on Product page.');
 }
 /**
  * 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->getViewBlock()->getPriceBlock();
     $priceLow = $product->getPriceView() == 'Price Range' ? $priceBlock->getPriceFrom() : $priceBlock->getRegularPrice();
     \PHPUnit_Framework_Assert::assertEquals($priceData['price_from'], $priceLow, 'Bundle price From on product view page is not correct.');
     if ($product->getPriceView() == 'Price Range') {
         \PHPUnit_Framework_Assert::assertEquals($priceData['price_to'], $priceBlock->getPriceTo(), 'Bundle price To on product view page is not correct.');
     }
 }
 /**
  * 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()->addToCart($product);
         $this->catalogProductView->getMessagesBlock()->waitSuccessMessage();
     }
 }
 /**
  * Assert that product is displayed in cross-sell section
  *
  * @param CatalogProductSimple $product1
  * @param CatalogProductSimple $product2
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductSimple $product1, CatalogProductSimple $product2, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart)
 {
     $categoryName = $product1->getCategoryIds()[0];
     $checkoutCart->open();
     $checkoutCart->getCartBlock()->clearShoppingCart();
     $cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
     $catalogCategoryView->getListProductBlock()->openProductViewPage($product1->getName());
     $catalogProductView->getViewBlock()->addToCart($product1);
     \PHPUnit_Framework_Assert::assertTrue($checkoutCart->getCrosssellBlock()->verifyProductCrosssell($product2), 'Product \'' . $product2->getName() . '\' is absent in cross-sell section.');
 }
 /**
  * Assert that add view review links are present on product page.
  *
  * @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');
     // Verify add review link
     \PHPUnit_Framework_Assert::assertTrue($catalogProductView->getReviewSummary()->getAddReviewLink()->isVisible(), 'Add review link is not visible on product page.');
     // Verify view review link
     $viewReviewLink = $catalogProductView->getReviewSummary()->getViewReviewLink();
     \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.');
 }
示例#30
0
 /**
  * Assert that product is not displayed in cross-sell section
  *
  * @param BrowserInterface $browser
  * @param CatalogProductSimple $product
  * @param InjectableFixture[] $relatedProducts
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogProductSimple $product, array $relatedProducts, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart)
 {
     $checkoutCart->open();
     $checkoutCart->getCartBlock()->clearShoppingCart();
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     foreach ($relatedProducts as $relatedProduct) {
         \PHPUnit_Framework_Assert::assertFalse($checkoutCart->getCrosssellBlock()->verifyProductCrosssell($relatedProduct), 'Product \'' . $relatedProduct->getName() . '\' is exist in cross-sell section.');
     }
 }