Eğer selectbox seçeneklerini behat ile kontrol etmek isterseniz, aşağıdaki örneği kullanabilirsiniz.


Selectbox


<select id="my-select-box">
<option value=""></option>
<option value="1">11</option>
<option value="2">22</option>
<option value="3">33</option>
</select>

Gherkin


Feature: Dummy feature

Scenario: Selectbox will contain specific set of data
Given I am "/home"
And the selectbox "my-select-box" should have a list containing:
"""
11
22
33
"""

FeatureContext


class FeatureContext extends MinkContext implements KernelAwareContext
{
...
...

/**
* @Then /^the selectbox "([^"]*)" should have a list containing:$/
*/
public function shouldHaveAListContaining($element, PyStringNode $list)
{
$session = $this->getSession();
$page = $session->getPage();
$element = $page->findById($element);
if (is_null($element)) {
throw new \InvalidArgumentException(sprintf('Could not evaluate CSS for "%s".', $element));
}

if ($element->getText() != implode('', $list->getStrings())) {
throw new \Exception(sprintf('Element "%s" content mismatch.', $element));
}
}

...
...
}