Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to simulate sharing geolocation with Capybara?

My scenario calls for user giving permission for the app to user his location. This dialog looks different in every browser. How do I go about testing it with Capybara?

like image 482
picardo Avatar asked Sep 09 '11 21:09

picardo


1 Answers

I've successfully used this in a Cucumber step definition:

page.execute_script "navigator.geolocation.getCurrentPosition = function(success) { success({coords: {latitude: 50.455755, longitude: 30.511565}}); }"
like image 97
davetapley Avatar answered Oct 06 '22 02:10

davetapley