Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Killing web driver more surgically. #1365

Merged
merged 1 commit into from
Apr 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/Robo/Commands/Tests/BehatCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function behat() {
$this->createReportsDir();
$this->launchWebDriver();
$this->executeBehatTests();
$this->killWebDriver();
}

/**
Expand All @@ -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.
*/
Expand All @@ -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');
}

/**
Expand Down Expand Up @@ -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');
}

/**
Expand Down