[SJS-144]: Create a function to do a _wait until condition is met