You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
I'm trying to test an angular-ui/bootstrap carousel. Specifically I want to test that the auto-rotate functionality is working. We have it configured to auto-rotate every 5 seconds, so in order to test this I want to first check the index that the rotator is currently on, wait 5 seconds, then check again and see if the index has incremented by 1.
The problem I'm having is when I use browser.sleep(), no matter how long I sleep it for, the carousel never rotates. When it comes out of the sleep the test immediately fails but then the carousel starts auto-rotating again.
Therefore it seems that calling browser.sleep() doesn't just pause the execution of the driver/test but also the execution of any javascript running on the page. If this is how it's supposed to work, how then would one properly perform the test I outlined above?
As a workaround, this seems to work great: ...check current index... var stop = new Date().getTime() + 5000; while (new Date().getTime() < stop) { ; } ...check current index again and compare...
However this obviously feels bad, but I'm not sure how else to block the protractor/selenium test while allowing the browser to continue executing JavaScript. I tried installing the "sleep" npm module but the package currently seems to be broken, so this is what I came up with for the time being.
Any ideas or thoughts on this? Is there a better / "correct" way?