I'm trying to run qunit test cases with PhantomJS. One of my tests are hanging in when phantomJS try to access the navigator.geolocation function of DOM. same test is working fine in the browser, just hangs in the console with phantomJS.
doe phantomJS support geolocations ? any suggestion?
breaks in the following if condition
if(navigator.geolocation) {
window.navigator.geolocation.watchPosition(updateLocation, null, { frequency: 3000 });
}
No.
Simply check the features.js example.
You can add "geolocation-fake-support" for running tests or doing other stuff by injecting the required functions into the DOM on initialization. The following example fakes the navigator.geolocation.getCurrentPosition, thus when the website in the browser calls this API endpoint PhantomJS will always return the configured location.
geolocation.js: