Skip to content

Commit

Permalink
MDL-50055 tests: Add new step to deal with Single Selects
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed May 5, 2015
1 parent 0706e7a commit 5e3fca4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/tests/behat/behat_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,4 +369,21 @@ protected function set_field_value($fieldlocator, $value) {
$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;
}

}

0 comments on commit 5e3fca4

Please sign in to comment.