Long title but simple problem that I really haven't found a good solution to.
Prerequisites
I'm currently implementing a feature that will display the current position of the device in map and it's based on the Geolocate-control of OpenLayers. It works great for the initial load but I would like to simulate a person moving around geographically with their device for testing purposes.
What I've tried
Emulation.setGeolocationOverride
, but this does not trigger watchPosition
being updated for navigator.geolocation
.Does anyone know of any best practice for this problem? At the moment I have to revert to some refactoring and simulate some updates using setInterval
. This however won't fully test the behavior of the navigator.geolocation
-feature without me running around with my developer-device in the wild.
For anyone working with OpenLayers 2.x I would like to add that you can save yourself a lot of headache by specifying the watch
-property to true using the Geolocate-control. This is by default false
which caused a lot of testing to fail. Simple testing using the Sensors-feature of DevTools works as intended if the watch
-property is set.