Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-84679

Behat no longer switches to the main window in selenium/standalone-chrome:4

XMLWordPrintable

    • MOODLE_405_STABLE

      Only in selenium/standalone-chrome:4

      When you have two windows opened and you do something like this:

          And I switch to a second window
          And I switch to the main window
      

      it does not actually switch back to the main window, it stays in the second window.

      My solution for this:

      diff --git a/lib/tests/behat/behat_general.php b/lib/tests/behat/behat_general.php
      index f7e5e929d3d..a98416dfec4 100644
      --- a/lib/tests/behat/behat_general.php
      +++ b/lib/tests/behat/behat_general.php
      @@ -258,7 +258,8 @@ class behat_general extends behat_base {
            * @Given /^I switch to the main (window|tab)$/
            */
           public function switch_to_the_main_window() {
      -        $this->switch_to_window(self::MAIN_WINDOW_NAME);
      +        $names = $this->getSession()->getWindowNames();
      +        $this->switch_to_window($names[0]);
           }
       
           /**
      

      But I do not have capacity now to properly test it and submit it, and also it does not affect anything in core at the moment. We found an alternative solution in Workplace.

      Second problem is that $this->getSession()->getWindowNames() returns an extra window when a PDF is opened.

      Apps team had a similar problem, this is their solution
      https://github.com/moodlehq/moodleapp/commit/02c29ed69e97fb261a31224cb48b017e7b4b215b

            Unassigned Unassigned
            marina Marina Glancy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 minutes
                3m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.