mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-09-30 05:09:27 +02:00
When waiting for text to show on page, look for elements until we find one that is visible instead
of failing if the first element is invisible.
This commit is contained in:
parent
e2deed514e
commit
8c07593588
@ -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