Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Geo Location

Compare
Choose a tag to compare
@wswebcreation wswebcreation released this 16 Oct 05:24
dcc7bf7

Your favorite sample app just got a new feature, you can now change Geo Location with Appium like this

geo-location

and this test it with this

	it('should be able to set and validate the geo location with Appium', () => {
		// Appium for Android (v1.19.0 and lower) is cutting the data to 5 chars
		// see https://github.com/appium/io.appium.settings/blob/master/app/src/main/java/io/appium/settings/receivers/LocationInfoReceiver.java#L48
		// const longitude = 52.5003197;
		// const latitude = 13.4514209;
		const longitude = 52.50032;
		const latitude = 13.45143;
		GeoLocation.setLocation({ longitude, latitude });

		// Give the GPS some time to process the new data
		driver.pause(1000);

		// Wait until the position is shown
		GeoLocation.waitUntilPositionShown();

		expect(GeoLocation.getLongitudeValue()).toBe(longitude, 'Incorrect longitude');
		expect(GeoLocation.getLatitudeValue()).toBe(latitude, 'Incorrect latitude');
	});