Commit 031152cc authored by Damyon Wiese's avatar Damyon Wiese Committed by Tim Hunt
Browse files

MDL-47494 qtype: Fix the behat tests for OU dd question types

parent 96a744ba
......@@ -411,6 +411,15 @@ class behat_general extends behat_base {
list($containerselector, $containerlocator) = $this->transform_selector($containerselectortype, $containerelement);
$destinationxpath = $this->getSession()->getSelectorsHandler()->selectorToXpath($containerselector, $containerlocator);
$node = $this->get_selected_node("xpath_element", $sourcexpath);
if (!$node->isVisible()) {
throw new ExpectationException('"' . $sourcexpath . '" "xpath_element" is not visible', $this->getSession());
}
$node = $this->get_selected_node("xpath_element", $destinationxpath);
if (!$node->isVisible()) {
throw new ExpectationException('"' . $destinationxpath . '" "xpath_element" is not visible', $this->getSession());
}
$this->getSession()->getDriver()->dragTo($sourcexpath, $destinationxpath);
}
......
......@@ -60,7 +60,6 @@ class behat_qtype_ddimageortext extends behat_base {
* @param int $placenumber the number of the place to drop into.
*
* @Given /^I drag "(?P<drag_item>[^"]*)" to place "(?P<place_number>\d+)" in the drag and drop onto image question$/
*
*/
public function i_drag_to_place_in_the_drag_and_drop_onto_image_question($dragitem, $placenumber) {
$generalcontext = behat_context_helper::get('behat_general');
......
......@@ -71,7 +71,6 @@ class behat_qtype_ddmarker extends behat_base {
// DOM node so that its centre is over the centre of anothe DOM node.
// Therefore to make it drag to the specified place, we have to add
// a target div.
$style =
$session = $this->getSession();
$session->evaluateScript("
(function() {
......@@ -88,8 +87,8 @@ class behat_qtype_ddmarker extends behat_base {
target.style.setProperty('position', 'absolute');
target.style.setProperty('left', xadjusted + 'px');
target.style.setProperty('top', '{$y}px');
target.style.setProperty('width', '0');
target.style.setProperty('height', '0');
target.style.setProperty('width', '1px');
target.style.setProperty('height', '1px');
}())");
$generalcontext = behat_context_helper::get('behat_general');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment