add more checking/waiting to the unstable tests

These tests are not very stable on CI. Adding more checking to wait until the elements are ready for testing.