コード例 #1
0
 /**
  * Login customer.
  *
  * @return void
  */
 public function run()
 {
     $this->cmsIndex->open();
     $this->cmsIndex->getTopLinksBlock()->openAccount();
     if ($this->cmsIndex->getLinksBlock()->isLinkVisible("Log Out")) {
         $this->cmsIndex->getLinksBlock()->openLink("Log Out");
         $this->cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible('Home Page');
         $this->cmsIndex->getTopLinksBlock()->openAccount();
     }
     $this->cmsIndex->getLinksBlock()->openLink("Log In");
     $this->customerAccountLogin->getLoginBlock()->login($this->customer);
 }
コード例 #2
0
 /**
  * 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.");
 }
コード例 #3
0
 /**
  * Verify product displaying on frontend.
  *
  * @param InjectableFixture $product
  * @return array
  */
 protected function isNotDisplayingOnFrontendAssert(InjectableFixture $product)
 {
     $errors = [];
     //Check that product is not available by url
     $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     if ($this->catalogProductView->getViewBlock()->isVisible()) {
         $errors[] = '- product view block is visible in product page.';
     }
     //Check that product can't be found
     $this->cmsIndex->open()->getSearchBlock()->search($product->getSku());
     if ($this->catalogSearchResult->getListProductBlock()->isProductVisible($product)) {
         $errors[] = '- successful product search.';
     }
     //Check that product is not available in category page
     $categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $this->category->getName();
     $this->cmsIndex->open()->getTopmenu()->selectCategory($categoryName);
     $isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product);
     $bottomToolBar = $this->catalogCategoryView->getBottomToolbar();
     while (!$isProductVisible && $bottomToolBar->nextPage()) {
         $isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product);
     }
     if ($isProductVisible) {
         $errors[] = "- product with name '{$product->getName()}' is found in this category.";
     }
     return $errors;
 }
コード例 #4
0
 /**
  * Assert that Wishlist can't be find by another Customer (or guest) via "Wishlist Search".
  *
  * @param CustomerAccountLogout $customerAccountLogout
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param SearchResult $searchResult
  * @param CatalogCategory $category
  * @param Customer $customer
  * @param Wishlist $wishlist
  * @return void
  */
 public function processAssert(CustomerAccountLogout $customerAccountLogout, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, SearchResult $searchResult, CatalogCategory $category, Customer $customer, Wishlist $wishlist)
 {
     $customerAccountLogout->open();
     $cmsIndex->open()->getTopmenu()->selectCategory($category->getName());
     $catalogCategoryView->getWishlistSearchBlock()->searchByCustomer($customer);
     \PHPUnit_Framework_Assert::assertFalse($searchResult->getWishlistSearchResultBlock()->isWishlistVisibleInGrid($wishlist), "Multiple wishlist is visible on wishlist search result page.");
 }
 /**
  * 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.");
     }
 }
コード例 #6
0
 /**
  * Assert that apache redirect works by opening category page and asserting index.php in its url.
  *
  * @param CatalogCategory $category
  * @param CmsIndex $homePage
  * @param BrowserInterface $browser
  */
 public function processAssert(CatalogCategory $category, CmsIndex $homePage, BrowserInterface $browser)
 {
     $category->persist();
     $homePage->open();
     $homePage->getTopmenu()->selectCategory($category->getName());
     \PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'index.php') === false, 'Apache redirect for category does not work.');
 }
コード例 #7
0
 /**
  * Run create existing customer account on frontend test.
  *
  * @param Customer $customer
  * @return void
  */
 public function test(Customer $customer)
 {
     //Steps
     $this->cmsIndex->open();
     $this->cmsIndex->getTopLinksBlock()->openAccount();
     $this->cmsIndex->getLinksBlock()->openLink('Register');
     $this->customerAccountCreate->getRegisterForm()->registerCustomer($customer);
 }
コード例 #8
0
 /**
  * Event block has $this->eventStatus on Product Page.
  *
  * @return void
  */
 protected function checkEventStatusOnProductPage()
 {
     $categoryName = $this->product->getDatafieldConfig('category_ids')['source']->getProductCategory()->getName();
     $this->cmsIndex->open();
     $this->cmsIndex->getTopmenu()->selectCategory($categoryName);
     $this->catalogCategoryView->getListProductBlock()->openProductViewPage($this->product->getName());
     \PHPUnit_Framework_Assert::assertEquals($this->eventStatus, $this->catalogProductView->getEventBlock()->getEventStatus(), 'Wrong event status is displayed.');
 }
