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

Cookies bleed between scenarios if last step is on a different domain #642

Closed
j4m3s opened this issue Feb 12, 2015 · 4 comments
Closed

Cookies bleed between scenarios if last step is on a different domain #642

j4m3s opened this issue Feb 12, 2015 · 4 comments

Comments

@j4m3s
Copy link

j4m3s commented Feb 12, 2015

Mink v1.5.0, tests run using Selenium

We have acceptance tests that follow the user journey from our site (e.g. localhost) through to paypal, and have found that if the scenario ends on a PayPal page, the cookies from localhost are not cleared and (for example) a user remains logged-in at the start of the next scenario.

Adding a step calling getSession()->restart() at the end resolves the issue.

I haven't verified whether or not the issue occurs with Goutte too (as PayPal depends on javascript) - if it would help let me know and I'll create a test project.

@stof
Copy link
Member

stof commented Feb 12, 2015

When using Selenium, we can indeed only remove cookies for the current domain when resetting the session. reset does not guarantee a full isolation.
GoutteDriver is able to reset all cookies when resetting the session.

Btw, if you use Mink in Behat through MinkExtension, you can mark a scenario as needing a full restart of the session by tagging it as @insulated (though it currently applies to the beginning of the scenario, not the end)

@j4m3s
Copy link
Author

j4m3s commented Feb 12, 2015

I realise I'm pushing the boundaries of this ticket but is the issue limited to Selenium? (i.e. would it work if we used zombie?). GoutteDriver isn't an option in this case as the Paypal sandbox depends so heavily on Javascript.

I only exposed the problem by accident - would it be possible to output a warning of some form to tell users that this unexpected behaviour is taking place thanks to Selenium? It wasn't too serious in our case but I imagine it could cause a lot of head scratching for others wondering what was going on. I had convinced myself scenarios were insulated by default (though I'm not sure where I got that from :).

Thanks for the info about @insulated. Unfortunately it's really the end of the scenario that's the problem - we'd need to insulate every other test too.

@stof
Copy link
Member

stof commented Feb 12, 2015

ZombieDriver is also able to reset the session fully. Only Selenium and Sahi are limited to the current domain (because they are limited by what browsers are allowing from JS).

We are currently in the process of rewriting the Mink documentation. Can you open an issue on the docs repo to ask to document this for session resetting ?

Regarding stopping the session fully at the end of the scenario, I'm opening an issue on MinkExtension to add this feature

@j4m3s
Copy link
Author

j4m3s commented Feb 12, 2015

Thank you :) I'll open the docs issue now.
James.

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

2 participants