Skip to content

Commit 466e646

Browse files
author
Vitaliy Honcharenko
committed
MTA-2311: CMS module functional tests maintenance
1 parent 2015f5c commit 466e646

File tree

3 files changed

+21
-24
lines changed
  • dev/tests/functional/tests/app/Magento

3 files changed

+21
-24
lines changed

dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,6 @@ abstract class Grid extends Block
104104
*/
105105
protected $templateBlock = './ancestor::body';
106106

107-
/**
108-
* Selector of element to wait for. If set by child will wait for element after action
109-
*
110-
* @var string
111-
*/
112-
protected $waitForSelector;
113-
114107
/**
115108
* Locator type of waitForSelector
116109
*
@@ -249,7 +242,6 @@ public function searchAndOpen(array $filter)
249242
$rowItem = $this->_rootElement->find($this->rowItem, Locator::SELECTOR_CSS);
250243
if ($rowItem->isVisible()) {
251244
$rowItem->find($this->editLink, Locator::SELECTOR_CSS)->click();
252-
$this->waitForElement();
253245
} else {
254246
throw new \Exception('Searched item was not found.');
255247
}
@@ -273,20 +265,6 @@ function () use ($browser, $selector) {
273265
$this->getTemplateBlock()->waitLoader();
274266
}
275267

276-
/**
277-
* Method that waits for the configured selector using class attributes.
278-
*/
279-
protected function waitForElement()
280-
{
281-
if (!empty($this->waitForSelector)) {
282-
if ($this->waitForSelectorVisible) {
283-
$this->getTemplateBlock()->waitForElementVisible($this->waitForSelector, $this->waitForSelectorType);
284-
} else {
285-
$this->getTemplateBlock()->waitForElementNotVisible($this->waitForSelector, $this->waitForSelectorType);
286-
}
287-
}
288-
}
289-
290268
/**
291269
* Search for item and select it
292270
*

dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Grid.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,29 @@ public function searchAndPreview(array $filter)
8181
$rowItem = $this->_rootElement->find($this->rowItem);
8282
if ($rowItem->isVisible()) {
8383
$rowItem->find($this->previewCmsPage)->click();
84-
$this->waitForElement();
8584
} else {
8685
throw new \Exception('Searched item was not found.');
8786
}
8887
}
88+
89+
/**
90+
* Wait loader.
91+
*
92+
* @return void
93+
*/
94+
protected function waitLoader()
95+
{
96+
try {
97+
$browser = $this->browser;
98+
$selector = $this->loader;
99+
$browser->waitUntil(
100+
function () use ($browser, $selector) {
101+
return $browser->find($selector)->isVisible() == true ? true : null;
102+
}
103+
);
104+
} catch (\Exception $e) {
105+
}
106+
107+
parent::waitLoader();
108+
}
89109
}

dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ public function searchAndOpen(array $filter)
117117
$rowItem = $this->getRow($filter);
118118
if ($rowItem->isVisible()) {
119119
$rowItem->find($this->editLink)->click();
120-
$this->waitForElement();
121120
} else {
122121
throw new \Exception('Searched item was not found.');
123122
}

0 commit comments

Comments
 (0)