Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PageForm.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Mtf\Client\Locator;
11 
15 class PageForm extends FormTabs
16 {
22  protected $toggleButton = "#togglepage_content";
23 
29  protected $contentForm = "#page_content";
30 
36  protected $loader = "data-role='loader'";
37 
43  protected $header = 'header.page-content, [data-ui-id="page-actions-toolbar-content-header"]';
44 
50  protected function toggleEditor()
51  {
52  $content = $this->_rootElement->find($this->contentForm, Locator::SELECTOR_CSS);
53  $toggleButton = $this->_rootElement->find($this->toggleButton, Locator::SELECTOR_CSS);
54  if (!$content->isVisible() && $toggleButton->isVisible()) {
55  $toggleButton->click();
56  }
57  }
58 
64  public function getSystemVariables()
65  {
66  $this->openTab('content');
68  $contentTab = $this->getTab('content');
70  $contentTab->clickInsertVariable();
71  $config = $contentTab->getWysiwygConfig();
72 
73  return $config->getAllVariables();
74  }
75 
82  public function openTab($tabName)
83  {
84  $this->browser->find($this->header)->hover();
85  $tab = $this->getContainerElement($tabName);
86  $tabHeader = $tab->find('.//*[contains(@class,"admin__collapsible-title")]', Locator::SELECTOR_XPATH);
87  if ($tabHeader->isVisible() && strpos($tabHeader->getAttribute('class'), '_show') === false) {
88  $tabHeader->hover();
89  $tabHeader->click();
90  };
91  return $this;
92  }
93 
99  public function isVariablesBlockVisible()
100  {
101  $this->openTab('content');
103  $contentTab = $this->getTab('content');
104  $contentTab->clickInsertVariable();
105  $this->waitForElementNotVisible($this->loader);
106  return $contentTab->isVariablesBlockVisible();
107  }
108 }
$config
Definition: fraud_order.php:17