diff --git a/.travis.yml b/.travis.yml index cb7db35d..cbd13952 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php -dist: trusty +dist: xenial addons: chrome: stable diff --git a/src/Context/BrowserContext.php b/src/Context/BrowserContext.php index f09d04cd..81c3e65d 100644 --- a/src/Context/BrowserContext.php +++ b/src/Context/BrowserContext.php @@ -25,7 +25,9 @@ public function __construct($timeout = 1) */ public function closeBrowser() { - $this->getSession()->stop(); + if ($this->getMink()->isSessionStarted()) { + $this->getSession()->stop(); + } } /** diff --git a/src/HttpCall/HttpCallListener.php b/src/HttpCall/HttpCallListener.php index 4ac5f23c..f7d5afb8 100644 --- a/src/HttpCall/HttpCallListener.php +++ b/src/HttpCall/HttpCallListener.php @@ -51,9 +51,11 @@ public function afterStep(AfterStepTested $event) // For now to avoid modification on MinkContext // We add fallback on Mink try { - $this->httpCallResultPool->store( - new HttpCallResult($this->mink->getSession()->getPage()->getContent()) - ); + if ($this->mink->getSession()->isStarted()) { + $this->httpCallResultPool->store( + new HttpCallResult($this->mink->getSession()->getPage()->getContent()) + ); + } } catch (\LogicException $e) { // Mink has no response } catch (\Behat\Mink\Exception\DriverException $e) { diff --git a/tests/features/browser.feature b/tests/features/browser.feature index e9939f5d..f5a8b17d 100644 --- a/tests/features/browser.feature +++ b/tests/features/browser.feature @@ -1,8 +1,12 @@ Feature: Browser Feature + @javascript + Scenario: Testing when scenario has no HTTP call + Given I wait 0.1 seconds + # If this scenario fails # It's probably because your web environment is not properly setup - # You will find the necessery help in README.md + # You will find the necessary help in README.md @javascript Scenario: Testing simple web access Given I am on "/index.html"