Skip to content
Merged
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
39 changes: 21 additions & 18 deletions src/browser/existing-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,30 +340,33 @@ export class ExistingBrowser extends Browser {
}

protected _decorateUrlMethod(session: WebdriverIO.Browser): void {
session.overwriteCommand("url", async (origUrlFn, uri): Promise<void | string | WebdriverIO.Request> => {
if (!uri) {
return session.getUrl();
}
session.overwriteCommand(
"url",
async (origUrlFn, uri, params): Promise<void | string | WebdriverIO.Request> => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked how do the typescript typings work, does typescript see params type in tests code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, all works, I tested it

if (!uri) {
return session.getUrl();
}

const newUri = this._resolveUrl(uri);
this._meta.url = newUri;
const newUri = this._resolveUrl(uri);
this._meta.url = newUri;

if (this._config.urlHttpTimeout) {
this.setHttpTimeout(this._config.urlHttpTimeout);
}
if (this._config.urlHttpTimeout) {
this.setHttpTimeout(this._config.urlHttpTimeout);
}

const result = await origUrlFn(newUri);
const result = await origUrlFn(newUri, params);

if (this._config.urlHttpTimeout) {
this.restoreHttpTimeout();
}
if (this._config.urlHttpTimeout) {
this.restoreHttpTimeout();
}

if (this._clientBridge) {
await this._clientBridge.call("resetZoom");
}
if (this._clientBridge) {
await this._clientBridge.call("resetZoom");
}

return result;
});
return result;
},
);
}

protected _resolveUrl(uri: string): string {
Expand Down
Loading