Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FormTabs.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Client\Element\SimpleElement;
11 use Magento\Mtf\Fixture\FixtureInterface;
12 use Magento\Mtf\Fixture\InjectableFixture;
13 
21 {
27  public function getTabs()
28  {
29  return $this->containers;
30  }
31 
39  public function getTab($tabName)
40  {
41  return $this->getContainer($tabName);
42  }
43 
51  protected function fillTabs($tabsData, $element)
52  {
53  return $this->fillContainers($tabsData, $element);
54  }
55 
62  public function update(FixtureInterface $fixture)
63  {
64  $tabs = $this->getFixtureFieldsByContainers($fixture);
65  foreach ($tabs as $tab => $tabFields) {
66  $this->openTab($tab)->setFieldsData($tabFields, $this->_rootElement);
67  }
68  return $this;
69  }
70 
74  protected function openContainer($tabName)
75  {
76  return $this->openTab($tabName);
77  }
78 
86  public function openTab($tabName)
87  {
88  $this->browser->find($this->header)->hover();
89  if (!$this->isTabVisible($tabName)) {
90  throw new \Exception(
91  'Tab "' . $tabName . '" is not visible.'
92  );
93  }
94  $this->browser->find($this->header)->hover();
95  $this->clickOnTabName($tabName);
96  $this->browser->find($this->header)->hover();
97 
98  return $this;
99  }
100 
107  protected function clickOnTabName($tabName)
108  {
109  $this->getContainerElement($tabName)->click();
110  }
111 
118  public function isTabVisible($tabName)
119  {
120  return $this->getContainerElement($tabName)->isVisible();
121  }
122 }
update(FixtureInterface $fixture)
Definition: FormTabs.php:62
$element
Definition: element.phtml:12