/**
  * Assert that product review can do approved.
  *
  * @param CatalogProductReview $reviewIndex
  * @param Review $review
  * @param CatalogProductReviewEdit $reviewEdit
  * @param AssertReviewSuccessSaveMessage $assertReviewSuccessSaveMessage
  * @param Cache $cachePage
  * @return void
  */
 public function processAssert(CatalogProductReview $reviewIndex, Review $review, CatalogProductReviewEdit $reviewEdit, AssertReviewSuccessSaveMessage $assertReviewSuccessSaveMessage, Cache $cachePage)
 {
     $reviewIndex->open()->getReviewGrid()->searchAndOpen(['title' => $review->getTitle()]);
     $reviewEdit->getReviewForm()->setApproveReview();
     $reviewEdit->getFormPageActions()->save();
     $assertReviewSuccessSaveMessage->processAssert($reviewIndex);
     $cachePage->open()->getPageActions()->flushCacheStorage();
 }
 /**
  * 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 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 created store view can be localized.
  *
  * @param Store $store
  * @param CmsIndex $cmsIndex
  * @param FixtureFactory $fixtureFactory
  * @param ConfigData $config
  * @param Cache $adminCache
  * @return void
  */
 public function processAssert(Store $store, CmsIndex $cmsIndex, FixtureFactory $fixtureFactory, ConfigData $config, Cache $adminCache)
 {
     // Flush cache
     $adminCache->open();
     $adminCache->getPageActions()->flushCacheStorage();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     $this->cmsIndexPage = $cmsIndex;
     $this->setConfig($store, $fixtureFactory, $config);
     $cmsIndex->open();
     $this->selectStore($store);
     \PHPUnit_Framework_Assert::assertEquals(strtolower($cmsIndex->getTopLinksBlock()->getAccountLabelText()), self::EXPECTED_TEXT);
 }
 /**
  * Assert that created Order By Sku widget displayed on frontend in Catalog.
  *
  * @param CatalogCategory $category
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param Widget $widget
  * @param Cache $adminCache
  * @return void
  */
 public function processAssert(CatalogCategory $category, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, Widget $widget, Cache $adminCache)
 {
     $category->persist();
     // Flush cache
     $adminCache->open();
     $adminCache->getPageActions()->flushCacheStorage();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($category->getName());
     $errors = $catalogCategoryView->getWidgetView()->checkWidget($widget, "Order by SKU");
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
 /**
  * Assert that created Banner Rotator widget displayed on frontent on Home page and on Advanced Search.
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogsearchAdvanced $advancedSearch
  * @param Widget $widget
  * @param Cache $adminCache
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogsearchAdvanced $advancedSearch, Widget $widget, Cache $adminCache)
 {
     // Flush cache
     $adminCache->open();
     $adminCache->getPageActions()->flushCacheStorage();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     $cmsIndex->open();
     $errors = $cmsIndex->getWidgetView()->checkWidget($widget, 'Cms index');
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
     $advancedSearch->open();
     $errors = $cmsIndex->getWidgetView()->checkWidget($widget, 'Advanced search');
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
Esempio n. 7
0
 /**
  * Assert that created store view available on frontend.
  *
  * @param Store $store
  * @param CmsIndex $cmsIndex
  * @param Cache $cache
  * @return void
  */
 public function processAssert(Store $store, CmsIndex $cmsIndex, Cache $cache)
 {
     $cache->open()->getPageActions()->flushCacheStorage();
     $cmsIndex->open();
     $footerBlock = $cmsIndex->getFooterBlock();
     $headerBlock = $cmsIndex->getHeaderBlock();
     if ($footerBlock->isStoreGroupSwitcherVisible() && $footerBlock->isStoreGroupVisible($store)) {
         $footerBlock->selectStoreGroup($store);
     }
     $isStoreViewVisible = $headerBlock->isStoreViewDropdownVisible() ? $headerBlock->isStoreViewVisible($store) : true;
     // if only one store view is assigned to store group
     \PHPUnit_Framework_Assert::assertTrue($isStoreViewVisible, "Store view '{$store->getName()}' is not visible in dropdown on CmsIndex page.");
 }
 /**
  * Assert that after applying changes, currency symbol changed on Product Details Page.
  *
  * @param CatalogProductSimple $product
  * @param Browser $browser
  * @param CmsIndex $cmsIndex
  * @param CatalogProductView $catalogProductView
  * @param CurrencySymbolEntity $currencySymbol
  * @param Cache $adminCache
  * @return void
  */
 public function processAssert(CatalogProductSimple $product, Browser $browser, CmsIndex $cmsIndex, CatalogProductView $catalogProductView, CurrencySymbolEntity $currencySymbol, Cache $adminCache)
 {
     // Flush cache
     $adminCache->open();
     $adminCache->getPageActions()->flushCacheStorage();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     $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 that banner presents on specific category page.
  *
  * @param CatalogProductSimple $product
  * @param CmsIndex $cmsIndex
  * @param Banner $banner
  * @param CatalogCategoryView $catalogCategoryView
  * @param Customer $customer[optional]
  * @param Cache $adminCache
  * @return void
  */
 public function processAssert(CatalogProductSimple $product, CmsIndex $cmsIndex, Banner $banner, CatalogCategoryView $catalogCategoryView, Customer $customer = null, Cache $adminCache)
 {
     // Flush cache
     $adminCache->open();
     $adminCache->getPageActions()->flushCacheStorage();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     if ($customer !== null) {
         $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     } else {
         $cmsIndex->open();
     }
     $cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
     \PHPUnit_Framework_Assert::assertTrue($catalogCategoryView->getBannerViewBlock()->checkWidgetBanners($banner), 'Banner is absent on Category page.');
 }
 /**
  * Assert that event block is absent on category/product pages.
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param Cache $adminCache
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductSimple $product, CatalogProductView $catalogProductView, Cache $adminCache)
 {
     // Flush cache
     $adminCache->open();
     $adminCache->getPageActions()->flushCacheStorage();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     $categoryName = $product->getCategoryIds()[0];
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($categoryName);
     \PHPUnit_Framework_Assert::assertFalse($catalogCategoryView->getEventBlock()->isVisible(), "Event block is present on Category page.");
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($categoryName);
     $catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName());
     \PHPUnit_Framework_Assert::assertFalse($catalogProductView->getEventBlock()->isVisible(), "Event block is present on Product page.");
 }
 /**
  * Assert that created Banner Rotator widget displayed on frontend on Product page.
  *
  * @param CatalogProductView $productView
  * @param Browser $browser
  * @param BannerWidget $widget
  * @param Cache $adminCache
  * @return void
  */
 public function processAssert(CatalogProductView $productView, Browser $browser, BannerWidget $widget, Cache $adminCache)
 {
     // Flush cache
     $adminCache->open();
     $adminCache->getPageActions()->flushCacheStorage();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     $layouts = $widget->getLayout();
     foreach ($layouts as $layout) {
         foreach ($layout['entities'] as $layoutEntity) {
             $urlKey = $layoutEntity['url_key'];
             $browser->open($_ENV['app_frontend_url'] . $urlKey . '.html');
             $errors = $productView->getWidgetView()->checkWidget($widget, $layoutEntity['url_key']);
             \PHPUnit_Framework_Assert::assertEmpty($errors, implode(" ", $errors));
         }
     }
 }
 /**
  * Assert that widget catalog event carousel is present on category page and link "Go To Sale" on widget redirects
  * you to category page.
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogEventWidget $widget
  * @param CatalogCategoryView $catalogCategoryView
  * @param Cache $adminCache
  * @param CatalogEvent $event1
  * @param CatalogEvent $event2
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogEventWidget $widget, CatalogCategoryView $catalogCategoryView, Cache $adminCache, CatalogEvent $event1, CatalogEvent $event2)
 {
     // Flush cache
     $adminCache->open();
     $adminCache->getPageActions()->flushCacheStorage();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     $event1->persist();
     $event2->persist();
     $cmsIndex->open();
     $categoryName = $event2->getCategoryId();
     $cmsIndex->getTopmenu()->selectCategory($categoryName);
     $errors = $catalogCategoryView->getWidgetView()->checkWidget($widget, $categoryName);
     \PHPUnit_Framework_Assert::assertEmpty($errors, implode(" ", $errors));
     $cmsIndex->open();
     $cmsIndex->getWidgetView()->clickToWidget($widget, $categoryName);
     $pageTitle = $cmsIndex->getCmsPageBlock()->getPageTitle();
     $expected = strtolower($categoryName);
     $actual = strtolower($pageTitle);
     \PHPUnit_Framework_Assert::assertEquals($expected, $actual, "Wrong page title on Category page: expected = '{$expected}', actual = '{$actual}'");
 }
 /**
  * Inactive multiple wishlist in config and delete wishlist search widget.
  *
  * @return void
  */
 public function tearDown()
 {
     $this->setupConfiguration(true);
     $this->objectManager->create('Mage\\Widget\\Test\\TestStep\\DeleteAllWidgetsStep')->run();
     $this->cachePage->open()->getPageActions()->flushCacheStorage();
 }
Esempio n. 14
0
 /**
  * Assert that specified prices with fpt are actual on category, product and cart pages.
  *
  * @param InjectableFixture $product
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param Cache $cache
  * @param array $prices
  * @return void
  */
 public function processAssert(InjectableFixture $product, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, Cache $cache, array $prices)
 {
     $cache->open()->getPageActions()->flushCacheStorage();
     $this->product = $product;
     $this->expectedPrices = $prices;
     $this->cmsIndex = $cmsIndex;
     $this->catalogCategoryView = $catalogCategoryView;
     $this->catalogProductView = $catalogProductView;
     $this->checkoutCart = $checkoutCart;
     $this->fptLabel = $this->getFptLabel($product);
     $this->clearShoppingCart();
     $error = $this->verifyData($prices, $this->getPrices());
     \PHPUnit_Framework_Assert::assertEmpty($error, $error);
 }
 /**
  * Assert that specified prices are actual on category, product and cart pages.
  *
  * @param InjectableFixture $product
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param Address $address
  * @param Cache $cachePage
  * @param array $prices
  * @param array $arguments
  * @return void
  */
 public function processAssert(InjectableFixture $product, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, Address $address, Cache $cachePage, array $prices, array $arguments)
 {
     $cachePage->open()->getPageActions()->flushCacheStorage();
     $this->cmsIndex = $cmsIndex;
     $this->catalogCategoryView = $catalogCategoryView;
     $this->catalogProductView = $catalogProductView;
     $this->checkoutCart = $checkoutCart;
     $prices = $this->prepareVerifyFields($prices);
     //Assertion steps
     $productName = $product->getName();
     $this->cmsIndex->open()->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
     $actualPrices = $this->getCategoryPrices($product);
     $catalogCategoryView->getListProductBlock()->openProductViewPage($productName);
     $this->fillCheckoutData($product);
     $actualPrices = array_merge($actualPrices, $this->getProductPagePrices());
     $catalogProductView->getViewBlock()->clickAddToCart();
     if (isset($arguments['shipping'])) {
         $this->fillEstimateBlock($address, $arguments['shipping']);
     }
     $actualPrices = array_merge($actualPrices, $this->getCartPrices($product), $this->getTotals($actualPrices));
     //Prices verification
     $error = $this->verifyData($prices, $actualPrices);
     \PHPUnit_Framework_Assert::assertTrue(empty($error), $error);
 }