Skip to content

Commit b551457

Browse files
committed
test: check with geo
1 parent e46a362 commit b551457

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

test/functional/android/webdriver/device_test.rb

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,34 @@ def test_page_source
5757
end
5858

5959
def test_location
60-
latitude = 100
61-
longitude = 100
60+
latitude = 80
61+
longitude = -80
6262
altitude = 75
6363
@driver.set_location(latitude, longitude, altitude)
6464

6565
return if ci?
6666

67-
# Here has been improved in Appium 1.14.0, but it is still unstable on Emulator...
6867
loc = @@core.wait { @driver.location } # check the location
69-
assert_equal 100, loc.latitude
70-
assert_equal 100, loc.longitude
68+
assert_equal 80, loc.latitude
69+
assert_equal(-80, loc.longitude)
7170
assert_equal 75, loc.altitude
7271
end
7372

73+
def test_location_with_mobile_ext
74+
latitude = 80
75+
longitude = -80
76+
altitude = 75
77+
@driver.execute_script(
78+
'mobile: setGeolocation',
79+
{ latitude: latitude, longitude: longitude, altitude: altitude }
80+
)
81+
82+
loc = @@core.wait { @driver.execute_script 'mobile: getGeolocation' } # check the location
83+
assert_equal 80, loc['latitude']
84+
assert_equal(-80, loc['longitude'])
85+
assert_equal 75, loc['altitude']
86+
end
87+
7488
def test_accept_alert
7589
@@core.wait { @driver.find_element :accessibility_id, 'App' }.click
7690
@@core.wait { @driver.find_element :accessibility_id, 'Alert Dialogs' }.click

0 commit comments

Comments
 (0)