-
Notifications
You must be signed in to change notification settings - Fork 20
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 sessionStrategy: UnknownError when getSession() called in second test method #53
Comments
Can you please describe what you want to achieve instead? Following example should be working: <?php
class ExampleTest extends BrowserTestCase
{
public static $browsers = array(
array(
// ....
'sessionStrategy' => 'shared',
// ....
)
);
public function testSomethingNeededForOtherTests()
{
$session = $this->getSession();
$session->visit('http://www.google.com');
}
/*
* @depends testSomethingNeededForOtherTests
*/
public function testTwo()
{
$session = $this->getSession();
// here you'll be on that http://www.google.com
}
} I don't know your usecase, because even with |
Ah, I understand now why you started to use Maybe it would be best if you can implement #5 feature instead? |
Thanks, I will investigate the #5 feature. But your ExampleTest code does not run, I get the same error:
I'm not sure what you mean by my usecase, but regarding your comment "because even with isolated session strategy same browser window is reused", it is not true for me: For each test, the browser opens (taking 4 seconds or so each time) and then closes before the next test. |
Does this work if you try different browser (or different browser version) and different Selenium server version. It can be bug in latest Selenium server version as well.
That maybe is how I wanted it to happen, but after finding #5 I realized that this isn't the case. After a bit of debugging I've found a bug, that only happens, when you've have, within same test suite:
Then end of test using shared session strategy triggers isolated session strategy by mistake, which ends the session, when it shouldn't. |
I've created #54 . Please test, by applying changes made there locally, if that does solve the problem you're describing? If it does, then |
I'm still grappling understanding all this, but AFAIK all the tests are using shared session - I have only been running ExampleTest on its own. But there was success with #54, I copied over the replacement IsolatedSessionStrategy.php and SharedSessionStrategy.php , and now it works as expected. Thanks! |
I've released 2.1.1 version (see https://github.com/minkphp/phpunit-mink/releases/tag/v2.1.1). I recommend updating to that version in the |
I am running tests with PHPUnit, using Mink to write acceptance tests.
I have come across the error when modifying the "GeneralTest" class given in the examples.
To reproduce:
For now, the only workaround I have is to omit the shared session declaration and have a new browser window load for each test method (unnecessarily slow).
The text was updated successfully, but these errors were encountered: