Skip to content

Commit 59b8b50

Browse files
[auto-generated] Update plugin files
Check out the commits that caused these changes: moodlehq/moodleapp@5479ae7...3a06ceb
1 parent 6c3e260 commit 59b8b50

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

tests/behat/behat_app.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public function i_swipe_in_the_app(string $direction, bool $hasLocator = false,
283283
* @When I wait for the BigBlueButton room to start
284284
*/
285285
public function i_wait_bbb_room_to_start() {
286-
$windowNames = $this->getSession()->getWindowNames();
286+
$windowNames = $this->get_window_names();
287287

288288
$this->getSession()->switchToWindow(array_pop($windowNames));
289289
$this->spin(function($context) {
@@ -989,7 +989,7 @@ public function the_header_should_be_in_the_app(string $text) {
989989
*/
990990
public function the_app_should_have_opened_a_browser_tab(bool $not = false, ?string $urlpattern = null) {
991991
$this->spin(function() use ($not, $urlpattern) {
992-
$windowNames = $this->getSession()->getWindowNames();
992+
$windowNames = $this->get_window_names();
993993
$openedbrowsertab = count($windowNames) === 2;
994994

995995
if ((!$not && !$openedbrowsertab) || ($not && $openedbrowsertab && is_null($urlpattern))) {
@@ -1096,7 +1096,7 @@ public function the_event_should_have_been_logged(bool $not, string $username, T
10961096
* @throws DriverException If there aren't exactly 2 tabs open
10971097
*/
10981098
public function i_switch_to_the_browser_tab_opened_by_the_app() {
1099-
$windowNames = $this->getSession()->getWindowNames();
1099+
$windowNames = $this->get_window_names();
11001100
if (count($windowNames) !== 2) {
11011101
throw new DriverException('Expected to see 2 tabs open, not ' . count($windowNames));
11021102
}
@@ -1144,7 +1144,7 @@ public function i_wait_loading_to_finish_in_the_app() {
11441144
* @throws DriverException If there aren't exactly 2 tabs open
11451145
*/
11461146
public function i_close_the_browser_tab_opened_by_the_app() {
1147-
$names = $this->getSession()->getWindowNames();
1147+
$names = $this->get_window_names();
11481148
if (count($names) !== 2) {
11491149
throw new DriverException('Expected to see 2 tabs open, not ' . count($names));
11501150
}
@@ -1201,7 +1201,7 @@ public function i_switch_network_connection(string $mode) {
12011201
public function i_open_a_browser_tab_with_url(string $url) {
12021202
$this->execute_script("window.open('$url', '_system');");
12031203

1204-
$windowNames = $this->getSession()->getWindowNames();
1204+
$windowNames = $this->get_window_names();
12051205
$this->getSession()->switchToWindow($windowNames[1]);
12061206
}
12071207

tests/behat/behat_app_helper.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,4 +829,27 @@ protected function wait_animations_done() {
829829
// to finish, so for now we'll just wait 300ms.
830830
usleep(300000);
831831
}
832+
833+
/**
834+
* Get window names, excluding Chrome extensions.
835+
* Workaround for bug: https://github.com/SeleniumHQ/selenium/issues/15330
836+
*
837+
* @return array
838+
*/
839+
protected function get_window_names(): array {
840+
$activeWindowName = $this->getSession()->getWindowName();
841+
842+
$windowNames = [];
843+
foreach ($this->getSession()->getWindowNames() as $windowName) {
844+
$this->getSession()->switchToWindow($windowName);
845+
$windowUrl = $this->getSession()->getCurrentUrl();
846+
if (strpos($windowUrl, 'chrome-extension://') !== 0) {
847+
$windowNames[] = $windowName;
848+
}
849+
}
850+
851+
$this->getSession()->switchToWindow($activeWindowName);
852+
853+
return $windowNames;
854+
}
832855
}

version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
defined('MOODLE_INTERNAL') || die;
88

9-
$plugin->version = 2025022400;
9+
$plugin->version = 2025022600;
1010
$plugin->requires = 2018051700;
1111
$plugin->maturity = MATURITY_STABLE;
1212
$plugin->release = '5.0.0';

0 commit comments

Comments
 (0)