MDL-38952 behat: Adding no-JS compatibility

This step is widely used by JS scenarios,
with Javascript disabled this step fails tests
as tree nodes al already expanded; we can
reuse JS scenarios for no-JS tests skiping
this step in no-JS mode.
This commit is contained in:
David Monllao 2013-04-08 12:24:23 +08:00
parent 1091aca74f
commit e6d18d9d00

View file

@ -46,6 +46,13 @@ class behat_navigation extends behat_base {
*/ */
public function i_expand_node($nodetext) { public function i_expand_node($nodetext) {
// This step is useless with Javascript disabled as Moodle auto expands
// all of tree's nodes; adding this because of scenarios that shares the
// same steps with and without Javascript enabled.
if (!$this->running_javascript()) {
return false;
}
$xpath = "//ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')] $xpath = "//ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]
/child::li /child::li
/child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch')] /child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch')]