TL;DR
To fake some local storage data in Protractor E2E test, care about 2 things:
- localStorage can not store Object directly, so you have to JSON.stringify it and then JSON.parse to get it back.
- browser.executeScript actually returns a Promise, so you should JSON.parse the data received by its then function.