Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AccountsGrid.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Client\Locator;
10 use Magento\Mtf\ObjectManager;
11 
17 {
23  protected $dataMapping = [
24  'report_from' => 'datepicker',
25  'report_to' => 'datepicker',
26  'report_period' => 'select',
27  ];
28 
34  protected $totalResults = 'tfoot .col-qty';
35 
41  protected $filter = '[name=%s]';
42 
48  protected $refreshButton = '[data-ui-id="adminhtml-report-grid-refresh-button"]';
49 
56  public function searchAccounts(array $customersReport)
57  {
58  $customersReport = $this->prepareData($customersReport);
59  foreach ($customersReport as $name => $value) {
60  $this->_rootElement
61  ->find(sprintf($this->filter, $name), Locator::SELECTOR_CSS, $this->dataMapping[$name])
62  ->setValue($value);
63  }
64  $this->_rootElement->find($this->refreshButton)->click();
65  }
66 
72  public function getTotalResults()
73  {
74  return $this->_rootElement->find($this->totalResults)->getText();
75  }
76 
83  protected function prepareData(array $customersReport)
84  {
85  foreach ($customersReport as $name => $reportFilter) {
86  if ($name === 'report_period') {
87  continue;
88  }
89  $date = ObjectManager::getInstance()->create(
90  \Magento\Backend\Test\Fixture\Source\Date::class,
91  ['params' => [], 'data' => ['pattern' => $reportFilter]]
92  );
93  $customersReport[$name] = $date->getData();
94  }
95  return $customersReport;
96  }
97 }
$value
Definition: gender.phtml:16
if(!isset($_GET['name'])) $name
Definition: log.php:14