diff --git a/src/Context/DebugContext.php b/src/Context/DebugContext.php index 53ea5a0f..268e07fe 100644 --- a/src/Context/DebugContext.php +++ b/src/Context/DebugContext.php @@ -49,6 +49,8 @@ public function iSaveAScreenshotIn($filename) public function failScreenshots(AfterStepScope $scope) { if (! $scope->getTestResult()->isPassed()) { + $this->displayProfilerLink(); + $suiteName = urlencode(str_replace(' ', '_', $scope->getSuite()->getName())); $featureName = urlencode(str_replace(' ', '_', $scope->getFeature()->getTitle())); if ($this->getBackground($scope)) { @@ -66,6 +68,16 @@ public function failScreenshots(AfterStepScope $scope) } } + private function displayProfilerLink() + { + try { + $headers = $this->getMink()->getSession()->getResponseHeaders(); + echo "The debug profile URL {$headers['X-Debug-Token-Link'][0]}"; + } catch (\Exception $e) { + /* Intentionally leave blank */ + } + } + /** * @param AfterStepScope $scope * @return \Behat\Gherkin\Node\ScenarioInterface