diff --git a/lib/tests/behat/behat_forms.php b/lib/tests/behat/behat_forms.php index f7a5a529e65..d9ce8ea9548 100644 --- a/lib/tests/behat/behat_forms.php +++ b/lib/tests/behat/behat_forms.php @@ -369,4 +369,21 @@ class behat_forms extends behat_base { $field->set_value($value); } + /** + * Select a value from single select and redirect. + * + * @Given /^I select "(?P(?:[^"]|\\")*)" from the "(?P(?:[^"]|\\")*)" 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; + } + }