Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NewConfigurableAttributeForm.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Mtf\Client\Element\SimpleElement;
11 use Magento\Mtf\Client\Locator;
12 use Magento\Mtf\Fixture\FixtureInterface;
13 
18 {
24  protected $iFrame = '#create_new_attribute_container';
25 
31  protected $saveButton = '#save';
32 
38  private $isSectionOpened = 'active';
39 
47  public function fill(FixtureInterface $fixture, SimpleElement $element = null)
48  {
49  $this->browser->switchToFrame(new Locator($this->iFrame));
50  $browser = $this->browser;
51  $selector = $this->saveButton;
52  $this->browser->waitUntil(
53  function () use ($browser, $selector) {
54  return $browser->find($selector)->isVisible() ? true : null;
55  }
56  );
57  parent::fill($fixture, $element);
58  $this->browser->switchToFrame();
59  }
60 
67  public function openSection($sectionName)
68  {
69  $selector = $this->getContainerElement($sectionName)->getLocator()['value'];
70  $strategy = null !== $this->getContainerElement($sectionName)->getLocator()['using']
71  ? $this->getContainerElement($sectionName)->getLocator()['using']
72  : Locator::SELECTOR_CSS;
73  $sectionClass = $this->_rootElement->find($selector, $strategy)->getAttribute('class');
74  if (strpos($sectionClass, $this->isSectionOpened) === false) {
75  $this->_rootElement->find($selector, $strategy)->click();
76  }
77 
78  return $this;
79  }
80 
86  public function saveAttributeForm()
87  {
88  $this->browser->switchToFrame(new Locator($this->iFrame));
89  $this->browser->find($this->saveButton)->click();
90  $this->browser->switchToFrame();
91  }
92 }
$element
Definition: element.phtml:12