phpunit-selenium
phpunit-selenium copied to clipboard
Shared session not stopped after last test for browser - using multible browsers
When I run my test with multible browsers ($browsers array) and session strategy shared, the session of the first browser don't stop after the last test. Until timeout the next session for the next browsers starts.
It would be nice, if until the last test for one browser session, the session would be stopped.
change suggestion for Selenium2TestCase.php:
public function tearDown()
{
parent::tearDown();
if ($this->getName() === $this->getLastTest()) {
$this->stop();
}
}
function getLastTest()
{
$tests = array_filter(get_class_methods($this), function($method){
$reClassName = "/test[A-Z][a-zA-Z]+/";
preg_match($reClassName, $method, $matchClassName);
$reAnnotation = "/@test/";
$rm = new \ReflectionMethod($this, $method);
$docComment = $rm->getDocComment();
preg_match($reAnnotation, $docComment, $matchAnnotation);
return(!empty($matchClassName) || !empty($matchAnnotation));
});
return end($tests);
}
When I have time , I'm going to create a pull request for this. :)