/** * 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 content of created cms page displayed in main content section and equals passed from fixture. * * @param CmsPage $cms * @param CmsPageIndex $cmsPageIndex * @param FrontendCmsPage $frontendCmsPage * @param CmsPageEdit $cmsPageEdit * @param Browser $browser * @return void */ public function processAssert(CmsPage $cms, CmsPageIndex $cmsPageIndex, FrontendCmsPage $frontendCmsPage, CmsPageEdit $cmsPageEdit, Browser $browser) { $cmsPageIndex->open(); $cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cms->getTitle()]); $cmsPageEdit->getPageMainActions()->preview(); $browser->selectWindow(); $frontendCmsPage->getTemplateBlock()->waitLoader(); $browser->switchToFrame(new Locator($this->iFrameSelector)); $element = $browser->find('body'); $fixtureContent = $cms->getContent(); \PHPUnit_Framework_Assert::assertContains($fixtureContent['content'], $frontendCmsPage->getCmsPageContentBlock()->getPageContent($element), 'Wrong content is displayed.'); if ($cms->getContentHeading()) { \PHPUnit_Framework_Assert::assertEquals(strtolower($cms->getContentHeading()), strtolower($frontendCmsPage->getCmsPageContentBlock()->getPageTitle($element)), 'Wrong title is displayed.'); } if (isset($fixtureContent['widget'])) { foreach ($fixtureContent['widget']['preset'] as $widget) { \PHPUnit_Framework_Assert::assertTrue($frontendCmsPage->getCmsPageContentBlock()->isWidgetVisible($widget), "Widget '{$widget['widget_type']}' is not displayed."); } } }
/** * Assert that content of created cms page displayed in main content section and equals passed from fixture. * * @param CmsPage $cms * @param CmsPageIndex $cmsPageIndex * @param FrontendCmsPage $frontendCmsPage * @param Browser $browser * @param bool $isIFrame [optional] * @return void */ public function processAssert(CmsPage $cms, CmsPageIndex $cmsPageIndex, FrontendCmsPage $frontendCmsPage, Browser $browser, $isIFrame = false) { $cmsPageIndex->open(); $cmsPageIndex->getCmsPageGridBlock()->searchAndReview(['title' => $cms->getTitle()]); $browser->selectWindow(); if ($isIFrame) { $this->switchToFrame($browser); } $element = $browser->find('body'); $fixtureContent = $cms->getContent(); \PHPUnit_Framework_Assert::assertContains($fixtureContent['content'], $frontendCmsPage->getCmsPageContentBlock()->getPageContent($element), 'Wrong content is displayed.'); if ($cms->getContentHeading()) { \PHPUnit_Framework_Assert::assertEquals(strtolower($cms->getContentHeading()), strtolower($frontendCmsPage->getCmsPageContentBlock()->getPageTitle($element)), 'Wrong title is displayed.'); } if (isset($fixtureContent['widget'])) { foreach ($fixtureContent['widget']['preset'] as $widget) { \PHPUnit_Framework_Assert::assertTrue($frontendCmsPage->getCmsPageContentBlock()->isWidgetVisible($widget), "Widget '{$widget['widget_type']}' is not displayed."); } } $browser->closeWindow(); $browser->selectWindow(); $browser->switchToFrame(); }
/** * Assert that created CMS page with status "disabled" displays with error message on frontend. * * @param CmsPage $cms * @param FrontendCmsPage $frontendCmsPage * @param Browser $browser * @return void */ public function processAssert(CmsPage $cms, FrontendCmsPage $frontendCmsPage, Browser $browser) { $browser->open($_ENV['app_frontend_url'] . $cms->getIdentifier()); \PHPUnit_Framework_Assert::assertEquals(self::ERROR_MESSAGE, $frontendCmsPage->getCmsPageContentBlock()->getPageHeadTitle(), 'Wrong page is displayed.'); }
/** * 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 * @return void */ public function processAssert(CmsPage $cms, FrontendCmsPage $frontendCmsPage, Browser $browser, CmsIndex $cmsIndex) { $browser->open($_ENV['app_frontend_url'] . $cms->getIdentifier()); $cmsIndex->getHeaderBlock()->selectStore('Default Store View'); \PHPUnit_Framework_Assert::assertEquals(self::ERROR_MESSAGE, $frontendCmsPage->getCmsPageContentBlock()->getPageHeadTitle(), 'Wrong page content is displayed.'); }