Skip to content

Commit 15142ea

Browse files
authored
fix: use this.options instead of this.config (#4186)
1 parent 4543e05 commit 15142ea

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

lib/helper/Puppeteer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ class Puppeteer extends Helper {
486486
if (!page) return;
487487
page.setDefaultNavigationTimeout(this.options.getPageTimeout);
488488
this.context = await this.page.$('body');
489-
if (this.config.browser === 'chrome') {
489+
if (this.options.browser === 'chrome') {
490490
await page.bringToFront();
491491
}
492492
}
@@ -658,9 +658,9 @@ class Puppeteer extends Helper {
658658
url = this.options.url + url;
659659
}
660660

661-
if (this.config.basicAuth && (this.isAuthenticated !== true)) {
661+
if (this.options.basicAuth && (this.isAuthenticated !== true)) {
662662
if (url.includes(this.options.url)) {
663-
await this.page.authenticate(this.config.basicAuth);
663+
await this.page.authenticate(this.options.basicAuth);
664664
this.isAuthenticated = true;
665665
}
666666
}

lib/helper/REST.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,12 @@ class REST extends Helper {
7272
this.options.maxBodyLength = maxContentLength;
7373
}
7474

75-
this.options = { ...this.options, ...config };
75+
// override defaults with config
76+
this._setConfig(config);
77+
7678
this.headers = { ...this.options.defaultHeaders };
7779
this.axios = axios.create();
80+
// @ts-ignore
7881
this.axios.defaults.headers = this.options.defaultHeaders;
7982
}
8083

lib/helper/WebDriver.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -977,12 +977,12 @@ class WebDriver extends Helper {
977977
*/
978978
amOnPage(url) {
979979
let split_url;
980-
if (this.config.basicAuth) {
980+
if (this.options.basicAuth) {
981981
if (url.startsWith('/')) {
982-
url = this.config.url + url;
982+
url = this.options.url + url;
983983
}
984984
split_url = url.split('//');
985-
url = `${split_url[0]}//${this.config.basicAuth.username}:${this.config.basicAuth.password}@${split_url[1]}`;
985+
url = `${split_url[0]}//${this.options.basicAuth.username}:${this.options.basicAuth.password}@${split_url[1]}`;
986986
}
987987
return this.browser.url(url);
988988
}

0 commit comments

Comments
 (0)