@@ -623,16 +623,27 @@ protected function open_add_file_window($filemanagernode, $repositoryname) {
623
623
$ repositoryname = behat_context_helper::escape ($ repositoryname );
624
624
625
625
// Here we don't need to look inside the selected element because there can only be one modal window.
626
- $ repositorylink = $ this ->find (
626
+ // Apparently there are some of these repo elements. So if the first one is not visible, check out
627
+ // the next one.
628
+ $ repositorylinks = $ this ->find_all (
627
629
'xpath ' ,
628
630
"//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-repo-area ')] " .
629
631
"//descendant::span[contains(concat(' ', normalize-space(@class), ' '), ' fp-repo-name ')] " .
630
632
"[normalize-space(.)= $ repositoryname] " ,
631
633
$ repoexception
632
634
);
633
635
636
+ foreach ($ repositorylinks as $ repositorylink ) {
637
+ try {
638
+ $ this ->ensure_node_is_visible ($ repositorylink );
639
+ } catch (Exception $ exception ) {
640
+ $ repositorylink = $ exception ;
641
+ }
642
+ }
643
+ if ($ repositorylink instanceof \Exception) {
644
+ throw new $ repositorylink ;
645
+ }
634
646
// Selecting the repo.
635
- $ this ->ensure_node_is_visible ($ repositorylink );
636
647
if (!$ repositorylink ->getParent ()->getParent ()->hasClass ('active ' )) {
637
648
// If the repository link is active, then the repository is already loaded.
638
649
// Clicking it while it's active causes issues, so only click it when it isn't (see MDL-51014).
0 commit comments