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

Unable to uncheck a checkbox without @javascript in behat scenario

XMLWordPrintable

    • MOODLE_31_STABLE

      I ran into this while writing behat scenario file for a plugin. I did not need any JS so the test was without the @javascript tag.

      I have a form with advcheckbox field with the value set to 1 by default (block instance configuration form). In behat, I need to go to the form, uncheck it, save the form and test the effect.

      Given I add the "Muhehe" block
      And I configure the "Muhehe" block
      And I set the following fields to these values:
        | Checkbox field checked by default | 0 |
      When I press "Save changes"
      Then ...
      

      This does not work for me and the form is always saved with the checkbox field kept checked. I am quite sure I tried all variants like

      • using label, name ad id of the field as the selector
      • using I set the field "Checkbox field" to "0"
      • using empty string "", zero string "0" and zero 0

      nothing helped.

      Only way to make it behave as expected was to run the test via real browser, i.e. add the @javascript tag to the feature file.

      This was discussed with stronk7 at https://moodle.org/local/chatlogs/index.php?conversationid=19649 and was concluded to be a bug.

            rajeshtaneja Rajesh Taneja
            mudrd8mz David Mudrák (@mudrd8mz)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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