Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
IntegrationGrid.php
Go to the documentation of this file.
1 <?php
8 
12 use Magento\Mtf\Client\Locator;
13 
18 class IntegrationGrid extends Grid
19 {
25  protected $filters = [
26  'name' => [
27  'selector' => 'input[name="name"]',
28  ],
29  'status' => [
30  'selector' => 'input[name="status"]',
31  'input' => 'select',
32  ],
33  ];
34 
40  protected $editLink = '[data-column="edit"] button';
41 
47  protected $deleteLink = '[data-column="delete"] button';
48 
54  protected $activateLink = '[data-column="activate"] a';
55 
61  protected $deleteBlockSelector = './/ancestor::body/div[div[@id="integration-delete-container"]]';
62 
68  protected $resourcesPopupSelector = './/ancestor::body/div[descendant::div[@id="integration-popup-container"]]';
69 
75  protected $tokensPopupSelector = './/ancestor::body/div[descendant::fieldset[contains(@id,"integration_token")]]';
76 
82  protected $confirmModal = '.confirm._show[data-role=modal]';
83 
90  public function searchAndDelete(array $item)
91  {
92  $this->search($item);
93  $this->_rootElement->find($this->deleteLink)->click();
94  $element = $this->browser->find($this->confirmModal);
96  $modal = $this->blockFactory->create(\Magento\Ui\Test\Block\Adminhtml\Modal::class, ['element' => $element]);
97  $modal->acceptAlert();
98  }
99 
106  public function searchAndActivate(array $filter)
107  {
108  $this->search($filter);
109  $this->_rootElement->find($this->activateLink)->click();
110  }
111 
118  public function searchAndReauthorize(array $filter)
119  {
120  $this->search($filter);
121  $this->_rootElement->find($this->activateLink)->click();
122  }
123 
129  public function getResourcesPopup()
130  {
132  $resourcesPopup = $this->blockFactory->create(
133  \Magento\Integration\Test\Block\Adminhtml\Integration\IntegrationGrid\ResourcesPopup::class,
134  ['element' => $this->_rootElement->find($this->resourcesPopupSelector, Locator::SELECTOR_XPATH)]
135  );
136 
137  return $resourcesPopup;
138  }
139 
145  public function getTokensPopup()
146  {
147  $tokensPopup = $this->blockFactory->create(
148  \Magento\Integration\Test\Block\Adminhtml\Integration\IntegrationGrid\TokensPopup::class,
149  ['element' => $this->_rootElement->find($this->tokensPopupSelector, Locator::SELECTOR_XPATH)]
150  );
151  $this->waitForElementVisible($this->tokensPopupSelector, Locator::SELECTOR_XPATH);
152 
153  return $tokensPopup;
154  }
155 }
$element
Definition: element.phtml:12