Make the test more tolerant of slow machines by replacing fixed length
sleep with a Wait condition.