Fixing the test for pushstate #652

The test for pushstate #652 would occasionally fail due to timing issues, this should ensure that it doesn't run into the issue of the window not being ready.