0

How do I make an e2e test with protractor where it logs in automatically.

Right now, there is code in our app.run function that goes like this

var currentUser = Parse.User.current();
$rootScope.user = null;
$rootScope.isLoggedIn = false;

if (currentUser) {
    $rootScope.user = currentUser;
    $rootScope.isLoggedIn = true;
    $state.go('tab.home');
}

So it is depending on the local cache? Is there a way to get it to reload the app without wiping that information?

I tried having one test log in with no beforeEach information, followed by another it block that moved the app to the beginning - didn't work.

Is there a way to get it to start up fresh, so the app.run function is called?

realization
  • 189
  • 12

1 Answers1

0

You can create a seperate test for login the user and run your remaining other tests after the tests for login runs, by specifying the order of the tests in protractor_conf.js file.

Isha Aggarwal
  • 432
  • 5
  • 13