Adding waitFor so functional test passes more consistently