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

Only start session if the session has not been started before #732

Closed
wants to merge 5 commits into from

Conversation

peterrehm
Copy link

As discussed in #731.

@peterrehm peterrehm mentioned this pull request Feb 7, 2017
@@ -83,34 +101,10 @@ public function testRestart()
$this->session->restart();
}

public function testVisitWithoutRunningSession()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test must not be removed. We still need to cover the case of calling visit on a started and on a non-started session IMO (thus, your mocks don't describe the actual interaction happening, as you removed the mocking of isStarted

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the discussion from https://github.com/minkphp/Mink/pull/733/files#r99773293 is meant to happen on this PR instead.

src/Session.php Outdated
@@ -67,7 +67,10 @@ public function isStarted()
*/
public function start()
{
$this->driver->start();
// start session if needed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless comment. The phpdoc already says it

src/Session.php Outdated
*
* Calling any action before visiting a page is an undefined behavior.
* The only supported method calls on a fresh driver are
* - resizeWindow()
* - maximizeWindow()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we want to allow this, we must add new tests in the driver testsuite calling these methods before visiting a page, to ensure it actually works in all drivers

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, this does not seem related to this PR, but to #733

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, that is my bad. Where would you add the tests? Looking at the CoreDriverTest and the Tests in the Selenium driver I could not see any tests on e.g. the visit method

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved that to #733.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the driver testsuite lives in https://github.com/minkphp/driver-testsuite and is a dev dependency in all drivers repositories, to share the same testsuite in all of them.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. I was scanning the testsuite, I could not find a test where the autostart is tested e.g. for the visit method by grepping te repository. Do you know if there is anything in this regard?

Copy link
Member

@stof stof Feb 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing to call these methods without visiting a page is not related to auto-starting. It is a different feature (and this is what you need to test).

Auto-starting is not tested in the driver testsuite, because drivers don't care about it. It is implemented at the session level. But being able to resize before visiting is something that drivers themselves must support

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay. So what do you think about: minkphp/driver-testsuite#10

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

Successfully merging this pull request may close these issues.

3 participants