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();
|
||||
$session = $this->getSession();
|
||||
$this->spin(function () use ($page, $session, $text) {
|
||||
$element = $page->find(
|
||||
$elements = $page->findAll(
|
||||
'xpath',
|
||||
$session->getSelectorsHandler()->selectorToXpath("xpath", ".//*[contains(text(), '$text')]")
|
||||
);
|
||||
|
||||
if (empty($element)) {
|
||||
return false;
|
||||
} else {
|
||||
return ($element->isVisible());
|
||||
foreach ($elements as $element) {
|
||||
if (empty($element)) {
|
||||
continue;
|
||||
}
|
||||
if (!$element->isVisible()) {
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user