angularjs - How to check for the generated password using protractor? -


i have weird scenario:

in automation, have create user. on creation, password wil generated , sent his/her email id. how can automate retrieve password in his/her email(note:i have open new window go his/her email , enter his/her credentials , open particular mail has sent password , copy it) , come application , login his/her username , password? pretty confusing rite

and how can switch tab(supposingly not angular-app), , execute actions enter username , password of email)

for emails, can use package called mail-listener. can follow instructions on this answer, i've done myself , relatively easy setup. can password parsed email.

and far switching other tabs, can use getallwindowhandles(), this:

browser.getallwindowhandles().then(function (handles) {    newwindowhandle = handles[1];    browser.switchto().window(newwindowhandle).then(function () {        // stuff    }); }); 

since it's non-angular page, you'll need set browser.ignoresynchronization = true. can in function when switch window handles, or may want right before step. you'll need use expected conditions control test flow. find necessary elements need interact on non-angular page, i.e.:

var ec = protractor.expectedconditions;      var el = element(by.id('loginform')); browser.wait(ec.visibilityof(el)); // stuff 

edit: open new tab via protractor, can use executescript(). i.e.

browser.executescript("window.open('http://www.google.com')"); 

edit 2: setting mail-listener, code provided in linked question pretty copy/paste me exception of username, password, , host. username/password same user trying login as. host, varies email server. should able find googling "imap host microsoft exchange (or whatever server using)" or going settings of email server.

only other code added function logging errors might identify problem , why can't connect. can put in onprepare() function of config file:

maillistener.on("error", function(err){     console.log(err); }); 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -