Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FormSections.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Fixture\InjectableFixture;
10 
15 {
21  protected $collapsedSection = '[data-state-collapsible="closed"]';
22 
28  protected $expandedSection = '[data-state-collapsible="open"]';
29 
37  public function getSection($sectionName)
38  {
39  return $this->getContainer($sectionName);
40  }
41 
45  protected function openContainer($sectionName)
46  {
47  return $this->openSection($sectionName);
48  }
49 
57  public function openSection($sectionName)
58  {
59  $container = $this->getContainerElement($sectionName);
60  if (!$container->isVisible()) {
61  throw new \Exception('Container is not found "' . $sectionName . '""');
62  }
63  $section = $container->find($this->collapsedSection);
64  if ($section->isVisible()) {
65  $section->click();
66  }
67 
68  return $this;
69  }
70 
78  public function isCollapsible($sectionName)
79  {
80  $section = $this->getContainerElement($sectionName);
81 
82  if ($section->find($this->collapsedSection)->isVisible()) {
83  return true;
84  } elseif ($section->find($this->expandedSection)->isVisible()) {
85  return true;
86  } else {
87  return false;
88  }
89  }
90 
97  public function getRequireNoticeFields(InjectableFixture $product)
98  {
99  $data = [];
100  $sections = $this->getFixtureFieldsByContainers($product);
101  foreach (array_keys($sections) as $sectionName) {
102  $section = $this->getSection($sectionName);
103  $this->openSection($sectionName);
104  $errors = $section->getValidationErrors();
105  if (!empty($errors)) {
106  $data[$sectionName] = $errors;
107  }
108  }
109 
110  return $data;
111  }
112 
120  public function isSectionVisible($sectionName)
121  {
122  return !$this->getContainerElement($sectionName)->find($this->collapsedSection)->isVisible();
123  }
124 }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
getRequireNoticeFields(InjectableFixture $product)
$errors
Definition: overview.phtml:9