コード例 #9
0
 /**
  * Assert that Magento successfully installed.
  *
  * @param InstallWizardEnd $installWizardEnd
  * @param CmsIndex $cmsIndex
  * @param string $successInstallMessage
  * @return void
  */
 public function processAssert(InstallWizardEnd $installWizardEnd, CmsIndex $cmsIndex, $successInstallMessage)
 {
     // Check InstallWizardEnd page title text.
     \PHPUnit_Framework_Assert::assertEquals($successInstallMessage, $installWizardEnd->getMainBlock()->getTitle());
     // Check if header block on CmsIndex page is visible.
     $cmsIndex->open();
     \PHPUnit_Framework_Assert::assertTrue($cmsIndex->getHeaderBlock()->isVisible());
 }
 /**
  * Assert that Catalog Price Rule is applied for product(s) in Catalog
  * according to Priority(Priority/Stop Further Rules Processing).
  *
  * @param InjectableFixture $product
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param array $prices
  * @return void
  */
 public function processAssert(InjectableFixture $product, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, array $prices)
 {
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
     $formPrices = $this->getFormPrices($product, $catalogCategoryView);
     $fixturePrices = $this->prepareFixturePrices($prices);
     $diff = $this->verifyData($fixturePrices, $formPrices);
     \PHPUnit_Framework_Assert::assertEmpty($diff, $diff . "\n On: " . date('l jS \\of F Y h:i:s A'));
 }
 /**
  * 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);
 }
コード例 #12
0
 /**
  * Check that after input some text(e.g. product name) into search field, drop-down window is appeared.
  * Window contains requested entity and number of quantity.
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogSearchQuery $catalogSearch
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogSearchQuery $catalogSearch)
 {
     $cmsIndex->open();
     $searchBlock = $cmsIndex->getSearchBlock();
     $queryText = $catalogSearch->getQueryText();
     $searchBlock->fillSearch($queryText);
     $isVisible = $catalogSearch->hasData('num_results') ? $searchBlock->isSuggestSearchVisible($queryText, $catalogSearch->getNumResults()) : $searchBlock->isSuggestSearchVisible($queryText);
     \PHPUnit_Framework_Assert::assertTrue($isVisible, 'Block "Suggest Search" when searching was not found.');
 }
コード例 #13
0
 /**
  * Assert that product is absent in the category page.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param InjectableFixture $product
  * @param CatalogCategory $category
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, InjectableFixture $product, CatalogCategory $category)
 {
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($category->getName());
     $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
         $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     }
     \PHPUnit_Framework_Assert::assertFalse($isProductVisible, 'Product is present on category page.');
 }
コード例 #14
0
 /**
  * Assert that created CMS block displayed on frontend category page (in order to assign block to category:
  * go to category page> Display settings> CMS Block).
  *
  * @param CmsIndex $cmsIndex
  * @param CmsBlock $cmsBlock
  * @param CatalogCategoryView $catalogCategoryView
  * @param FixtureFactory $fixtureFactory
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CmsBlock $cmsBlock, CatalogCategoryView $catalogCategoryView, FixtureFactory $fixtureFactory)
 {
     $category = $fixtureFactory->createByCode('catalogCategory', ['dataSet' => 'default_subcategory', 'data' => ['display_mode' => 'Static block and products', 'landing_page' => $cmsBlock->getTitle()]]);
     $category->persist();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($category->getName());
     $categoryViewContent = $catalogCategoryView->getViewBlock()->getText();
     $cmsBlockContent = explode("\n", $categoryViewContent);
     \PHPUnit_Framework_Assert::assertContains($cmsBlock->getContent(), $cmsBlockContent);
 }
コード例 #15
0
 /**
  * Check event block on visibility on specified page.
  *
  * @param string $page
  * @param bool $positive [optional]
  * @return void
  */
 protected function checkEventBlockOnPage($page, $positive = true)
 {
     $this->cmsIndex->open();
     $this->cmsIndex->getTopmenu()->selectCategory($this->categoryName);
     if ($page == 'product_page') {
         $this->catalogCategoryView->getListProductBlock()->openProductViewPage($this->productName);
     }
     $eventBlockVisibility = $this->catalogProductView->getEventBlock()->isVisible();
     $positive == true ? \PHPUnit_Framework_Assert::assertTrue($eventBlockVisibility, "EventBlock is absent on {$page} page.") : \PHPUnit_Framework_Assert::assertFalse($eventBlockVisibility, "EventBlock is present on {$page} page.");
 }
コード例 #16
0
 /**
  * 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.');
 }
コード例 #17
0
 /**
  * Get prices on category page.
  *
  * @return array
  */
 protected function getCategoryPrice()
 {
     $prices = [];
     $this->cmsIndex->open();
     $this->cmsIndex->getTopmenu()->selectCategory($this->product->getCategoryIds()[0]);
     $priceBlock = $this->catalogCategoryView->getWeeeListProductBlock()->getProductItem($this->product)->getPriceBlock();
     foreach ($this->expectedPrices['category'] as $key => $type) {
         $prices[$key] = $this->getPrice($priceBlock, $key);
     }
     return $prices;
 }
