Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CaseSearch.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Mtf\Block\Form;
9 
13 class CaseSearch extends Form
14 {
20  private $searchBar = '[id=queueSearchBar]';
21 
27  private $submitButton = '[type=submit]';
28 
34  private $selectCaseLink = 'ul[case-list=cases] li[case-list-case=case] a';
35 
41  private $appliedFilters = '.app-taglist > ul > li > a';
42 
48  private $spinner = '.cases-loading-spinner';
49 
56  public function searchCaseByCustomerName($customerName)
57  {
58  $this->resetFilters();
59  $this->_rootElement->find($this->searchBar)->setValue($customerName);
60  $this->_rootElement->find($this->submitButton)->click();
61  $this->waitLoadingSpinner();
62  }
63 
69  private function resetFilters(): void
70  {
71  $filters = $this->_rootElement->getElements($this->appliedFilters);
72  if (!empty($filters)) {
73  foreach ($filters as $filter) {
74  $filter->click();
75  $this->waitLoadingSpinner();
76  }
77  }
78  }
79 
85  private function waitLoadingSpinner(): void
86  {
87  $this->waitForElementNotVisible($this->spinner);
88  }
89 
95  public function isAnyCaseVisible(): bool
96  {
97  return $this->_rootElement->find($this->selectCaseLink)->isVisible();
98  }
99 
105  public function selectCase()
106  {
107  $this->_rootElement->find($this->selectCaseLink)->click();
108  }
109 
115  public function waitForLoading()
116  {
117  $this->waitForElementVisible($this->searchBar);
118  }
119 }
$filters
Definition: uploader.phtml:11