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:
Rajesh Taneja 2016-11-22 11:02:52 +08:00
parent 727145bf1c
commit f4565e7147
No known key found for this signature in database
GPG Key ID: B363F7FB787F80E4

View File

@ -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")
);
}
}