angularjs - protractor e2e testing Returning Promises from utility steps -


i'm new protractor , promises in general. i've had around, , although there's many posts out there returning promises, or results queued actions none of them make sense me, i'm after described answer hope simple question!

i trying write protractor tests angularjs website.

i using bootstrap , angular mainly, no other third party libraries, other occasional angular add-on such toaster, , bootstrap modal.

i have several 'arrangement steps' before assertion part of test. let's :

  • a) person logs in
  • b) person accesses options form ( may or may not displayed on screen depending on external factors, if it's not present can open button press ).
  • c) person performs action on options form.
  • d) assert text box on form contains correct value.

i can test pass quite when form on screen, bit that's getting me stuck step b) need check first if form active , click button if it's not pefore proceeding step c.

i've tried return promise isdisplayed :

// // user settings form active @ mo? // function _isusersettingsformactive() {     var result = element(by.id(logoutformid)).isdisplayed;     return result; } 

but if call .then on _isusersettingsformactive() following error :

[31mtypeerror: undefined not function[0m 

however if output results of _isusersettinsformactive() see below, know it's returning :

function () { return self.elementarrayfinder_[fnname]. apply(self.elementarrayfinder_, arguments).toelementfinder_(); } 

all want check if item exists , act on before performing assert.

it needs in function, code used in many places throughout test suit. it's not 'expect' itself, more step may or may not need action set browser test pass.

isdisplayed function, should called that:

function _isusersettingsformactive() {     var result = element(by.id(logoutformid)).isdisplayed();     return result; } 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -