During this webinar we look into location services on Android and iOS real devices, as well as emulators and simulators.
We provide you with tips and tricks on when to change the mobile Geo-IP and when to change the mobile GPS, how to use ADB commands to enable the device location, and how to handle the location services permission alerts. We also discuss Appium capabilities for Location Services, using GeoLocation with Appium Desktop, and more.
Key takeaways:
- Understand what Location Services are
- Understand GPS compare to Geo-IP
- Know the Appium commands for Location Services
- The differences in the use of Location Services between Android and iOS
- Learn how to automate tests that involve Location Services
2. About me
2
○ Solutions Architect at Sauce Labs,
based in London, UK
○ I have over 15 years of experience in
software development and software
automation
○ I have a passion for learning new
technologies and new test
frameworks
Eyal Yovel
@eyalyovel
https://github.com/eyaly
3. Agenda
3
○ Introduction
○ Changing geo location manually
○ Changing geo location using Appium Desktop
○ Automate end-to-end user flow with location services - iOS
○ Automate e2e user flow with location services – Android
○ Automate e2e user flow with location services – Execution
○ Automate e2e user flow with location services – Web App
○ About Geo-IP
9. 9
Latitude and Longitude
Latitude - Imaginary lines that measure distance north and south of the
equator
Longitude - Imaginary lines that measure distance east and west of the
prime meridian
Altitude - How high a location is above sea level
20. 20
End to End User Flow with Location Services - iOS
Preparation Permission Alert Test the page
21. 21
End to End User Flow with Location Services - iOS
22. 22
End to End User Flow with Location Services - iOS
https://github.com/eyaly/testng-geo-location-examples
23. 23
End to End User Flow with Location Services - iOS
https://github.com/eyaly/testng-geo-location-examples
24. 24
End to End User Flow with Location Services - iOS
https://github.com/eyaly/testng-geo-location-examples
25. 25
End to End User Flow with Location Services - iOS
https://github.com/eyaly/testng-geo-location-examples
26. 26
End to End User Flow with Location Services - iOS
27. 27
End to End User Flow with Location Services - iOS
28. 28
End to End User Flow with Location Services - iOS
iOS >= 13
iOS =< 12
29. 29
End to End User Flow with Location Services - iOS
https://appium.io/docs/en/writing-running-appium/caps/
// this capability will work for alerts with 2 options (iOS 12 and below)
capabilities.setCapability("autoAcceptAlerts", true);
30. 30
End to End User Flow with Location Services - iOS
https://github.com/appium/appium-xcuitest-driver#settings-api
// change the setting to accept alerts with 3 options
// and select the "Allow While Using App" (iOS 13 and above)
getiosDriver().setSetting("acceptAlertButtonSelector",
"**/XCUIElementTypeButton[`label == "Allow While Using
App"`]");
31. 34
End to End User Flow with Location Services - iOS
32. 35
End to End User Flow with Location Services - iOS
https://github.com/eyaly/testng-geo-location-examples
33. 36
End to End User Flow with Location Services - Android
Preparation Permission Alert Test the page
34. 37
End to End User Flow with Location Services - Android
For API level 29 (Android 10) and above:
Enable: adb shell settings put secure location_mode 3
Disable: adb shell settings put secure location_mode 0
For API level 28 (Android 9) and below:
Enable: adb shell settings put secure
location_providers_allowed +gps
Disable: adb shell settings put secure
location_providers_allowed -gps
35. 38
End to End User Flow with Location Services - Android
36. 39
End to End User Flow with Location Services - Android
37. 40
End to End User Flow with Location Services - Android
Android >= 10
Android =< 9
38. 41
End to End User Flow with Location Services - Android
https://appium.io/docs/en/writing-running-appium/caps/
// Grant permission for alert popups
capabilities.setCapability("autoGrantPermissions", true);
39. 42
End to End User Flow with Location Services - Android
// Grant permission for alert popups
capabilities.setCapability("autoGrantPermissions", true);
40. 43
End to End User Flow with Location Services - Android
// Grant permission for alert popups
capabilities.setCapability("autoGrantPermissions", true);
41. 45
End to End User Flow with Location Services - Execution
42. 46
End to End User Flow with Location Services - Execution
43. 47
End to End User Flow with Location Services - Execution
52. 56
Let’s talk about Geo-IP
GeoIP refersto the method oflocating a computer terminal’s
geographic location by identifying that terminal’s IP address.
(https://help.nexcess.net/77285-other/what-is-geoip)
An IP address is assigned to each device (e.g. computer, printer)
participating in a computer network that uses the Internet Protocol for
communication (https://en.wikipedia.org/wiki/Internet_geolocation)
53. 57
How to change my Geo-IP
- Use VPN (Virtual Private Network) services
- VPN Provider: WonderProxy (https://wonderproxy.com/)
- Use WonderProxy to change the Geolocation of your test traffic
Sauce:
https://wonderproxy.com/docs/devs/guides/globalize-your-testing-with-sauce
https://wiki.saucelabs.com/pages/viewpage.action?pageId=48365781
54. 58
How to Test from different countries
- Use Sauce Connect (tunnel) + WonderProxy