-
Bug
-
Resolution: Not a bug
-
Minor
-
None
-
3.1.3, 3.2
-
MOODLE_31_STABLE, MOODLE_32_STABLE
Pre-requisites -
Behat test turns on auto completion.
Description of issue -
If you have multiple activities of the same type generated by a behat test and you want to find out the completion state of both it will fail by only looking at the first one.
This is because it is using the "behat_general::should_exist_in_the" function to check in one single element. It hit's the first element of a specific type and then ignores subsequent elements of the same type.
The code is in 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")
|
);
|
|
}
|