API Allow "I select the * radio button"

This commit is contained in:
Damian Mooyman 2014-05-05 12:32:47 +12:00
parent 68524346c6
commit a7ae2497d4
2 changed files with 17 additions and 1 deletions

View File

@ -514,7 +514,10 @@ It's based on the `vendor/bin/behat -di @cms` output.
- Selects option in select field with specified id|name|label|value.
When /^(?:|I )additionally select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/
- Selects additional option in select field with specified id|name|label|value.
- Selects additional option in select field with specified id|name|label|value.
When /^I select the "([^"]*)" radio button$/
- Selects a radio button with the given id|name|label|value
When /^(?:|I )check "(?P<option>(?:[^"]|\\")*)"$/
- Checks checkbox with specified id|name|label|value.

View File

@ -629,4 +629,17 @@ JS;
}
/**
* Selects the specified radio button
*
* @Given /^I select the "([^"]*)" radio button$/
*/
public function iSelectTheRadioButton($radioLabel) {
$session = $this->getSession();
$radioButton = $session->getPage()->findField($radioLabel);
assertNotNull($radioButton);
assertEquals('radio', $radioButton->getAttribute('type'));
$session->getDriver()->click($radioButton->getXPath());
}
}