/** * Creating Cms page. * * @param CmsPageFixture $cms * @return void */ public function test(CmsPageFixture $cms) { // Steps $this->cmsIndex->open(); $this->cmsIndex->getPageActionsBlock()->addNew(); $this->cmsPageNew->getPageForm()->fill($cms); $this->cmsPageNew->getPageMainActions()->save(); }
/** * Assert that created CMS page with 'Status' - Disabled displays with '404 Not Found' message on Frontend. * * @param CmsPage $cms * @param FrontCmsIndex $frontCmsIndex * @param CmsPageIndex $cmsIndex * @param BrowserInterface $browser * @return void */ public function processAssert(CmsPage $cms, FrontCmsIndex $frontCmsIndex, CmsPageIndex $cmsIndex, BrowserInterface $browser) { $cmsIndex->open(); $filter = ['title' => $cms->getTitle()]; $cmsIndex->getCmsPageGridBlock()->searchAndPreview($filter); $browser->selectWindow(); \PHPUnit_Framework_Assert::assertEquals(self::NOT_FOUND_MESSAGE, $frontCmsIndex->getTitleBlock()->getTitle(), 'Wrong page is displayed.'); }
/** * Update CMS Page. * * @param CmsPage $cms * @param CmsPage $cmsOriginal * @return array */ public function test(CmsPage $cms, CmsPage $cmsOriginal) { // Steps $this->cmsPageIndex->open(); $this->cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cmsOriginal->getTitle()]); $this->cmsPageNew->getPageForm()->fill($cms); $this->cmsPageNew->getPageMainActions()->save(); return ['cms' => $this->factory->createByCode('cmsPage', ['data' => array_merge($cmsOriginal->getData(), $cms->getData())])]; }
/** * Delete CMS Page. * * @param CmsPage $cmsPage * @return void */ public function test(CmsPage $cmsPage) { // Preconditions $cmsPage->persist(); // Steps $this->cmsPageIndex->open(); $this->cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cmsPage->getTitle()]); $this->cmsPageNew->getPageMainActions()->delete(); }
/** * Assert that displayed CMS page data on edit page equals passed from fixture. * * @param CmsPage $cms * @param CmsPageIndex $cmsIndex * @param CmsPageNew $cmsPageNew * @return void */ public function processAssert(CmsPage $cms, CmsPageIndex $cmsIndex, CmsPageNew $cmsPageNew) { $cmsIndex->open(); $filter = ['title' => $cms->getTitle()]; $cmsIndex->getCmsPageGridBlock()->searchAndOpen($filter); $cmsFormData = $cmsPageNew->getPageForm()->getData($cms); $cmsFormData['store_id'] = implode('/', $cmsFormData['store_id']); $errors = $this->verifyData($cms->getData(), $cmsFormData); \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); }
/** * Creating Cms page. * * @param array $data * @param string $fixtureType * @return array */ public function test(array $data, $fixtureType) { // Steps $cms = $this->fixtureFactory->createByCode($fixtureType, ['data' => $data]); $this->cmsIndex->open(); $this->cmsIndex->getPageActionsBlock()->addNew(); $this->cmsPageNew->getPageForm()->fill($cms); $this->cmsPageNew->getPageMainActions()->save(); return ['cms' => $cms]; }
/** * Creating Cms page. * * @param CmsPageFixture $cms * @return void */ public function test(CmsPageFixture $cms) { // Steps $this->cmsIndex->open(); $this->cmsIndex->getPageActionsBlock()->addNew(); //TODO: remove cms page new refresh after resolve issue with static js files publication (MAGETWO-37898) $this->cmsPageNew->open(); $this->cmsPageNew->getPageForm()->fill($cms); $this->cmsPageNew->getPageMainActions()->save(); }
/** * Creating Cms page. * * @param array $data * @param string $fixtureType * @return array */ public function test(array $data, $fixtureType) { // Steps $cms = $this->fixtureFactory->createByCode($fixtureType, ['data' => $data]); $this->cmsIndex->open(); $this->cmsIndex->getPageActionsBlock()->addNew(); //TODO: remove cms page new refresh after resolve issue with static js files publication (MAGETWO-37898) $this->cmsPageNew->open(); $this->cmsPageNew->getPageForm()->fill($cms); $this->cmsPageNew->getPageMainActions()->save(); return ['cms' => $cms]; }
/** * Assert that content of created cms page displayed in section 'maincontent' and equals passed from fixture. * * @param CmsPageIndex $cmsIndex * @param FrontCmsIndex $frontCmsIndex * @param FrontCmsPage $frontCmsPage * @param CmsPage $cms * @param BrowserInterface $browser * @return void */ public function processAssert(CmsPageIndex $cmsIndex, FrontCmsIndex $frontCmsIndex, FrontCmsPage $frontCmsPage, CmsPage $cms, BrowserInterface $browser) { $cmsIndex->open(); $filter = ['title' => $cms->getTitle()]; $cmsIndex->getCmsPageGridBlock()->searchAndPreview($filter); $browser->selectWindow(); $fixtureContent = $cms->getContent(); \PHPUnit_Framework_Assert::assertContains($fixtureContent['content'], $frontCmsPage->getCmsPageBlock()->getPageContent(), 'Wrong content is displayed.'); if (isset($fixtureContent['widget'])) { foreach ($fixtureContent['widget']['preset'] as $widget) { \PHPUnit_Framework_Assert::assertTrue($frontCmsPage->getCmsPageBlock()->isWidgetVisible($widget['widget_type'], $widget['anchor_text']), 'Widget \'' . $widget['widget_type'] . '\' is not displayed.'); } } if ($cms->getContentHeading()) { \PHPUnit_Framework_Assert::assertEquals($cms->getContentHeading(), $frontCmsIndex->getTitleBlock()->getTitle(), 'Wrong title is displayed.'); } }
/** * Assert that Cms page is not present in pages grid. * * @param CmsPageIndex $cmsIndex * @param CmsPage $cmsPage * @return void */ public function processAssert(CmsPageIndex $cmsIndex, CmsPage $cmsPage) { $filter = ['title' => $cmsPage->getTitle()]; \PHPUnit_Framework_Assert::assertFalse($cmsIndex->getCmsPageGridBlock()->isRowVisible($filter), 'Cms page \'' . $cmsPage->getTitle() . '\' is present in pages grid.'); }
/** * Assert that success message is displayed after Cms page delete. * * @param CmsPageIndex $cmsIndex * @return void */ public function processAssert(CmsPageIndex $cmsIndex) { $actualMessage = $cmsIndex->getMessagesBlock()->getSuccessMessages(); \PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_DELETE_MESSAGE, $actualMessage, 'Wrong success message is displayed.' . "\nExpected: " . self::SUCCESS_DELETE_MESSAGE . "\nActual: " . $actualMessage); }
/** * Assert that cms page is present in pages grid. * * @param CmsPageIndex $cmsIndex * @param CmsPage $cms * @return void */ public function processAssert(CmsPageIndex $cmsIndex, CmsPage $cms) { $filter = ['title' => $cms->getTitle()]; $cmsIndex->open(); \PHPUnit_Framework_Assert::assertTrue($cmsIndex->getCmsPageGridBlock()->isRowVisible($filter, true, false), 'Cms page \'' . $cms->getTitle() . '\' is not present in pages grid.'); }
/** * Verify that page has not been created. * * @param CmsPageIndex $cmsIndex * @return void */ public function processAssert(CmsPageIndex $cmsIndex) { $message = $cmsIndex->getMessagesBlock()->getErrorMessage(); \PHPUnit_Framework_Assert::assertEquals(self::ERROR_SAVE_MESSAGE, $message, 'Wrong error message is displayed.' . "\nExpected: " . self::ERROR_SAVE_MESSAGE . "\nActual: " . $message); }