In my test case, using protractor, I have to wait for a custom event.
My actual way to wait is inject a temporary function that changes a boolean and then wait for that boolean to change. In other words:
browser.executeScript('window.on("customEvent", function(){
window.hasBeenTriggered=true;
})
)')
browser.driver.wait(function(){
return browser.executeScript('return window.hasBeenTriggered;' )===true;
});
Is there a better way to wait for custom event in protractor? How do you wait for custom event? Does protractor's API offer a method for doing it?