Skip to content

fix: deprecate some JSON Wire Protocol commands #4104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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