DEV Community

Cover image for Emulate GeoLocation for Manual Testing
Pablo Calvo for coffeestain.io

Posted on

Emulate GeoLocation for Manual Testing

In a web world so advanced that it is almost mandatory to deliver unique User Experiences to unique Customers Profiles, we need to make sure our system behaves as expected under different circumstances, and those circumstances can be as simple as where my customers are located.

Old fashion way!

One simple solution to test Geo Location features is to use a VPN provider that can easily transport us to almost anywhere in the world. But as simple as the solution looks like, it also comes with several constraints: Limited to the VPN provider location points and really hard to programmatically change location on demand, and of course the monetary cost of acquiring the service.

Google Chrome DevTools to the rescue!

With google chrome devTools we can easily override the user current geo location and test our unique experience. Check it out here.

Let's try it out!

Once you have followed the previous link and know how to change the default location, let's make some tests around it.

  1. Navigate to https://www.where-am-i.net/, and check the current location.
    Alt Text

  2. Let's override the default user location to Berlin, and notice how the map is automatically updated.
    Alt Text

  3. Let's try one more time with a different city.
    Alt Text

So far pretty awesome...

Custom locations

We can basically add anywhere in the world as a custom location, as long as the timezone matches with the geo coordinates.

Check this list to find the supported timezones.

  1. First find a timezone you want to test. i.e. America/Costa_Rica.
  2. Go to google maps and find the right coordinates. ..www.google.com/maps/place/San+Jos%C3%A9,+Costa+Rica/@**9.9314988,-84.0951252**,14.76z/data..
  3. Then add everything as a new custom location on the Sensors window. Alt Text

As simple as that you can know use your custom timezone.

Alt Text

Final Thoughts

Geo Location testing just turned very simple with Google Chrome and devTools. Of course you are limited to this specific browser and I think that the use of a VPN will be a solid complement for this kind of testing.

Comment below what you do to test geo location features on your website, and any comments you have!!

Top comments (1)

Collapse
 
yeri profile image
Yeri Manderi

while building whereami.place/, i faced similar issue with customizing the experience for different users under different circumstance, lets say the phone location is turned off, or they are using a VPN. These small changes can actually distort the result of the location app. So i had to put out a notice just incase it wasnt working as expected