Merge pull request #38 from tractorcow/pulls/radio-select

API Allow "I select the * radio button"
This commit is contained in:
Ingo Schommer 2014-05-05 13:05:38 +12:00
commit 51f7fc9e20
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. - Selects option in select field with specified id|name|label|value.
When /^(?:|I )additionally select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/ 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>(?:[^"]|\\")*)"$/ When /^(?:|I )check "(?P<option>(?:[^"]|\\")*)"$/
- Checks checkbox with specified id|name|label|value. - 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());
}
} }