2

I am trying to test the login service using some mock data. Using AuthGuard, secured routes are locked and so upon successful login, it will check the localStorage if there's an authToken.

This is unfortunately failed because Protractor is running in a Node context.

  • Failed: Error: Uncaught (in promise): ReferenceError: localStorage is not defined ReferenceError: localStorage is not defined at RESTService.getAuthToken

This is in the protractor.conf.js:

beforeLaunch: function() {
    require('ts-node').register({
      project: 'e2e'
    });
},

Also, Protractor requires zone-node to run.

In which case, how do I resolve this?

Sorakthun Ly
  • 732
  • 2
  • 8
  • 15

0 Answers0