/** * 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 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 created CMS page displays with error message on unassigned store views on frontend. * * @param CmsPage $cms * @param FrontendCmsPage $frontendCmsPage * @param Browser $browser * @param CmsIndex $cmsIndex * @param string|null $notFoundMessage * @return void */ public function processAssert(CmsPage $cms, FrontendCmsPage $frontendCmsPage, Browser $browser, CmsIndex $cmsIndex, $notFoundMessage = null) { $browser->open($_ENV['app_frontend_url'] . $cms->getIdentifier()); $notFoundMessage = $notFoundMessage !== null ? $notFoundMessage : self::ERROR_MESSAGE; $cmsIndex->getHeaderBlock()->selectStore('Default Store View'); \PHPUnit_Framework_Assert::assertContains($notFoundMessage, $frontendCmsPage->getCmsPageContentBlock()->getPageContent(), 'Wrong page content is displayed.'); }
/** * 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.'); }
/** * Run step. * * @return void */ public function run() { $this->customerAccountLogout->open(); $this->cmsIndex->getFooterBlock()->clickLink('Orders and Returns'); $this->salesGuestForm->getSearchForm()->fill($this->order); $this->salesGuestForm->getSearchForm()->submit(); }
/** * 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 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); }
/** * 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.'); }
/** * Assert that product is not present in Wishlist on frontend. * * @param WishlistIndex $wishlistIndex * @param CmsIndex $cmsIndex * @param Customer $customer * @param FrontendActionsForCustomer $frontendActionsForCustomer * @param InjectableFixture[] $products * @return void */ public function processAssert(WishlistIndex $wishlistIndex, CmsIndex $cmsIndex, Customer $customer, FrontendActionsForCustomer $frontendActionsForCustomer, array $products) { $frontendActionsForCustomer->loginCustomer($customer); $cmsIndex->getTopLinksBlock()->openAccountLink("My Wishlist"); $itemBlock = $wishlistIndex->getItemsBlock(); foreach ($products as $itemProduct) { \PHPUnit_Framework_Assert::assertFalse($itemBlock->getItemProductBlock($itemProduct)->isVisible(), "Product '{$itemProduct->getName()}' is present in Wishlist on frontend."); } }
/** * 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 the correct option details are displayed on the "View Details" tool tip. * * @param CmsIndex $cmsIndex * @param WishlistIndex $wishlistIndex * @param InjectableFixture $product * @param FixtureFactory $fixtureFactory * @return void */ public function processAssert(CmsIndex $cmsIndex, WishlistIndex $wishlistIndex, InjectableFixture $product, FixtureFactory $fixtureFactory) { $cmsIndex->getTopLinksBlock()->openAccount(); $cmsIndex->getLinksBlock()->openLink("My Wishlist"); $actualOptions = $wishlistIndex->getItemsBlock()->getItemProductBlock($product)->getOptions(); $cartFixture = $fixtureFactory->createByCode('cart', ['data' => ['items' => ['products' => [$product]]]]); $expectedOptions = $this->prepareOptions($cartFixture); $errors = $this->verifyData($expectedOptions, $this->sortDataByPath($actualOptions, '::title')); \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); }
/** * 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); }
/** * 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.'); }
/** * Assert that Compare Products block is presented on CMS pages. * Block contains information about compared products. * * @param CmsIndex $cmsIndex * @param FixtureFactory $fixtureFactory * @param Browser $browser * @param array $products * @return void */ public function processAssert(CmsIndex $cmsIndex, FixtureFactory $fixtureFactory, Browser $browser, array $products) { $newCmsPage = $fixtureFactory->createByCode('cmsPage', ['dataSet' => '3_column_template']); $newCmsPage->persist(); $browser->open($_ENV['app_frontend_url'] . $newCmsPage->getIdentifier()); foreach ($products as &$product) { $product = strtolower($product->getName()); } \PHPUnit_Framework_Assert::assertEquals($products, $cmsIndex->getCompareBlock()->getProducts(), 'Compare product block contains NOT valid information about compared products.'); }
/** * Assert that products are present in custom wishlist. * * @param CmsIndex $cmsIndex * @param Wishlist $multipleWishlist * @param WishlistIndex $wishlistIndex * @param InjectableFixture[] $products * @param int[]|null $qtyToAction * @return void */ public function processAssert(CmsIndex $cmsIndex, Wishlist $multipleWishlist, WishlistIndex $wishlistIndex, array $products, $qtyToAction = null) { $this->wishlistIndex = $wishlistIndex; $cmsIndex->getTopLinksBlock()->openAccount(); $cmsIndex->getLinksBlock()->openLink("My Wishlist"); $wishlistIndex->getManagementBlock()->selectWishlist($multipleWishlist); foreach ($products as $key => $product) { $expectedQty = $qtyToAction !== null && isset($qtyToAction[$key]) ? $qtyToAction[$key] : null; $this->verifyItemProduct($product, $expectedQty); } }
/** * 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.'); }
/** * 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 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 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 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); }
/** * 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 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."); } }
/** * 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."); }
/** * 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); }
/** * 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 after save a search term: * - it displays in the Search field at the top of the page if type set of characters passed from fixture * - after click 'Go' of Search field opens a results page if it was not specified Redirect URL * - after click 'Go' of Search field a customer search redirects to a specific page (passed from fixture) * if it was specified Redirect URL * * @param CmsIndex $cmsIndex * @param CatalogSearchQuery $searchTerm * @param Browser $browser * @return void */ public function processAssert(CmsIndex $cmsIndex, CatalogSearchQuery $searchTerm, Browser $browser) { $errors = []; $this->searchBlock = $cmsIndex->open()->getSearchBlock(); if ($searchTerm->hasData('display_in_terms') && $searchTerm->getDisplayInTerms() === 'Yes') { $errors = !$this->isSugestSearchisVisible($searchTerm) ? '- block "Suggest Search" when searching was not found' : []; } $this->searchBlock->search($searchTerm->getQueryText()); $windowUrl = $browser->getUrl(); $redirectUrl = $searchTerm->getRedirect(); if ($windowUrl !== $redirectUrl) { $errors[] = '- url window (' . $windowUrl . ') does not match the url redirect(' . $redirectUrl . ')'; } \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); }
/** * Assert that rma is correct display on frontend (MyAccount - My Returns): * - status on rma history page * - details and items on rma view page * * @param Rma $rma * @param CmsIndex $cmsIndex * @param CustomerAccountIndex $customerAccountIndex * @param RmaReturnHistory $rmaReturnHistory * @param RmaReturnView $rmaReturnView * @return void */ public function processAssert(Rma $rma, CmsIndex $cmsIndex, CustomerAccountIndex $customerAccountIndex, RmaReturnHistory $rmaReturnHistory, RmaReturnView $rmaReturnView) { $this->rmaReturnHistory = $rmaReturnHistory; $this->rmaReturnView = $rmaReturnView; $this->order = $rma->getDataFieldConfig('order_id')['source']->getOrder(); $this->customer = $this->order->getDataFieldConfig('customer_id')['source']->getCustomer(); $this->productHandlerClass = $this->getProductHandlerClass(); $this->login(); $cmsIndex->getTopLinksBlock()->openAccountLink('My Account'); $customerAccountIndex->getAccountNavigationBlock()->openNavigationItem('My Returns'); $this->assertRmaStatus($rma); $rmaReturnHistory->getRmaHistory()->getItemRow($rma)->open(); $this->assertRequestInformation($rma); $this->assertItemsData($rma); }
/** * 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."); } }