Friday 14 April 2017

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

Here is the code where i want to check for the value of inputs nick_name and the room_name before clicking the button(createRoom_btn).But i am not getting how to check for 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 is still not present").then(function (resp) {          

    });          
    //button click         
    browser.actions().mouseMove(createRoom_btn).click();     
    });

    });



via Pooja S Arkasali

No comments:

Post a Comment