How to write custom expected conditions in Protractor:

Lets see how to create a expected condition to wait till text not present in element:

I went through the source code of the expected condition,

There browser.wait expects a promise that resolves to a condition, so i created a promise that resolves to true of getText()===”, else false:

So the solution is :

let textNotToBePresentInElement= function (elem,text)  {

    return async()=> {
    let textreceived=await elem.getText();
    let bool=textreceived === text;
    return !(bool);
    }
  },


await browser.wait(textNotToBePresentInElement(resultElement,''), 5000, "Result is empty even afer 3 sec");