Updated the listeners to use the new event classes
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace spec\Behat\MinkExtension\Listener;
|
namespace spec\Behat\MinkExtension\Listener;
|
||||||
|
|
||||||
use Behat\Behat\Tester\Event\ScenarioTested;
|
use Behat\Behat\EventDispatcher\Event\ScenarioTested;
|
||||||
use Behat\Gherkin\Node\FeatureNode;
|
use Behat\Gherkin\Node\FeatureNode;
|
||||||
use Behat\Gherkin\Node\ScenarioNode;
|
use Behat\Gherkin\Node\ScenarioNode;
|
||||||
use Behat\Mink\Mink;
|
use Behat\Mink\Mink;
|
||||||
|
|||||||
@@ -10,8 +10,9 @@
|
|||||||
|
|
||||||
namespace Behat\MinkExtension\Listener;
|
namespace Behat\MinkExtension\Listener;
|
||||||
|
|
||||||
use Behat\Behat\Tester\Event\StepTested;
|
use Behat\Behat\EventDispatcher\Event\AfterStepTested;
|
||||||
use Behat\Testwork\Tester\Result\TestResult;
|
use Behat\Behat\EventDispatcher\Event\StepTested;
|
||||||
|
use Behat\Testwork\Tester\Result\ExceptionResult;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Behat\Mink\Mink;
|
use Behat\Mink\Mink;
|
||||||
use Behat\Mink\Exception\Exception as MinkException;
|
use Behat\Mink\Exception\Exception as MinkException;
|
||||||
@@ -51,21 +52,26 @@ class FailureShowListener implements EventSubscriberInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows last response of failed step with preconfigured command.
|
* Shows last response of failed step with preconfigured command.
|
||||||
|
*
|
||||||
* Configuration is based on `behat.yml`:
|
* Configuration is based on `behat.yml`:
|
||||||
*
|
*
|
||||||
* `show_auto` enable this listener (default to false)
|
* `show_auto` enable this listener (default to false)
|
||||||
* `show_cmd` command to run (`open %s` to open default browser on Mac)
|
* `show_cmd` command to run (`open %s` to open default browser on Mac)
|
||||||
* `show_tmp_dir` folder where to store temp files (default is system temp)
|
* `show_tmp_dir` folder where to store temp files (default is system temp)
|
||||||
*
|
*
|
||||||
* @param StepTested $event
|
* @param AfterStepTested $event
|
||||||
|
*
|
||||||
|
* @throws \RuntimeException if show_cmd is not configured
|
||||||
*/
|
*/
|
||||||
public function showFailedStepResponse(StepTested $event)
|
public function showFailedStepResponse(AfterStepTested $event)
|
||||||
{
|
{
|
||||||
if (TestResult::FAILED !== $event->getResultCode()) {
|
$testResult = $event->getTestResult();
|
||||||
|
|
||||||
|
if (!$testResult instanceof ExceptionResult) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$event->getTestResult()->getException() instanceof MinkException) {
|
if (!$testResult->getException() instanceof MinkException) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,12 @@
|
|||||||
|
|
||||||
namespace Behat\MinkExtension\Listener;
|
namespace Behat\MinkExtension\Listener;
|
||||||
|
|
||||||
use Behat\Behat\Tester\Event\AbstractScenarioTested;
|
use Behat\Behat\EventDispatcher\Event\ExampleTested;
|
||||||
use Behat\Behat\Tester\Event\ExampleTested;
|
use Behat\Behat\EventDispatcher\Event\ScenarioLikeTested;
|
||||||
use Behat\Behat\Tester\Event\ScenarioTested;
|
use Behat\Behat\EventDispatcher\Event\ScenarioTested;
|
||||||
use Behat\Mink\Mink;
|
use Behat\Mink\Mink;
|
||||||
|
use Behat\Testwork\EventDispatcher\Event\ExerciseCompleted;
|
||||||
use Behat\Testwork\ServiceContainer\Exception\ProcessingException;
|
use Behat\Testwork\ServiceContainer\Exception\ProcessingException;
|
||||||
use Behat\Testwork\Tester\Event\ExerciseCompleted;
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,11 +67,11 @@ class SessionsListener implements EventSubscriberInterface
|
|||||||
* `@insulated` tag will cause Mink to stop current sessions before scenario
|
* `@insulated` tag will cause Mink to stop current sessions before scenario
|
||||||
* instead of just soft-resetting them
|
* instead of just soft-resetting them
|
||||||
*
|
*
|
||||||
* @param AbstractScenarioTested $event
|
* @param ScenarioLikeTested $event
|
||||||
*
|
*
|
||||||
* @throws ProcessingException when the @javascript tag is used without a javascript session
|
* @throws ProcessingException when the @javascript tag is used without a javascript session
|
||||||
*/
|
*/
|
||||||
public function prepareDefaultMinkSession(AbstractScenarioTested $event)
|
public function prepareDefaultMinkSession(ScenarioLikeTested $event)
|
||||||
{
|
{
|
||||||
$scenario = $event->getScenario();
|
$scenario = $event->getScenario();
|
||||||
$feature = $event->getFeature();
|
$feature = $event->getFeature();
|
||||||
|
|||||||
Reference in New Issue
Block a user