Reputation: 2791
I'm new to Angular and Protractor.
I'm using protractor to test Angular pages. I'm trying to test log-in procedure.
part of the html is:
< li data-ng-show="isLoggedIn()" >
I want to make sure that the credentials are correct by calling the 'isLoggedIn()' function. the 'isLoggedIn()' function is in a controller named 'navControl'.
can I do it? How? are there other suggestions to test log-in?
Upvotes: 1
Views: 1455
Reputation: 2791
Thanks for helping. The exact phrase I was looking for is this:
expect($('[data-ng-show="isLoggedIn()"]').isDisplayed()).toBeTruthy();
Upvotes: 1
Reputation: 1700
You should be testing your log in page (if you are using protractor) like a user - enter some text in your login form, then click the 'Log In' button! After this, inspect the page for whatever elements you are expecting to be visible after a user has logged in. You shouldn't really be directly calling your application functions - testing those falls under unit testing, not e2e testing for which Protractor is designed for :)
Upvotes: 2