Skip to content

Commit

Permalink
fix: use this.options instead of this.config (#4186)
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent authored Feb 10, 2024
1 parent 4543e05 commit 15142ea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/helper/Puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ class Puppeteer extends Helper {
if (!page) return;
page.setDefaultNavigationTimeout(this.options.getPageTimeout);
this.context = await this.page.$('body');
if (this.config.browser === 'chrome') {
if (this.options.browser === 'chrome') {
await page.bringToFront();
}
}
Expand Down Expand Up @@ -658,9 +658,9 @@ class Puppeteer extends Helper {
url = this.options.url + url;
}

if (this.config.basicAuth && (this.isAuthenticated !== true)) {
if (this.options.basicAuth && (this.isAuthenticated !== true)) {
if (url.includes(this.options.url)) {
await this.page.authenticate(this.config.basicAuth);
await this.page.authenticate(this.options.basicAuth);
this.isAuthenticated = true;
}
}
Expand Down
5 changes: 4 additions & 1 deletion lib/helper/REST.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ class REST extends Helper {
this.options.maxBodyLength = maxContentLength;
}

this.options = { ...this.options, ...config };
// override defaults with config
this._setConfig(config);

this.headers = { ...this.options.defaultHeaders };
this.axios = axios.create();
// @ts-ignore
this.axios.defaults.headers = this.options.defaultHeaders;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/helper/WebDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -977,12 +977,12 @@ class WebDriver extends Helper {
*/
amOnPage(url) {
let split_url;
if (this.config.basicAuth) {
if (this.options.basicAuth) {
if (url.startsWith('/')) {
url = this.config.url + url;
url = this.options.url + url;
}
split_url = url.split('//');
url = `${split_url[0]}//${this.config.basicAuth.username}:${this.config.basicAuth.password}@${split_url[1]}`;
url = `${split_url[0]}//${this.options.basicAuth.username}:${this.options.basicAuth.password}@${split_url[1]}`;
}
return this.browser.url(url);
}
Expand Down

0 comments on commit 15142ea

Please sign in to comment.