angularjs - Filtering multiple variables from a repeater using evaluate -


i need filter repeater multiple variables (type, name) or other combination of ngrepeat.

one variable

i have done using 1 variable this:

element.all(by.repeater("org in orgs")).filter(function (elm) {     return elm.evaluate("org.type").then(function (orgtype) {         if (orgtype === "org_type_foo") {             return orgtype;         }     }); }).then(function (elms) {     //... }); 

attempt 1

i've tried evaluate() doesn't seem 2 parameters. orgname returns undefined

element.all(by.repeater("org in orgs")).filter(function (elm) {     return elm.evaluate("org.type", "org.name").then(function (orgtype, orgname) {         if (orgtype === "org_type_foo" && orgname === "name1") {             console.log(orgtype + " ------ " + orgname);             return orgtype;         }     }); }).then(function (elms) {     //... }); 

attempt 2

i thinking filter elms again after first filter+evaluate cant seem work since elms elementarrayfinder

element.all(by.repeater("org in orgs")).filter(function (elm) {     return elm.evaluate("org.type").then(function (orgtype) {          if (orgtype === "org_type_foo") {             return orgtype;         }     }); }).then(function (elms) {      elms.filter(function (elm) {     return elm.evaluate("org.name").then(function (orgname) {          if (orgname === "name1") {             return orgname;         }     });     }).then(function (elms) {         //...      });  }); 

you can use protractor.promise.all() method resolve multiple promises @ once.parameter above method pass array of promises , give output array.in case can use below,

element.all(by.repeater("org in orgs")).filter(function (elem) {   return protractor.promise.all([elem.evaluate("org.type"),elem.evaluate("org.name")]).then(function (resultarray) {         return (resultarray[0] === "org_type_foo" && resultarray[1] === "name1")      }   }); }).then(function (elms) { //... }); 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -