condition-based-waiting

Replace arbitrary timeouts with condition polling for reliable async tests