MDL-50055 tests: Add new step to deal with Single Selects

This commit is contained in:
Andrew Nicols 2015-05-01 09:18:37 +08:00
parent 24a2babdd3
commit 2b964e1d24

View File

@ -383,4 +383,21 @@ class behat_forms extends behat_base {
$field->set_value($value);
}
/**
* Select a value from single select and redirect.
*
* @Given /^I select "(?P<singleselect_option_string>(?:[^"]|\\")*)" from the "(?P<singleselect_name_string>(?:[^"]|\\")*)" singleselect$/
*/
public function i_select_from_the_singleselect($option, $singleselect) {
$actions = array(
new Given('I set the field "' . $this->escape($singleselect) . '" to "' . $this->escape($option) . '"'),
);
if (!$this->running_javascript()) {
$actions[] = new Given('I press "' . get_string('go') . '"');
}
return $actions;
}
}