Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared session not stopped after last test for browser - using multible browsers #352

Open
PatricB opened this issue Oct 1, 2015 · 1 comment

Comments

@PatricB
Copy link

PatricB commented Oct 1, 2015

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.

@PatricB
Copy link
Author

PatricB commented Oct 2, 2015

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. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant