Using the protractor, you perform end-to-end tests (for example, if you clicked on the interface — buttons, anchors — and read what was displayed — what you decided to finally expose ) the view), you do not have access to the JavaScript variables encapsulated inside your controllers.
The type of test you're talking about is unit test, where you test only your doLogin function by entering a $ scope object filled with relevant data, and then claiming that it does exactly what you expected by testing js variables.
Although, if $scope.authentication.user changes the view when set to true (for example, if you show "Authentication successfully" or even route to another view), you can claim with protractor that this behavior has passed (by checking the message "Authentication successfully "in the DOM after running loggin), but keep in mind that this is still e2e testing.
source share