Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
TreeElement.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Client\ElementInterface;
10 use Magento\Mtf\Client\Locator;
11 
15 class TreeElement extends Tree
16 {
22  protected $selectedCheckboxes = '//input[@checked=""]';
23 
29  protected $imagePlus = './div/img[contains(@class, "-plus")]';
30 
36  protected $input = '/div/a/span';
37 
43  protected $parentElement = './../../../../../div/a/span';
44 
50  protected $selectedLabels = '//input[@checked=""]/../a/span';
51 
57  protected $pattern = '//li[@class="x-tree-node" and div/a/span[contains(text(),"%s")]]';
58 
64  protected $regPatternLabel = '`(.+) \(.*`';
65 
71  public function clear()
72  {
73  $checkboxes = $this->getElements($this->selectedCheckboxes, Locator::SELECTOR_XPATH, 'checkbox');
74  foreach ($checkboxes as $checkbox) {
75  $checkbox->setValue('No');
76  }
77  }
78 
85  protected function displayChildren($element)
86  {
87  $element = $this->find(sprintf($this->pattern, $element), Locator::SELECTOR_XPATH);
88  $plusButton = $element->find($this->imagePlus, Locator::SELECTOR_XPATH);
89  if ($plusButton->isVisible()) {
90  $plusButton->click();
91  $this->waitLoadChildren($element);
92  }
93  }
94 
101  protected function getElementLabel(ElementInterface $element)
102  {
103  $value = $element->getText();
104  preg_match($this->regPatternLabel, $value, $matches);
105 
106  return trim($matches[1]);
107  }
108 }
waitLoadChildren(ElementInterface $element)
Definition: Tree.php:174
taxRateField find('.mselect-list') .on( 'click.mselect-edit'
Definition: edit.phtml:162
getElementLabel(ElementInterface $element)
$value
Definition: gender.phtml:16
$element
Definition: element.phtml:12