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

index a1a5239..b5b3e94 100644 (file)
@@ -77,7 +77,12 @@ class behat_qtype_ddimageortext extends behat_base {
      * @Given /^I type "(?P<keys>[^"]*)" on place "(?P<place_number>\d+)" in the drag and drop onto image question$/
      */
     public function i_type_on_place_in_the_drag_and_drop_onto_image_question($keys, $placenumber) {
-        $generalcontext = behat_context_helper::get('behat_general');
-        $generalcontext->i_type_into_the($keys, $this->drop_xpath($placenumber), 'xpath_element');
+        $node = $this->get_selected_node('xpath_element', $this->drop_xpath($placenumber));
+        $this->ensure_node_is_visible($node);
+        foreach (str_split($keys) as $key) {
+            $node->keyDown($key);
+            $node->keyPress($key);
+            $node->keyUp($key);
+        }
     }
 }