Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GridPageAction.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Backend\Test\Block\GridPageActions as ParentGridPageActions;
10 use Magento\Mtf\Client\Locator;
11 
15 class GridPageAction extends ParentGridPageActions
16 {
22  protected $toggleButton = '[data-ui-id=products-list-add-new-product-button-dropdown]';
23 
29  protected $productItem = '[data-ui-id=products-list-add-new-product-button-item-%productType%]';
30 
36  protected $typeList = '[data-ui-id=products-list-add-new-product-button-dropdown-menu]';
37 
43  protected $spinner = '[data-role="spinner"]';
44 
51  public function addProduct($productType = 'simple')
52  {
53  $this->waitForElementNotVisible($this->spinner);
54  $this->_rootElement->find($this->toggleButton, Locator::SELECTOR_CSS)->click();
55  $this->_rootElement->find(
56  str_replace('%productType%', $productType, $this->productItem),
57  Locator::SELECTOR_CSS
58  )->click();
59  }
60 
66  public function getTypeList()
67  {
68  $this->_rootElement->find($this->toggleButton, Locator::SELECTOR_CSS)->click();
69  return $this->_rootElement->find(
70  $this->typeList,
71  Locator::SELECTOR_CSS
72  )->getText();
73  }
74 }