node.js - How to check multiple conditions to be true or false using protractor ,so that it helps in validating input before click -


here code want check value of inputs nick_name , room_name before clicking button(createroom_btn).but not getting how check multiple conditions in single if statement using protractor.

var nick_name = element(by.model('user.vcard.nickname')); var room_name = element(by.model('roomname')); var createroom_btn = element(by.tagname('button')); describe('protractor demo app', function () {     it('should click on create room button', function () {         condition = function () {             return [                 nick_name.getattribute('value').then(function (value) {                     return value.length > 0                 }),                 room_name.getattribute('value').then(function (value) {                     return value.length > 0                 })             ];         };         browser.wait(condition, 8000, "text still not present").then(function (resp) {         });         //button click                  browser.actions().mousemove(createroom_btn).click();     }); }); 

you should use 'and' expectedcondition - http://www.protractortest.org/#/api?view=protractorexpectedconditions.prototype.and - combine conditions. if have value waiting use texttobepresentinelementvalue expectedcondition - http://www.protractortest.org/#/api?view=protractorexpectedconditions.prototype.texttobepresentinelementvalue.

else check if value entered, can write custom condition check length.

var valuepresentnick = function() {   return nick_name.getattribute('value').then(function(txt) {     return txt.length > 0;   }); }; 

create similar room name - valuepresentroom

var condition = ec.and(valuepresentnick , valuepresentroom); browser.wait(condition, 5000);  

http://www.protractortest.org/#/api?view=protractorexpectedconditions


Comments

  1. Thank you for your valuable information about the node.js development security this is an useful one keep sharing the post like this...Ones again thanks
    node.js development Sydney

    ReplyDelete

Post a Comment

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -