-
Notifications
You must be signed in to change notification settings - Fork 280
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
Auto-start session only upon 1st "->visit(...)" method call breaks my test suite #731
Comments
That is unexpected. Any other methods, except |
I am not using others, the question is if there are other. As we cannot know what others want to do prior the forst visit call I would suggest then leave it as it is but maybe optimize the session start prozedure. Right now if you call session start with the selenium driver twice you get different sessions. Only if I add the check if the session is started and start it conditionally it works as expected. How about throwing an exception when you call start on an already started session or only start if it has not been started previously as you are doing here: https://github.com/minkphp/Mink/pull/705/files#diff-06f6ce27521fd9b588fa1d23c8ad02d1R143 |
Here are the list of methods (your's included), that might also need to auto-start session:
We can do that probably. Also when attempting to stop non-started session the exception can be thrown. Nobody really experienced issues with that before by the way. |
I would consider it a bug in the selenium driver. It should not start a second time if it is already started |
or we can indeed handle it at the Session level, solving it for all drivers |
Shall I submit a PR for the autostart and the session handling? |
yeah, please submit a PR |
Yes, on session level. That's what I was talking about.
That would be 2 PRs:
|
Okay, both PRs are provided. |
Any update on this? |
@yakobe See in the PR's, both are awaiting to be merged. You can meanwhile fix that in your CI suite by manually starting the session. Or what issues do you have? |
@peterrehm pretty much the same issues as you with the window resize. I saw the PR's but both are stalled at the moment. |
/**
* @BeforeScenario
*/
public function beforeScenario()
{
if ($this->getSession()->getDriver() instanceof Selenium2Driver) {
$this->getMink()->getSession()->start();
$this->getSession()->resizeWindow(1440, 900, 'current');
}
} |
This change also broke the page object extension (see sensiolabs/BehatPageObjectExtension#92 (comment)), where in a class extending Mink's Page we do: public function open(array $urlParameters = array())
{
$url = $this->getUrl($urlParameters);
$this->getDriver()->visit($url);
$this->verify($urlParameters);
return $this;
} So session is never initialised as we call the driver directly (we used to access Session here, but getSession is deprecated now). |
@jakzal , what you've posted already is part of Page class: https://github.com/sensiolabs/BehatPageObjectExtension/blob/master/src/PageObject/Page.php#L56 |
Btw how about this and the related PRs? Shall I close them? |
If the fix was created/merged, then issue/pr will be closed automatically. |
I know, but as there is no activity in regards to the PRs. I can close them if not wanted. |
In FOSS world delays is usual thing, because FOSS isn't repo maintainer's primary work place 😉 . Not merged PR isn't PR that nobody wants to see. Could you please list all associated PRs from this and other repos (e.g. driver repos) so that I can bulk review them once more and see if anything needs to be fixed before merging? |
Yes, that's what I said. We introduced this code to avoid using deprecated |
I can't seem to find previous code in PageObject that was causing the issues. The only commit I've found was changing |
I've reviewed all PRs and:
|
If I recall correctly this introduced the issue: acf5fb1 And the issue is the session gets restarted without the checks. |
Driver's |
It does. Before session was auto-started in Since then code was change to |
Could you point me to relevant code? acf5fb1 is precisely what breaks the page object extension. Session is not being initialised as we're not calling Session's |
Ah, I get it now. The I've checked all pending PRs and none, once merged, would solve the problem for you. I highly recommend using session. Yes I know it won't be available since Mink 2.0 release, but I will get exact same problem (with session not available in https://github.com/qa-tools/qa-tools, which is also PageObject pattern implementation. |
This was fixed and is now suprisingly broken again since 1.8.0 (should have maybe been the reason for a BC release). So we might as well close this bug. |
to me, the root cause of the issue is that the library extends the Mink DocumentElement instead of wrapping the Mink API into its own API (which would allow it to keep using the session API) |
PR #705 from @aik099 breaks my testsuite as I am resizing the Window prior to each scenario.
This breaks with the error:
The text was updated successfully, but these errors were encountered: