javascript - While loops in protractor -


i have started using protractor e2e tests. have combobox lists events match user types in - list empty if no such events found.

what enter 3 random characters, , if combobox list empty, clear combobox , retry 3 random characters. should repeated until non-empty list found.

i have tried using simple while loop this, asynchronous nature of webdriverjs means become stuck in infinite loop. possible somehow wait inside loop combobox populated? or there other, cleaner solution problem?

code:

var query = element(by.model('searchstr'));  query.clear();  var letters = generaterandomletters();  console.log(letters);  query.sendkeys(letters);  var eventlist = element.all(by.repeater('result in results'));  eventlist.count().then(function(count) {      if(count) {          //test continues here      }  });  

declare function calls recursively until condition met. should trick.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -