Correctly waits for requests to finish before testing anything.
Previously it was waiting for a set amount of time which could possibly
cause failures dependant on how quickly these execute
Stops any polling requests once done so that the error callback doesn't
get called with a 404
Closes#30824