/**
  * Assert that link to Currently Published Revision on CMS Page Information Form is available.
  *
  * @param CmsRevisionEdit $cmsRevisionEdit
  * @param CmsPage $cms
  * @param CmsPageEdit $cmsPageEdit
  * @param CmsPageIndex $cmsPageIndex
  * @param array $results
  * @param Revision|null $revision [optional]
  * @return void
  */
 public function processAssert(CmsRevisionEdit $cmsRevisionEdit, CmsPage $cms, CmsPageEdit $cmsPageEdit, CmsPageIndex $cmsPageIndex, array $results, Revision $revision = null)
 {
     $filter = ['title' => $cms->getTitle()];
     $cmsPageIndex->open();
     $cmsPageIndex->getCmsPageGridBlock()->searchAndOpen($filter);
     $formPublishedRevision = $cmsPageEdit->getPageVersionsForm()->getCurrentlyPublishedRevisionText();
     \PHPUnit_Framework_Assert::assertEquals($cms->getTitle() . '; ' . $results['revision'], $formPublishedRevision, 'Link to Currently Published Revision not equals to passed in fixture.');
     $cmsPageEdit->getPageVersionsForm()->clickCurrentlyPublishedRevision();
     $formRevisionData = $cmsRevisionEdit->getRevisionForm()->getTabElement('content')->getContentData();
     $fixtureRevisionData['revision'] = $results['revisionKey'];
     $fixtureRevisionData['version'] = $cms->getTitle();
     $fixtureRevisionData['content'] = $revision !== null ? ['content' => $revision->getContent()] : $cms->getContent();
     $error = $this->verifyData($fixtureRevisionData, $formRevisionData);
     \PHPUnit_Framework_Assert::assertEmpty($error, $error);
 }
Ejemplo n.º 2
0
 /**
  * Assert that displayed CMS page data on edit page equals passed from fixture.
  *
  * @param CmsPage $cms
  * @param CmsPageIndex $cmsPageIndex
  * @param CmsPageNew $cmsPageNew
  * @return void
  */
 public function processAssert(CmsPage $cms, CmsPageIndex $cmsPageIndex, CmsPageNew $cmsPageNew)
 {
     $cmsPageIndex->open();
     $cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cms->getTitle()]);
     $cmsFormData = $cmsPageNew->getPageForm()->getData($cms);
     $errors = $this->verifyData($cms->getData(), $cmsFormData);
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
Ejemplo n.º 3
0
 /**
  * Delete CMS Page.
  *
  * @param CmsPage $cmsPage
  * @return void
  */
 public function test(CmsPage $cmsPage)
 {
     // Preconditions
     $cmsPage->persist();
     // Steps
     $this->cmsIndex->open();
     $this->cmsIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cmsPage->getTitle()]);
     $this->cmsEdit->getPageMainActions()->deleteAndAcceptAlert();
 }
 /**
  * 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.");
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * 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();
 }
Ejemplo n.º 6
0
 /**
  * Assert that CMS page cann't be found in grid via:
  * - Page title type
  * - Url Key
  * - Status
  *
  * @param CmsPageIndex $cmsIndex
  * @param CmsPage $cmsPage
  * @return void
  */
 public function processAssert(CmsPageIndex $cmsIndex, CmsPage $cmsPage)
 {
     $cmsIndex->open();
     $filter = ['title' => $cmsPage->getTitle(), 'identifier' => $cmsPage->getIdentifier(), 'is_active' => $cmsPage->getIsActive()];
     \PHPUnit_Framework_Assert::assertFalse($cmsIndex->getCmsPageGridBlock()->isRowVisible($filter), "Cms page {$cmsPage->getTitle()} is present in pages grid.");
 }
Ejemplo n.º 7
0
 /**
  * Assert that cms page is present in pages grid.
  *
  * @param CmsPage $cms
  * @param CmsPageIndex $cmsPageIndex
  * @return void
  */
 public function processAssert(CmsPage $cms, CmsPageIndex $cmsPageIndex)
 {
     $cmsPageIndex->open();
     $cmsTitle = $cms->getTitle();
     \PHPUnit_Framework_Assert::assertTrue($cmsPageIndex->getCmsPageGridBlock()->isRowVisible(['title' => $cmsTitle]), "Cms page '{$cmsTitle}' is not present in pages grid.");
 }
 /**
  * Run publish cms page revision test.
  *
  * @param CmsPage $cms
  * @param Revision $revision
  * @param int $initialRevision
  * @param int $revisionId
  * @return void
  */
 public function test(CmsPage $cms, Revision $revision, $initialRevision, $revisionId)
 {
     // Steps
     $this->cmsPageIndex->open();
     $title = $cms->getTitle();
     $this->cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $title]);
     $this->cmsPageEdit->getPageVersionsForm()->openTab('versions');
     $filter = ['label' => $title];
     $revisionGrid = $this->cmsVersionEdit->getRevisionsGrid();
     $revisionForm = $this->cmsRevisionEdit->getRevisionForm();
     $this->cmsPageEdit->getPageVersionsForm()->getTabElement('versions')->getVersionsGrid()->searchAndOpen($filter);
     $revisionGrid->searchAndOpen(['revision_number_from' => $revisionId]);
     $revisionForm->toggleEditor();
     $revisionForm->fill($revision);
     $this->cmsRevisionEdit->getFormPageActions()->save();
     $filter = ['revision_number_from' => $initialRevision, 'revision_number_to' => $initialRevision];
     $revisionGrid->searchAndOpen($filter);
     $this->cmsRevisionEdit->getFormPageActions()->publish();
 }
 /**
  * Update CMS Page test.
  *
  * @param CmsPage $cms
  * @param CmsPage $cmsOriginal
  * @return array
  */
 public function test(CmsPage $cms, CmsPage $cmsOriginal)
 {
     // Steps
     $this->cmsIndex->open();
     $filter = ['title' => $cmsOriginal->getTitle()];
     $this->cmsIndex->getCmsPageGridBlock()->searchAndOpen($filter);
     $this->cmsEdit->getPageForm()->fill($cms);
     $this->cmsEdit->getPageMainActions()->save();
     return ['cms' => $this->factory->createByCode('cmsPage', ['data' => array_merge($cmsOriginal->getData(), $cms->getData())])];
 }