Skip to content

Commit dca0c2c

Browse files
authored
fix: deprecate some JSON Wire Protocol commands (#4104)
1 parent 69fc1bf commit dca0c2c

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

docs/helpers/WebDriver.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,8 @@ Returns **([Promise][25]<DOMRect> | [Promise][25]<[number][22]>)** Element
12001200
12011201
### grabGeoLocation
12021202
1203+
This method is **deprecated**.
1204+
12031205
Return the current geo location
12041206
Resumes test execution, so **should be used inside async function with `await`** operator.
12051207
@@ -2018,6 +2020,8 @@ Returns **void** automatically synchronized promise through #recorder
20182020
20192021
### setGeoLocation
20202022
2023+
This method is **deprecated**.
2024+
20212025
Set the current geo location
20222026
20232027
```js

lib/helper/WebDriver.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,21 +2448,25 @@ class WebDriver extends Helper {
24482448
}
24492449

24502450
/**
2451+
* This method is **deprecated**.
2452+
*
2453+
*
24512454
* {{> setGeoLocation }}
24522455
*/
24532456
async setGeoLocation(latitude, longitude, altitude = null) {
2454-
if (altitude) {
2455-
return this.browser.setGeoLocation({ latitude, longitude });
2456-
}
2457-
return this.browser.setGeoLocation({ latitude, longitude, altitude });
2457+
console.log(`setGeoLocation deprecated:
2458+
* This command is deprecated due to using deprecated JSON Wire Protocol command. More info: https://webdriver.io/docs/api/jsonwp/#setgeolocation`);
24582459
}
24592460

24602461
/**
2462+
* This method is **deprecated**.
2463+
*
24612464
* {{> grabGeoLocation }}
24622465
*
24632466
*/
24642467
async grabGeoLocation() {
2465-
return this.browser.getGeoLocation();
2468+
console.log(`grabGeoLocation deprecated:
2469+
* This command is deprecated due to using deprecated JSON Wire Protocol command. More info: https://webdriver.io/docs/api/jsonwp/#getgeolocation`);
24662470
}
24672471

24682472
/**

test/helper/WebDriver_test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,8 @@ describe('WebDriver', function () {
11631163
});
11641164

11651165
describe('GeoLocation', () => {
1166-
it('should set the geoLocation', async () => {
1166+
// deprecated JSON Wire method commands
1167+
it.skip('should set the geoLocation', async () => {
11671168
await wd.setGeoLocation(37.4043, -122.0748);
11681169
const geoLocation = await wd.grabGeoLocation();
11691170
assert.equal(geoLocation.latitude, 37.4043, 'The latitude is not properly set');

0 commit comments

Comments
 (0)