Merge branch 'MDL-53955-master' of git://github.com/junpataleta/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2016-04-30 09:39:16 +02:00
commit b22692d740

View file

@ -25,8 +25,6 @@
require_once(__DIR__ . '/../../../../../lib/behat/behat_base.php'); require_once(__DIR__ . '/../../../../../lib/behat/behat_base.php');
use Behat\Behat\Context\Step\Given as Given;
/** /**
* Step definition for learning plan system. * Step definition for learning plan system.
* *
@ -44,17 +42,12 @@ class behat_tool_lp extends behat_base {
* *
* @param string $nodetext * @param string $nodetext
* @param string $rowname * @param string $rowname
* @return Given[] array of steps
*/ */
public function click_on_edit_menu_of_the_row($nodetext, $rowname) { public function click_on_edit_menu_of_the_row($nodetext, $rowname) {
$steps = array(); $xpathtarget = "//ul//li//ul//li[@class='tool-lp-menu-item']//a[contains(.,'" . $nodetext . "')]";
$xpathtarget = "//ul//li//ul//li[@class='tool-lp-menu-item']//a[contains(.,'". $nodetext ."')]"; $this->execute('behat_general::i_click_on_in_the', [get_string('edit'), 'link', $this->escape($rowname), 'table_row']);
$this->execute('behat_general::i_click_on_in_the', [$xpathtarget, 'xpath_element', $this->escape($rowname), 'table_row']);
$steps[] = new Given('I click on "Edit" "link" in the "' . $this->escape($rowname) . '" "table_row"');
$steps[] = new Given('I click on "'.$xpathtarget.'" "xpath_element" in the "' . $this->escape($rowname) . '" "table_row"');
return $steps;
} }
/** /**
@ -63,16 +56,11 @@ class behat_tool_lp extends behat_base {
* @Given /^I select "([^"]*)" of the competency tree$/ * @Given /^I select "([^"]*)" of the competency tree$/
* *
* @param string $competencyname * @param string $competencyname
* @return Given[] array of steps
*/ */
public function select_of_the_competency_tree($competencyname) { public function select_of_the_competency_tree($competencyname) {
$steps = array(); $xpathtarget = "//li[@role='tree-item']//span[contains(.,'" . $competencyname . "')]";
$xpathtarget = "//li[@role='tree-item']//span[contains(.,'". $competencyname ."')]"; $this->execute('behat_general::i_click_on', [$xpathtarget, 'xpath_element']);
$steps[] = new Given('I click on "' . $xpathtarget . '" "xpath_element"');
return $steps;
} }
/** /**
@ -81,15 +69,10 @@ class behat_tool_lp extends behat_base {
* @Given /^I click on "([^"]*)" item in the autocomplete list$/ * @Given /^I click on "([^"]*)" item in the autocomplete list$/
* *
* @param string $item * @param string $item
* @return Given[] array of steps
*/ */
public function i_click_on_item_in_the_autocomplete_list($item) { public function i_click_on_item_in_the_autocomplete_list($item) {
$steps = array(); $xpathtarget = "//ul[@class='form-autocomplete-suggestions']//li//span//span[contains(.,'" . $item . "')]";
$xpathtarget = "//ul[@class='form-autocomplete-suggestions']//li//span//span[contains(.,'". $item ."')]"; $this->execute('behat_general::i_click_on', [$xpathtarget, 'xpath_element']);
$steps[] = new Given('I click on "' . $xpathtarget . '" "xpath_element"');
return $steps;
} }
} }