mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
FIX When waiting for text to show on page, look for elements until we find one that is visible instead (#211)
of failing if the first element is invisible.
This commit is contained in:
parent
8ff1ef7a59
commit
261f88dd19
@ -1151,16 +1151,20 @@ JS;
|
|||||||
$page = $this->getSession()->getPage();
|
$page = $this->getSession()->getPage();
|
||||||
$session = $this->getSession();
|
$session = $this->getSession();
|
||||||
$this->spin(function () use ($page, $session, $text) {
|
$this->spin(function () use ($page, $session, $text) {
|
||||||
$element = $page->find(
|
$elements = $page->findAll(
|
||||||
'xpath',
|
'xpath',
|
||||||
$session->getSelectorsHandler()->selectorToXpath("xpath", ".//*[contains(text(), '$text')]")
|
$session->getSelectorsHandler()->selectorToXpath("xpath", ".//*[contains(text(), '$text')]")
|
||||||
);
|
);
|
||||||
|
foreach ($elements as $element) {
|
||||||
if (empty($element)) {
|
if (empty($element)) {
|
||||||
return false;
|
continue;
|
||||||
} else {
|
}
|
||||||
return ($element->isVisible());
|
if (!$element->isVisible()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user