Use more solid getValue() in Behat assertions

getAttribute('value') behaves inconsistently with Selenium drivers
(fails on Travis and TeamCity, but works locally). Selenium2Driver
in Mink provides a JS wrapper for getting the value, which is more reliable.

This fixes "insert a link" failures, see https://travis-ci.org/silverstripe/silverstripe-cms/jobs/14281251
This commit is contained in:
Ingo Schommer 2013-11-30 13:27:20 +01:00
parent fd41112d15
commit df2d59df1c

View File

@ -92,7 +92,7 @@ class CmsFormsContext extends BehatContext {
$element = $page->findField($locator); $element = $page->findField($locator);
assertNotNull($element, sprintf('HTML field "%s" not found', $locator)); assertNotNull($element, sprintf('HTML field "%s" not found', $locator));
$actual = $element->getAttribute('value'); $actual = $element->getValue();
$regex = '/'.preg_quote($html, '/').'/ui'; $regex = '/'.preg_quote($html, '/').'/ui';
if (!preg_match($regex, $actual)) { if (!preg_match($regex, $actual)) {
$message = sprintf( $message = sprintf(