/**
  * Assert that created store view available on frontend (store view selector on page top)
  *
  * @param Store $store
  * @param CmsIndex $cmsIndex
  * @return void
  */
 public function processAssert(Store $store, CmsIndex $cmsIndex)
 {
     $cmsIndex->open();
     if ($cmsIndex->getFooterBlock()->isStoreGroupSwitcherVisible() && $cmsIndex->getFooterBlock()->isStoreGroupVisible($store)) {
         $cmsIndex->getFooterBlock()->selectStoreGroup($store);
     }
     $isStoreViewVisible = !$cmsIndex->getStoreSwitcherBlock()->isStoreViewDropdownVisible() ? true : $cmsIndex->getStoreSwitcherBlock()->isStoreViewVisible($store);
     \PHPUnit_Framework_Assert::assertTrue($isStoreViewVisible, "Store view is not visible in dropdown on CmsIndex page");
 }
 /**
  * Add created variable to page and assert that Custom Variable is displayed on frontend page and has
  * correct data according to dataset.
  *
  * @param SystemVariable $customVariable
  * @param CmsIndex $cmsIndex
  * @param SystemVariable $variable
  * @param FixtureFactory $fixtureFactory
  * @param BrowserInterface $browser
  * @param Store $storeOrigin
  * @param SystemVariable $customVariableOrigin
  * @return void
  */
 public function processAssert(SystemVariable $customVariable, CmsIndex $cmsIndex, SystemVariable $variable, FixtureFactory $fixtureFactory, BrowserInterface $browser, Store $storeOrigin = null, SystemVariable $customVariableOrigin = null)
 {
     $cmsPage = $fixtureFactory->createByCode('cmsPage', ['dataset' => 'default', 'data' => ['content' => ['content' => '{{customVar code=' . $customVariable->getCode() . '}}']]]);
     $cmsPage->persist();
     $browser->open($_ENV['app_frontend_url'] . $cmsPage->getIdentifier());
     $cmsIndex->getStoreSwitcherBlock()->selectStoreView('Default Store View');
     $htmlValue = $customVariableOrigin ? $this->getHtmlValue($customVariable, $customVariableOrigin) : strip_tags($customVariable->getHtmlValue());
     $pageContent = $cmsIndex->getCmsPageBlock()->getPageContent();
     $this->checkVariable($htmlValue, $pageContent);
     if ($storeOrigin !== null) {
         $cmsIndex->getStoreSwitcherBlock()->selectStoreView($storeOrigin->getName());
         $htmlValue = strip_tags($customVariable->getHtmlValue());
         if ($htmlValue === '') {
             $htmlValue = strip_tags($variable->getHtmlValue());
         }
         $pageContent = $cmsIndex->getCmsPageBlock()->getPageContent();
         $this->checkVariable($htmlValue, $pageContent);
     }
 }
 /**
  * Assert that category name is different on different store view.
  *
  * @param BrowserInterface $browser
  * @param CatalogCategoryView $categoryView
  * @param Category $category
  * @param Category $initialCategory
  * @param CmsIndex $cmsIndex
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogCategoryView $categoryView, Category $category, Category $initialCategory, CmsIndex $cmsIndex)
 {
     $cmsIndex->open();
     $cmsIndex->getLinksBlock()->waitWelcomeMessage();
     $browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html');
     \PHPUnit_Framework_Assert::assertEquals($initialCategory->getName(), $categoryView->getTitleBlock()->getTitle(), 'Wrong category name is displayed for default store.');
     $store = $category->getDataFieldConfig('store_id')['source']->store->getName();
     $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store);
     $cmsIndex->getLinksBlock()->waitWelcomeMessage();
     $browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html');
     \PHPUnit_Framework_Assert::assertEquals($category->getName(), $categoryView->getTitleBlock()->getTitle(), 'Wrong category name is displayed for ' . $store);
 }
 /**
  * Assert that locale options can be changed and checks new text on index page.
  *
  * @param SystemConfig $systemConfig
  * @param Store $store
  * @param CmsIndex $cmsIndex
  * @param string $locale
  * @param string $welcomeText
  * @return void
  */
 public function processAssert(SystemConfig $systemConfig, Store $store, CmsIndex $cmsIndex, $locale, $welcomeText)
 {
     // Set locale options
     $systemConfig->open();
     $systemConfig->getPageActions()->selectStore($store->getGroupId() . "/" . $store->getName());
     $configGroup = $systemConfig->getForm()->getGroup('Locale Options');
     $configGroup->open();
     $configGroup->setValue('select-groups-locale-fields-code-value', $locale);
     $systemConfig->getPageActions()->save();
     $systemConfig->getMessagesBlock()->waitSuccessMessage();
     // Check presents income text on index page
     $cmsIndex->open();
     $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName());
     \PHPUnit_Framework_Assert::assertTrue($cmsIndex->getSearchBlock()->isPlaceholderContains($welcomeText), "Locale not applied.");
 }
 /**
  * Assert that locale options can be changed and checks new text on index page.
  *
  * @param SystemConfig $systemConfig
  * @param Store $store
  * @param CmsIndex $cmsIndex
  * @param AdminCache $adminCache
  * @param string $locale
  * @param string $welcomeText
  */
 public function processAssert(SystemConfig $systemConfig, Store $store, CmsIndex $cmsIndex, AdminCache $adminCache, $locale, $welcomeText)
 {
     // Set locale options
     $systemConfig->open();
     $systemConfig->getPageActions()->selectStore($store->getGroupId() . "/" . $store->getName());
     $systemConfig->getModalBlock()->acceptAlert();
     $configGroup = $systemConfig->getForm()->getGroup('general', 'locale', 'code');
     $configGroup->setValue('general', 'locale', 'code', $locale);
     $systemConfig->getPageActions()->save();
     $systemConfig->getMessagesBlock()->waitSuccessMessage();
     // Flush cache
     $adminCache->open();
     $adminCache->getActionsBlock()->flushMagentoCache();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     // Check presents income text on index page
     $cmsIndex->open();
     if ($cmsIndex->getFooterBlock()->isStoreGroupSwitcherVisible() && $cmsIndex->getFooterBlock()->isStoreGroupVisible($store)) {
         $cmsIndex->getFooterBlock()->selectStoreGroup($store);
     }
     $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName());
     \PHPUnit_Framework_Assert::assertTrue($cmsIndex->getSearchBlock()->isPlaceholderContains($welcomeText), "Locale not applied.");
 }