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

This commit is contained in:
Damyon Wiese 2015-09-11 14:04:58 +08:00 committed by Tim Hunt
parent 96a744babd
commit 031152cc83
3 changed files with 11 additions and 4 deletions

View File

@ -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);
}

View File

@ -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');

View File

@ -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');