I am using Protractor-Jasmine-JavaScript.
In below code expect.toBe statement is executed as expected after clicking on both buttons.
element(by.xpath(button1_xpath)).click(); //click on button1
var elem=element(by.xpath(button2_xpath));
browser.sleep(3000)
elem.click(); //click on button2
element(by.xpath(receivedMsg_xpath)).getText().then(function(msg){        
  expect(msg).toBe(Expected_Msg);
});
In below code expect.toBe statement is executed before clicking on second button and hence failing.
  element(by.xpath(button1_xpath)).click();
  var elem=element(by.xpath(button2_xpath));
  var isClickable = exCon.elementToBeClickable(elem);
  browser.wait(isClickable,3000);
  elem.click();
  element(by.xpath(receivedMsg_xpath)).getText().then(function(msg){        
      expect(msg).toBe(Expected_Msg);
  });
I do not want to use browser.sleep(). Is there any way bowser.wait() can work? Or any other alternative solution?