Merge branch 'master' of git://github.com/Behat/MinkExtension

This commit is contained in:
Peter Schultz
2013-03-04 18:48:25 +01:00
8 changed files with 200 additions and 119 deletions

View File

@@ -5,7 +5,8 @@ namespace Behat\MinkExtension\Context;
use Behat\Behat\Context\BehatContext;
use Behat\Mink\Mink,
Behat\Mink\WebAssert;
Behat\Mink\WebAssert,
Behat\Mink\Session;
/*
* This file is part of the Behat\MinkExtension.
@@ -120,7 +121,7 @@ class RawMinkContext extends BehatContext implements MinkAwareInterface
// Under Cygwin, uniqid with more_entropy must be set to true.
// No effect in other environments.
$filename = $filename ?: sprintf('%s_%s_%s.%s', $this->getMinkParameter('browser_name'), date('c'), uniqid('', true), 'png');
$filepath = $filepath ? $filepath : ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir();
$filepath = $filepath ? $filepath : (ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir());
file_put_contents($filepath . '/' . $filename, $this->getSession()->getScreenshot());
}
}

View File

@@ -98,6 +98,10 @@ class Extension implements ExtensionInterface
$minkParameters[$ns] = $tlValue;
} else {
foreach ($tlValue as $name => $value) {
if ('guzzle_parameters' === $name) {
$value['redirect.disable'] = true;
}
$container->setParameter("behat.mink.$ns.$name", $value);
}
}

View File

@@ -7,6 +7,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Behat\Behat\Event\StepEvent;
use Behat\Mink\Mink;
use Behat\Mink\Exception\Exception as MinkException;
/*
* This file is part of the Behat\MinkExtension.
@@ -79,6 +80,10 @@ class FailureShowListener implements EventSubscriberInterface
if (StepEvent::FAILED !== $event->getResult()) {
return;
}
if (!$event->getException() instanceof MinkException) {
return;
}
if (null === $this->parameters['show_cmd']) {
throw new \RuntimeException('Set "show_cmd" parameter in behat.yml to be able to open page in browser (ex.: "show_cmd: open %s")');