/** * 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 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); }
/** * 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}'"); }