-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Clear cookies before every test begins #195
Comments
this behavior, while correct, should be documented so that it's not a surprise to users. |
Is there any way to clear the cookies manually? As far as I can tell, cookies are not cleared, making it difficult to test sessions. |
Something like this should work: http://pastie.org/3261820 You might have better luck requesting a URL from the server in beforeEach() that responds with cookie headers. That's also better since HttpOnly cookies can never be reset from JS, and your session cookies should really be HttpOnly for security reasons. ex.
Where that page responds with a blank document but with Set-Cookie headers that cause your session cookies to expire (or just send new ones). |
Elliott, thank you very much for this insightful advice! We will take the Regards, David On Fri, Jan 27, 2012 at 12:03 AM, Elliott Sprehn <
|
instead of this:
you should do:
It's bit weird, I know :-D You don't want to create new injector, instead you want to get hold of current injector, which is assigned to jq data ('$injector'), so you need to wrap the element by jq from within the iframe ($document is iframe's document, but wrapped by jq in the main frame). |
Thank you very much for your advice and clarifications. This is very Regards, David On Fri, Jan 27, 2012 at 2:26 PM, Vojta Jina <
|
You need gymnastic, because you are actually getting into a running app in the iframe :-D We should provide some helpers (dsl) for getting hold of some basic stuff like $injector, I think that's a valid requirement. |
Cool... Makes sense to me! On Jan 27, 2012, at 5:48 PM, Vojta Jinareply@reply.github.com wrote:
|
Thanks guys =D |
too old. likely resolved or we don't care any more. closing. please reopen if you still care. we are migrating to use Protractor which gives you full control over the browser so flushing cookies is much easier. |
before each it() (and associated beforeEach etc.) we should clear the cookies. We cannot clear the cookies on every navigateTo() otherwise you couldn't navigateTo() inside a test to check if there's persistent state that works in your app.
The text was updated successfully, but these errors were encountered: