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

Behat: Add step to check attribute

XMLWordPrintable

    • MOODLE_27_STABLE
    • MOODLE_25_STABLE, MOODLE_26_STABLE
    • MDL-44891-master
    • Hide

      0. Place attached temporary file mdl44891.feature in the location course/tests/behat within your Moodle installation.
      1. Ensure Behat is working in general, including running the behat init script.
      2. Run Behat with --tags=mdl44891

      EXPECTED: You should see 2 scenarios both passed (usually takes a minute or two).

      3. Edit the .feature file to change both instances of 'has-region-side-pre' by inserting an x in the name (so that the attribute does not in fact contain that value).
      4. Rerun the same test

      EXPECTED:
      This time there should be 2 failures indicated and you should see a message like:
      01. The attribute "class" does not contain "haxs-region-side-pre" (actual value: "format-site course path-site [...and so on, it's kind of a long attribute....]")

      Show
      0. Place attached temporary file mdl44891.feature in the location course/tests/behat within your Moodle installation. 1. Ensure Behat is working in general, including running the behat init script. 2. Run Behat with --tags=mdl44891 EXPECTED: You should see 2 scenarios both passed (usually takes a minute or two). 3. Edit the .feature file to change both instances of 'has-region-side-pre' by inserting an x in the name (so that the attribute does not in fact contain that value). 4. Rerun the same test EXPECTED: This time there should be 2 failures indicated and you should see a message like: 01. The attribute "class" does not contain "haxs-region-side-pre" (actual value: "format-site course path-site [...and so on, it's kind of a long attribute....] ")

      Behat is intended to check user-visible effects in the resulting HTML. Sometimes these effects are implemented using attribute values (two common examples are the alt= attribute, which is visible to screenreader users, and the title= attribute, which is visible to all users; there's also the src attribute of images, and lots of other possibilities too).

      There is currently no step that checks an attribute value. This seems like a simple and generic step. I propose the following:

      Then the "title" attribute of "Amphibians" "select" should contain "Choose your amphibian"

      This step is necessary for MDL-44070 so that I can check that a toggle icon changes status when clicked (it changes its alt=, title=, and src= so I need to check one of them!).

            quen Sam Marshall
            quen Sam Marshall
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Marina Glancy Marina Glancy
            Rajesh Taneja Rajesh Taneja
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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