I\'m using Protractor (with Jasmine) to test my AngulaJs application.
As result of some of my action I get some data saved in the localStorage. Now I need to test ot
I haven't found a cool way to do that, but if I run my statement
browser.executeScript("localStorage.removeItem('config');")
within a it('description') statement it works. Example:
it('should compile and save base config for billing',function(){
browser.executeScript("localStorage.removeItem('config');")
//my test
});
This remove the item named config, and so my test works, but while searching and talking about this issue the main response I got is:
"localStorage is not you product, so you don't need (read: you must not) test it. The right way is to mock it and inject it contents when they are needed"
I'm still looking into this to understrand how, meanwhile I think that a not philosophically perfect test is still better than nothing so..
Hope this helps...