diff --git a/src/Robo/Commands/Tests/BehatCommand.php b/src/Robo/Commands/Tests/BehatCommand.php index e4bbf3801..bb1488b36 100644 --- a/src/Robo/Commands/Tests/BehatCommand.php +++ b/src/Robo/Commands/Tests/BehatCommand.php @@ -62,6 +62,7 @@ public function behat() { $this->createReportsDir(); $this->launchWebDriver(); $this->executeBehatTests(); + $this->killWebDriver(); } /** @@ -76,6 +77,18 @@ protected function launchWebDriver() { } } + /** + * Kills the appropriate web driver based on configuration. + */ + protected function killWebDriver() { + if ($this->getConfigValue('behat.launch-phantomjs')) { + $this->killPhantomJs(); + } + elseif ($this->getConfigValue('behat.launch-selenium')) { + $this->killSelenium(); + } + } + /** * Launches selenium server and waits for it to become available. */ @@ -99,7 +112,7 @@ protected function launchSelenium() { protected function killSelenium() { $this->logger->info("Killing any running Selenium processes"); $this->getContainer()->get('executor')->killProcessByPort('4444'); - $this->getContainer()->get('executor')->killProcessByName('selenium'); + $this->getContainer()->get('executor')->killProcessByName('selenium-server-standalone'); } /** @@ -137,7 +150,7 @@ protected function launchPhantomJs() { */ protected function killPhantomJs() { $this->getContainer()->get('executor')->killProcessByPort('4444'); - $this->getContainer()->get('executor')->killProcessByName('phantomjs'); + $this->getContainer()->get('executor')->killProcessByName('bin/phantomjs'); } /**