Merge branch 'MDL-67728-master' of git://github.com/crazyserver/moodle

main
Eloy Lafuente (stronk7) 2020-03-03 19:50:08 +01:00
commit 57eed3003f
2 changed files with 17 additions and 15 deletions

View File

@ -72,7 +72,7 @@
if (window.M.util.pending_js.length === 1) {
runAfterEverything(function() {
// Check there isn't a spinner...
updateSpinner();
checkUIBlocked();
// Only remove it if the pending array is STILL empty after all that.
if (window.M.util.pending_js.length === 1) {
@ -109,23 +109,23 @@
return realOpen.apply(this, arguments);
};
var waitingSpinner = false;
var waitingBlocked = false;
/**
* Checks if a loading spinner is present and visible; if so, adds it to the pending array
* (and if not, removes it).
*/
var updateSpinner = function() {
var spinner = document.querySelector('span.core-loading-spinner');
if (spinner && spinner.offsetParent) {
if (!waitingSpinner) {
addPending('spinner');
waitingSpinner = true;
var checkUIBlocked = function() {
var blocked = document.querySelector('span.core-loading-spinner, ion-loading, .click-block-active');
if (blocked && blocked.offsetParent) {
if (!waitingBlocked) {
addPending('blocked');
waitingBlocked = true;
}
} else {
if (waitingSpinner) {
removePending('spinner');
waitingSpinner = false;
if (waitingBlocked) {
removePending('blocked');
waitingBlocked = false;
}
}
};
@ -167,7 +167,7 @@
setTimeout(pollRecentMutation, 500);
}
// Also update the spinner presence if needed.
updateSpinner();
checkUIBlocked();
};
// Set listener using the mutation callback.
@ -182,7 +182,9 @@
* @param {function} process Callback function that handles each matched node
*/
var findPossibleMatches = function(xpath, process) {
var matches = document.evaluate(xpath, document);
var select = 'ion-alert, ion-popover, ion-action-sheet, core-ion-tab.show-tab ion-page.show-page, ion-page.show-page, html';
var parent = document.querySelector(select);
var matches = document.evaluate(xpath, parent || document);
while (true) {
var match = matches.iterateNext();
if (!match) {

View File

@ -294,7 +294,7 @@ class behat_app extends behat_base {
}
}
throw new DriverException('Moodle app not found in browser');
}, false, 30);
}, false, 60);
// Run the scripts to install Moodle 'pending' checks.
$this->getSession()->executeScript(
@ -312,7 +312,7 @@ class behat_app extends behat_base {
return 'mainpage';
}
throw new DriverException('Moodle app login URL prompt not found');
}, behat_base::get_extended_timeout(), 30);
}, behat_base::get_extended_timeout(), 60);
// If it's the login page, we automatically fill in the URL and leave it on the user/pass
// page. If it's the main page, we just leave it there.