MDL-51014 behat: Wait for filepicker to load repository

This commit is contained in:
Mark Johnson 2015-08-10 13:27:45 +01:00 committed by sam marshall
parent 57739a72cb
commit c5639c9118

View File

@ -193,6 +193,14 @@ class behat_files extends behat_base {
$this->ensure_node_is_visible($add);
$add->click();
// Wait for the default repository (if any) to load. This checks that
// the relevant div exists and that it does not include the loading image.
$this->ensure_element_exists(
"//div[contains(concat(' ', normalize-space(@class), ' '), ' file-picker ')]" .
"//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-content ')]" .
"[not(descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' fp-content-loading ')])]",
'xpath_element');
// Getting the repository link and opening it.
$repoexception = new ExpectationException('The "' . $repositoryname . '" repository has not been found', $this->getSession());
@ -210,7 +218,11 @@ class behat_files extends behat_base {
// Selecting the repo.
$this->ensure_node_is_visible($repositorylink);
$repositorylink->click();
if (!$repositorylink->getParent()->getParent()->hasClass('active')) {
// If the repository link is active, then the repository is already loaded.
// Clicking it while it's active causes issues, so only click it when it isn't (see MDL-51014).
$repositorylink->click();
}
}
/**