Fixing log tests

The log tests fail from run to run. It seems that they fail if the logs api call takes too long to return. I added a waitFor method that allows us to wait for this calls to be finished.