Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
WidgetForm.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Block\Form;
10 use Magento\Mtf\Client\Locator;
11 
15 class WidgetForm extends Form
16 {
22  protected $widgetType = '[name="widget_type"]';
23 
29  protected $insertButton = '#insert_button';
30 
36  protected $loaderOld = '//ancestor::body/div[@id="loading-mask"]';
37 
44  public function addWidget($widget)
45  {
46  $this->selectWidgetType($widget['widget_type']);
47  $mapping = $this->dataMapping($widget);
48  $this->_fill($mapping);
49  $this->insertWidget();
50  }
51 
58  protected function selectWidgetType($type)
59  {
60  $this->_rootElement->find($this->widgetType, Locator::SELECTOR_CSS, 'select')->setValue($type);
61  $this->waitForElementNotVisible($this->loaderOld, Locator::SELECTOR_XPATH);
62  }
63 
69  protected function insertWidget()
70  {
71  $this->_rootElement->find($this->insertButton)->click();
72  $this->waitForElementNotVisible($this->loaderOld, Locator::SELECTOR_XPATH);
73  }
74 }
$type
Definition: item.phtml:13