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

Make custom Behat step that supports testing of content in tabs



      As discovered in MDL-58704 and explained by stronk7:

      I think these failures are happening because, when searching for the "Choice Test choice 1 closes" text within the block... the first occurrence is within the "myoverview_timeline_dates" div (aka, the "Sort by dates" tab) and it's hidden using the "fade active..." classes).. So, really, it's not finding the visible text within the "myoverview_timeline_courses" div (aka, the "Sort by courses" tab), but another, hidden, occurrence.

      I think that in these cases, different drivers behave differently. Some are able to skip hidden regions, others aren't. Some perform the search top-botton, other bottom-up... and that makes the test unestable (apart from any other consideration).
      So, the only way to get constant results is to perform the searches more accurately and, instead of looking for the text within the whole block (that has like N occurrences of the text, N-1 of them hidden), look exactly within the "tab" that we want (the one that is really active).

      Surely the best way to achieve this would be supporting "tabs" in the step, to make it natural and so on, but I'm afraid, that's too complex to do right now (feel free to create an issue about that for being able to investigate it).

      So, simply, I'd suggest to use some restricter search like:
      And I should see "text_to_find" in the "#div_id_of_the_tab" "css_element"

      A custom Behat step that properly evaluates the current active tab/view might be helpful for cases like this. Or alternatively, we can try to improve the

      I should see "Expected text" in the "element" "selector"

      step so that it can also support tabs.

            Unassigned Unassigned
            jpataleta Jun Pataleta
            0 Vote for this issue
            4 Start watching this issue


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