From e6d18d9d0044e2773ce8af3eccb90cea77401467 Mon Sep 17 00:00:00 2001 From: David Monllao Date: Mon, 8 Apr 2013 12:24:23 +0800 Subject: [PATCH] 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. --- lib/tests/behat/behat_navigation.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/tests/behat/behat_navigation.php b/lib/tests/behat/behat_navigation.php index fe1e47800e5..f3bad4610ba 100644 --- a/lib/tests/behat/behat_navigation.php +++ b/lib/tests/behat/behat_navigation.php @@ -46,6 +46,13 @@ class behat_navigation extends behat_base { */ 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 ')] /child::li /child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch')]