From 5e3744ead55b1cff979b3c331f892b25f7602442 Mon Sep 17 00:00:00 2001 From: Matthew Grasmick Date: Tue, 11 Apr 2017 17:02:58 -0400 Subject: [PATCH] Killing web driver more surgically. --- src/Robo/Commands/Tests/BehatCommand.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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'); } /**