/**
 * @Then the :selector numeric input should have the value :expected
 */
public function assertNumericInputHasValue($selector, $expected) {
  $page = $this->getSession()->getPage();
  $element = $page->find('css', $selector);
  if (!$element) {
    throw new ExpectationException(sprintf('The "%s" element wasn\'t found', $element), $this->getSession()
      ->getDriver());
  }
  $actual = $element->getAttribute('value');
  if ($actual != $expected) {
    throw new ExpectationException(sprintf('The "%s" element was set to %d instead of %d.', $element, $actual, $expected), $this->getSession()
      ->getDriver());
  }
}
Tags