I'm writing some e2e tests and up until now I have been using the sleep(x)
function to wait for ajax calls.
This is not very efficient as I must estimate the value to wait for testing and if I set too big a value then my tests are taking much more time then needed.
Is there a way to sleep for an ajax call duration? or at least when redirecting to a different page a way to sleep for the time the DOM is loaded?