mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
Merge branch 'MDL-67656-master' of git://github.com/andrewnicols/moodle
This commit is contained in:
commit
883687a9fd
@ -338,20 +338,11 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext {
|
||||
if (!$timeout) {
|
||||
$timeout = self::get_timeout();
|
||||
}
|
||||
if ($microsleep) {
|
||||
// Will sleep 1/10th of a second by default for self::get_timeout() seconds.
|
||||
$loops = $timeout * 10;
|
||||
} else {
|
||||
// Will sleep for self::get_timeout() seconds.
|
||||
$loops = $timeout;
|
||||
}
|
||||
|
||||
// DOM will never change on non-javascript case; do not wait or try again.
|
||||
if (!$this->running_javascript()) {
|
||||
$loops = 1;
|
||||
}
|
||||
$start = microtime(true);
|
||||
$end = $start + $timeout;
|
||||
|
||||
for ($i = 0; $i < $loops; $i++) {
|
||||
do {
|
||||
// We catch the exception thrown by the step definition to execute it again.
|
||||
try {
|
||||
// We don't check with !== because most of the time closures will return
|
||||
@ -367,14 +358,13 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext {
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->running_javascript()) {
|
||||
if ($microsleep) {
|
||||
usleep(100000);
|
||||
} else {
|
||||
sleep(1);
|
||||
}
|
||||
if (!$this->running_javascript()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
usleep(100000);
|
||||
|
||||
} while (microtime(true) < $end);
|
||||
|
||||
// Using coding_exception as is a development issue if no exception has been provided.
|
||||
if (!$exception) {
|
||||
|
@ -1018,11 +1018,7 @@ EOF;
|
||||
// Using the spin method as we want a reduced timeout but there is no need for a 0.1 seconds interval
|
||||
// because in the optimistic case we will timeout.
|
||||
// If all goes good it will throw an ElementNotFoundExceptionn that we will catch.
|
||||
$this->spin(
|
||||
function($context, $args) use ($selectortype, $element) {
|
||||
return $this->find($selectortype, $element);
|
||||
}, [], behat_base::get_reduced_timeout(), $exception, false
|
||||
);
|
||||
return $this->find($selectortype, $element, $exception, false, behat_base::get_reduced_timeout());
|
||||
} catch (ElementNotFoundException $e) {
|
||||
// We expect the element to not be found.
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user