nathanboktae / mocha-phantomjs-core

Easiest way to run client-side Mocha tests in PhantomJS or SlimerJS :ghost:
MIT License
34 stars 11 forks source link

issues with phantomjs 2 and cookies #4

Open nathanboktae opened 9 years ago

nathanboktae commented 9 years ago

Before we had a test that was adding a cookie without a doman, loading the tests on the file: protocol, and it saw the cookie there. Now in phantomjs2, that cookie fails to add because it has no domain. Also, that test didn't make much sense in the real world. Cookies always are tied to a domain, but file: has always been special in the same origin policy, not really having a domain, so the test wasn't very accurate to begin with.

In my manual tests, I wasn't able to add a cookie before loading a page with a domain at all.... :/

Help wanted with this one.

MaestroJurko commented 8 years ago

How does someone add cookie per page, because in documentation I only see addCookie, and it adds it to phantom?

nathanboktae commented 8 years ago

Phantomjs 1 didn't support this so mocha-phantomjs didn't support it explicitly. However if you use a before hook, you could use the API to set the cookies as you wish.