Skip to content

Commit

Permalink
fix: deprecate some JSON Wire Protocol commands (#4104)
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent authored Jan 3, 2024
1 parent 69fc1bf commit dca0c2c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions docs/helpers/WebDriver.md
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,8 @@ Returns **([Promise][25]<DOMRect> | [Promise][25]<[number][22]>)** Element
### grabGeoLocation
This method is **deprecated**.
Return the current geo location
Resumes test execution, so **should be used inside async function with `await`** operator.
Expand Down Expand Up @@ -2018,6 +2020,8 @@ Returns **void** automatically synchronized promise through #recorder
### setGeoLocation
This method is **deprecated**.
Set the current geo location
```js
Expand Down
14 changes: 9 additions & 5 deletions lib/helper/WebDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2448,21 +2448,25 @@ class WebDriver extends Helper {
}

/**
* This method is **deprecated**.
*
*
* {{> setGeoLocation }}
*/
async setGeoLocation(latitude, longitude, altitude = null) {
if (altitude) {
return this.browser.setGeoLocation({ latitude, longitude });
}
return this.browser.setGeoLocation({ latitude, longitude, altitude });
console.log(`setGeoLocation deprecated:
* This command is deprecated due to using deprecated JSON Wire Protocol command. More info: https://webdriver.io/docs/api/jsonwp/#setgeolocation`);
}

/**
* This method is **deprecated**.
*
* {{> grabGeoLocation }}
*
*/
async grabGeoLocation() {
return this.browser.getGeoLocation();
console.log(`grabGeoLocation deprecated:
* This command is deprecated due to using deprecated JSON Wire Protocol command. More info: https://webdriver.io/docs/api/jsonwp/#getgeolocation`);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion test/helper/WebDriver_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,8 @@ describe('WebDriver', function () {
});

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

0 comments on commit dca0c2c

Please sign in to comment.