Fixed the failing test by using assertTrueEventually as recommended by ahmetmircik.