I've made a Context with this step definition:
/**
* Checks, that option from select with specified id|name|label|value is selected.
*
* @Then /^the "(?P<option>(?:[^"]|\\")*)" option from "(?P<select>(?:[^"]|\\")*)" (?:is|should be) selected/
* @Then /^the option "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)" (?:is|should be) selected$/
* @Then /^"(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)" (?:is|should be) selected$/
*/
public function theOptionFromShouldBeSelected($option, $select)
{
$selectField = $this->getSession()->getPage()->findField($select);
if (null === $selectField) {
throw new ElementNotFoundException($this->getSession(), 'select field', 'id|name|label|value', $select);
}
$optionField = $selectField->find('named', array(
'option',
$option,
));
if (null === $optionField) {
throw new ElementNotFoundException($this->getSession(), 'select option field', 'id|name|label|value', $option);
}
if (!$optionField->isSelected()) {
throw new ExpectationException('Select option field with value|text "'.$option.'" is not selected in the select "'.$select.'"', $this->getSession());
}
}
So you can add the following step in your Behat features:
Then the "Option 1" option from "Select options" should be selected
You can see the full Context code in here: https://github.com/Aplyca/BehatContexts/blob/master/src/Aplyca/BehatContext/FormContext.php#L64