Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BlockForm.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Block\Form;
10 use Magento\Mtf\Client\Locator;
12 
16 class BlockForm extends Form
17 {
23  protected $toggleButton = "#toggleblock_content";
24 
30  protected $contentForm = "#page_content";
31 
37  protected $customVariableBlock = "./ancestor::body//div[div[@id='variables-chooser']]";
38 
44  protected $addVariableButton = ".add-variable";
45 
51  public function clickInsertVariable()
52  {
53  $addVariableButton = $this->_rootElement->find($this->addVariableButton);
54  if ($addVariableButton->isVisible()) {
55  $addVariableButton->click();
56  }
57  }
58 
64  public function getWysiwygConfig()
65  {
66  return $this->blockFactory->create(
67  \Magento\Cms\Test\Block\Adminhtml\Wysiwyg\Config::class,
68  ['element' => $this->_rootElement->find($this->customVariableBlock, Locator::SELECTOR_XPATH)]
69  );
70  }
71 
77  public function toggleEditor()
78  {
79  $content = $this->_rootElement->find($this->contentForm, Locator::SELECTOR_CSS);
80  $toggleButton = $this->_rootElement->find($this->toggleButton, Locator::SELECTOR_CSS);
81  if (!$content->isVisible() && $toggleButton->isVisible()) {
82  $toggleButton->click();
83  }
84  }
85 }