Skip to content

Commit

Permalink
MDL-76207 contentbank: Switch to opened window
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Nov 6, 2022
1 parent 97f67db commit 016d123
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/tests/behat/behat_general.php
Expand Up @@ -187,6 +187,22 @@ function($context) use ($name){
);
}

/**
* Switches to a second window.
*
* @Given /^I switch to a second window$/
* @throws DriverException If there aren't exactly 2 windows open.
*/
public function switch_to_second_window() {
$names = $this->getSession()->getWindowNames();

if (count($names) !== 2) {
throw new DriverException('Expected to see 2 windows open, found ' . count($names));
}

$this->getSession()->switchToWindow($names[1]);
}

/**
* Switches to the main Moodle frame.
*
Expand Down
1 change: 1 addition & 0 deletions mod/h5pactivity/tests/behat/contentbank_link.feature
Expand Up @@ -25,6 +25,7 @@ Feature: Content bank link in the activity settings form
And I add a "H5P" to section "1"
Then I should see "Use the content bank (opens in new window) to manage your H5P files"
And I click on "content bank (opens in new window)" "link" in the "General" "fieldset"
And I switch to a second window
And I should see "C1" in the "page-navbar" "region"
And I close all opened windows

Expand Down

0 comments on commit 016d123

Please sign in to comment.