Add wait_for_ajax method to try and fix test failures on slow servers