wait for behaviour instead of sleep for more robust test