Merge branch 'MDL-43173_26' of git://github.com/dmonllao/moodle into MOODLE_26_STABLE
This commit is contained in:
@@ -104,6 +104,11 @@ class behat_form_select extends behat_form_field {
|
||||
// Wrapped in a try & catch as we can fall into race conditions
|
||||
// and the element may not be there.
|
||||
try {
|
||||
|
||||
// Wait for all the possible AJAX requests that have been
|
||||
// already triggered by selectOption() to be finished.
|
||||
$this->session->wait(behat_base::TIMEOUT * 1000, behat_base::PAGE_READY_JS);
|
||||
|
||||
current($optionnodes)->click();
|
||||
} catch (Exception $e) {
|
||||
// We continue and return as this means that the element is not there or it is not the same.
|
||||
@@ -112,6 +117,11 @@ class behat_form_select extends behat_form_field {
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// Wait for all the possible AJAX requests that have been
|
||||
// already triggered by selectOption() to be finished.
|
||||
$this->session->wait(behat_base::TIMEOUT * 1000, behat_base::PAGE_READY_JS);
|
||||
|
||||
// Wrapped in a try & catch as we can fall into race conditions
|
||||
// and the element may not be there.
|
||||
try {
|
||||
@@ -127,6 +137,10 @@ class behat_form_select extends behat_form_field {
|
||||
return;
|
||||
}
|
||||
|
||||
// Wait for all the possible AJAX requests that have been
|
||||
// already triggered by selectOption() to be finished.
|
||||
$this->session->wait(behat_base::TIMEOUT * 1000, behat_base::PAGE_READY_JS);
|
||||
|
||||
// Wrapped in a try & catch as we can fall into race conditions
|
||||
// and the element may not be there.
|
||||
try {
|
||||
|
||||
@@ -281,6 +281,7 @@ class behat_hooks extends behat_base {
|
||||
/**
|
||||
* Waits for all the JS to be loaded.
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws NoSuchWindow
|
||||
* @throws UnknownError
|
||||
* @return bool True or false depending whether all the JS is loaded or not.
|
||||
@@ -314,9 +315,12 @@ class behat_hooks extends behat_base {
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
// Timeout waiting for JS to complete.
|
||||
// TODO MDL-43173 We should fail the scenarios if JS loading times out.
|
||||
return false;
|
||||
// Timeout waiting for JS to complete. It will be catched and forwarded to behat_hooks::i_look_for_exceptions().
|
||||
// It is unlikely that Javascript code of a page or an AJAX request needs more than self::EXTENDED_TIMEOUT seconds
|
||||
// to be loaded, although when pages contains Javascript errors M.util.js_complete() can not be executed, so the
|
||||
// number of JS pending code and JS completed code will not match and we will reach this point.
|
||||
throw new \Exception('Javascript code and/or AJAX requests are not ready after ' . self::EXTENDED_TIMEOUT .
|
||||
' seconds. There is a Javascript error or the code is extremely slow.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user