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

Behat - course completion test for activity marked as complete broken with manual completion.

    XMLWordPrintable

    Details

      Description

      Items that are toggled for completion manually use a form with <input type="img" to handle the tick icon - for example:

      <input type="image" src="http://mymoodle.local/theme/image.php/clean/core/1482148425/i/completion-manual-y" alt="Completed: Test Code review. Select to mark as not complete." title="Mark as not complete: Test Code review" aria-live="polite">
      

      However, the behat step to test for manual completion looks only for an image:

      completion/tests/behat/behat_completion.php

          /**
           * Checks if the activity with specified name is maked as complete.
           *
           * @Given /^the "(?P<activityname_string>(?:[^"]|\\")*)" "(?P<activitytype_string>(?:[^"]|\\")*)" activity with "(manual|auto)" completion should be marked as complete$/
           */
          public function activity_marked_as_complete($activityname, $activitytype, $completiontype) {
              if ($completiontype == "manual") {
                  $imgalttext = get_string("completion-alt-manual-y", 'core_completion', $activityname);
              } else {
                  $imgalttext = get_string("completion-alt-auto-y", 'core_completion', $activityname);
              }
              $csselementforactivitytype = "li.modtype_".strtolower($activitytype);
       
              $xpathtocheck = "//img[contains(@alt, '$imgalttext')]";
              $this->execute("behat_general::should_exist_in_the",
                  array($xpathtocheck, "xpath_element", $csselementforactivitytype, "css_element")
              );
       
          }
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Mar/17