MDL-47494 ddmarker: Fix dd qtype Behat tests to not use the generic type step. #14895
authorTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 20 Feb 2015 13:46:34 +0000 (13:46 +0000)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 20 Feb 2015 13:46:34 +0000 (13:46 +0000)
question/type/ddmarker/tests/behat/behat_qtype_ddmarker.php

index 2c4ddc0..cb800cc 100644 (file)
@@ -113,9 +113,13 @@ class behat_qtype_ddmarker extends behat_base {
             'left'  => chr(37),
             'right' => chr(39),
         );
-        $keys = str_repeat($keycodes[$direction], $repeats);
         list($marker, $item) = $this->parse_marker_name($marker);
-        $generalcontext = behat_context_helper::get('behat_general');
-        $generalcontext->i_type_into_the($keys, $this->marker_xpath($marker, $item), 'xpath_element');
+        $node = $this->get_selected_node('xpath_element', $this->marker_xpath($marker, $item));
+        $this->ensure_node_is_visible($node);
+        for ($i = 0; $i < $repeats; $i++) {
+            $node->keyDown($keycodes[$direction]);
+            $node->keyPress($keycodes[$direction]);
+            $node->keyUp($keycodes[$direction]);
+        }
     }
 }