mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-56994 behat: Fixed activity selector to find proper li
Previous to this patch, only 1 activity was expected and if there are more than 1 activities then it will fail. Improved step to find the correct activity node by name
This commit is contained in:
parent
727145bf1c
commit
f4565e7147
@ -124,11 +124,12 @@ class behat_completion extends behat_base {
|
||||
} else {
|
||||
$imgalttext = get_string("completion-alt-auto-y", 'core_completion', $activityname);
|
||||
}
|
||||
$csselementforactivitytype = "li.modtype_".strtolower($activitytype);
|
||||
$activityxpath = "//li[contains(concat(' ', @class, ' '), ' modtype_" . strtolower($activitytype) . " ')]";
|
||||
$activityxpath .= "[descendant::*[contains(text(), '" . $activityname . "')]]";
|
||||
|
||||
$xpathtocheck = "//img[contains(@alt, '$imgalttext')]";
|
||||
$this->execute("behat_general::should_exist_in_the",
|
||||
array($xpathtocheck, "xpath_element", $csselementforactivitytype, "css_element")
|
||||
array($xpathtocheck, "xpath_element", $activityxpath, "xpath_element")
|
||||
);
|
||||
|
||||
}
|
||||
@ -144,12 +145,12 @@ class behat_completion extends behat_base {
|
||||
} else {
|
||||
$imgalttext = get_string("completion-alt-auto-n", 'core_completion', $activityname);
|
||||
}
|
||||
$csselementforactivitytype = "li.modtype_".strtolower($activitytype);
|
||||
$activityxpath = "//li[contains(concat(' ', @class, ' '), ' modtype_" . strtolower($activitytype) . " ')]";
|
||||
$activityxpath .= "[descendant::*[contains(text(), '" . $activityname . "')]]";
|
||||
|
||||
$xpathtocheck = "//img[contains(@alt, '$imgalttext')]";
|
||||
$this->execute("behat_general::should_exist_in_the",
|
||||
array($xpathtocheck, "xpath_element", $csselementforactivitytype, "css_element")
|
||||
array($xpathtocheck, "xpath_element", $activityxpath, "xpath_element")
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user