コード例 #18
0
 /**
  * Assert that product can be found via Quick Search using searchable product attributes label.
  *
  * @param CatalogsearchResult $catalogSearchResult
  * @param CmsIndex $cmsIndex
  * @param InjectableFixture $product
  * @param CatalogProductAttribute $attribute
  * @return void
  */
 public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, InjectableFixture $product, CatalogProductAttribute $attribute)
 {
     $cmsIndex->open();
     $filter = $this->prepareFilter($product, $attribute);
     $cmsIndex->getSearchBlock()->search($filter);
     $isProductVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product);
     while (!$isProductVisible && $catalogSearchResult->getBottomToolbar()->nextPage()) {
         $isProductVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product);
     }
     \PHPUnit_Framework_Assert::assertTrue($isProductVisible, 'Product was not found by option label.');
 }
 /**
  * Assert that out of stock product is visible in the assigned category.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param InjectableFixture $product
  * @param CatalogCategory|null $category
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, InjectableFixture $product, CatalogCategory $category = null)
 {
     $categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $category->getName();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($categoryName);
     $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
         $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     }
     \PHPUnit_Framework_Assert::assertTrue($isProductVisible, "Product is absent on category page.");
 }
 /**
  * Assert that after applying changes, currency symbol changed on Catalog page.
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductSimple $product
  * @param CurrencySymbolEntity $currencySymbol
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductSimple $product, CurrencySymbolEntity $currencySymbol)
 {
     $categoryName = $product->getCategoryIds()[0];
     $cmsIndex->open();
     $cmsIndex->getCurrencyBlock()->switchCurrency($currencySymbol);
     $cmsIndex->getTopmenu()->selectCategory($categoryName);
     $price = $catalogCategoryView->getListProductBlock()->getPrice($product->getId());
     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 Category page.');
 }
コード例 #21
0
 /**
  * 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}'");
 }
コード例 #22
0
 /**
  * Assert that created store view is not available on frontend.
  *
  * @param Store $store
  * @param CmsIndex $cmsIndex
  * @return void
  */
 public function processAssert(Store $store, CmsIndex $cmsIndex)
 {
     $cmsIndex->open();
     $footerBlock = $cmsIndex->getFooterBlock();
     $headerBlock = $cmsIndex->getHeaderBlock();
     if ($footerBlock->isStoreGroupSwitcherVisible() && $footerBlock->isStoreGroupVisible($store)) {
         $footerBlock->selectStoreGroup($store);
     }
     $isStoreViewVisible = $headerBlock->isStoreViewDropdownVisible() ? $headerBlock->isStoreViewVisible($store) : false;
     // if only one store view is assigned to store group
     \PHPUnit_Framework_Assert::assertFalse($isStoreViewVisible, "Store view '{$store->getName()}' is visible in dropdown on CmsIndex page.");
 }
コード例 #23
0
 /**
  * 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);
 }
コード例 #24
0
 /**
  * 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);
 }
コード例 #25
0
 /**
  * Assert that Catalog Price Rule is applied & it impacts on product's discount price on Product page.
  *
  * @param InjectableFixture $product
  * @param CatalogProductView $pageCatalogProductView
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param array $prices
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProductView $pageCatalogProductView, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, array $prices)
 {
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
     $catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName());
     $productPriceBlock = $pageCatalogProductView->getViewBlock()->getPriceBlock();
     $actualPrices['regular'] = $productPriceBlock->getRegularPrice();
     $actualPrices['special'] = $productPriceBlock->getSpecialPrice();
     $actualPrices['discount_amount'] = number_format($actualPrices['regular'] - $actualPrices['special'], 2);
     $diff = $this->verifyData($actualPrices, $prices);
     \PHPUnit_Framework_Assert::assertEmpty($diff, $diff);
 }
コード例 #26
0
 /**
  * Assert that products are absent in category frontend page.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param CatalogCategory $category
  * @param array $unassignedProducts
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, CatalogCategory $category, array $unassignedProducts)
 {
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($category->getName());
     foreach ($unassignedProducts as $product) {
         $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
         while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
             $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
         }
         \PHPUnit_Framework_Assert::assertFalse($isProductVisible, "Product {$product->getName()} is present in category page.");
     }
 }
コード例 #27
0
 /**
  * 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);
 }
コード例 #28
0
 /**
  * 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.');
 }
コード例 #29
0
 /**
  * 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.');
 }
コード例 #30
0
 /**
  * Assert that product products' MAP has been applied on gesture.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param CatalogCategory $category
  * @param array $products
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, CatalogCategory $category, array $products)
 {
     foreach ($products as $product) {
         $productName = $product->getName();
         $cmsIndex->open();
         $cmsIndex->getTopmenu()->selectCategory($category->getName());
         $listProductBlock = $catalogCategoryView->getListProductBlock();
         // Check that price is present in MAP popup.
         $productPriceBlock = $listProductBlock->getProductPriceBlock($productName);
         $productPriceBlock->clickForPrice();
         $msrpPopupBlock = $productPriceBlock->getMapBlock();
         $map = $msrpPopupBlock->isVisible() ? $msrpPopupBlock->getMap() : null;
         \PHPUnit_Framework_Assert::assertEquals(number_format($product->getPrice(), 2), $map, "MAP of {$productName} product is not visible or not equal to product price.");
     }
 }