Merge branch 'MDL-38179_master' of git://github.com/dmonllao/moodle

This commit is contained in:
Dan Poltawski 2013-04-08 15:36:07 +08:00
commit 91a3c9ba9f

View file

@ -138,6 +138,28 @@ class behat_general extends behat_base {
$node->click(); $node->click();
} }
/**
* Click on the specified element inside a table row containing the specified text.
*
* @Given /^I click on "(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>(?:[^"]|\\")*)" in the "(?P<row_text_string>(?:[^"]|\\")*)" table row$/
* @throws ElementNotFoundException
* @param string $element Element we look for
* @param string $selectortype The type of what we look for
* @param string $tablerowtext The table row text
*/
public function i_click_on_in_the_table_row($element, $selectortype, $tablerowtext) {
// The table row container.
$nocontainerexception = new ElementNotFoundException($this->getSession(), '"' . $tablerowtext . '" row text ');
$tablerowtext = str_replace("'", "\'", $tablerowtext);
$rownode = $this->find('xpath', "//tr[contains(., '" . $tablerowtext . "')]", $nocontainerexception);
// Looking for the element DOM node inside the specified row.
list($selector, $locator) = $this->transform_selector($selectortype, $element);
$elementnode = $this->find($selector, $locator, false, $rownode);
$elementnode->click();
}
/** /**
* Checks, that page contains specified text. * Checks, that page contains specified text.
* *