I am trying to set a cookie for a test test, but the cookie data does not seem to be available on the page. Here's the setting:
registerSuite(function() {
'test': function() {
return this.remote
.get(require.toUrl("index.html")
.setFindTimeout(5000)
.setCookie({name: "foo", value: "bar"})
.then(function() {
});
}
});
There is no data when accessing document.cookie inside index.html. Any tips on what I'm doing wrong?
Update
I did not solve the problem, but realized that you need to call setCookie () before get (). The way I crack this is to call get () on the noop URL and then call setCookie ()
return this.remote
.get('/')
.setCookie({name: "foo", value: "bar"})
.get(require.toUrl("index.html")
.setFindTimeout(5000)
.setCookie({name: "foo", value: "bar"})
.then(function() {
});
source
share