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

Behat: Support setting multiple fields which have same labels

    • MOODLE_35_STABLE, MOODLE_36_STABLE
    • MDL-63384_master
    • Hide

      Maybe this can be done with some other Behat function. But in my opinion you shouldn't need extra function calls (in a .feature file) just because you want to address a field that has the same label as another field.

      Show
      Maybe this can be done with some other Behat function. But in my opinion you shouldn't need extra function calls (in a .feature file) just because you want to address a field that has the same label as another field.
    • Hide

      Edit calendar/tests/behat/calendar.feature and try to make the "I set the following fields to these values" function set the duration for a calendar event to 30 minutes.
      => It doesn't work. All you can achieve is for Behat to select the appropriate radio button.

      Show
      Edit calendar/tests/behat/calendar.feature and try to make the "I set the following fields to these values" function set the duration for a calendar event to 30 minutes. => It doesn't work. All you can achieve is for Behat to select the appropriate radio button.

      While adding a Behat test for MDL-63119 I noticed that with the function "I set the following fields to these values" I couldn't set certain fields in a form, e.g. the "Duration in minutes" field when creating a new calendar event. I found the problem: That function only ever sets the first field with a given label to the given value. And in the test I was writing you had two fields with the label "Duration in minutes", one of them was just hidden: the first field was the radio button that enabled the actual text input field for the duration. So I needed to both click a radio button and enter text into a text field which is not possible with the function mentioned above.

      As there are cases in the Moodle core where you have multiple fields with labels containing the same text it should be possible to set all these fields in Behat tests. My suggestion is this:

          And I set the following fields to these values:
            | Event title | Mediocre event :( |
            | Description | Wait, this event isn't that great. |
            | Location | |
            | Duration in minutes | |
            | Duration in minutes | 30 |
      

      The first occurrence of a label in the parameter list refers to the first field with such a label (same behavior as before, so backwards compatible), the second to the second and the nth to the nth.

            tschroeder Tim Schroeder
            tschroeder Tim Schroeder
            Peter Dias Peter Dias
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

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