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

Behat: Add step to support multiple tabs

XMLWordPrintable

      There is a class of bugs that only apply if the user is seeing an old version of the page. The way to reproduce this as a user is to use multiple tabs, like the following:

      1 Open a tab with a particular page (e.g. a page listing frogs)
      2 Open a second tab on that same page
      3 On the first tab, carry out an action (e.g. delete Kermit)
      4 On the second tab, carry out an action (e.g. delete Kermit)

      In this case, step 4 is not a valid action, but the user interface lets the user do it (because the page was loaded back when Kermit still existed). So it might be necessary to test this sort of thing to verify what happens.

      This particular example is unlikely to cause any problems but we have a rare case in one of our custom plugins (and I'm vaguely aware of some in core Moodle) where you can leave it in a right mess.

      So anyway, it would be nice to have a Behat step. Tim and I discussed it and we think this step might be nice:

      When I open a tab named "X" on the current page

      This can then use the existing 'switch to window' and 'switch to the main window' step to switch between them, but perhaps we can also edit that step to allow people to call it 'switch tab' as well, no difference in behaviour (Selenium doesn't distinguish between tabs/windows).

      So the test above could be something like:

      When I am on the "Frog list" "Activity" page
      And I open a tab named "Destroyer of Frogs" on the current page
      And I click on "Delete" button in the "Kermit" "table_row"
      And I switch to the main tab
      And I click on "Delete" button in the "Kermit" "table_row"
      Then I should see "Ooops, Kermit was already deleted"
      

      Following requests I have also added steps so that you can open the new tab on a different page. These work the same as the existing 'I am on the "X" page' and 'I am on the "X" "Y" page' steps:

      When I open a tab named "X" on the "My courses" page
      When I open a tab named "X" on the "C1" "Course" page

            quen Sam Marshall
            quen Sam Marshall
            Tim Hunt Tim Hunt
            Simey Lameze Simey Lameze
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 48 minutes
                4h 48m

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