Skip to content

Commit a8443e6

Browse files
authored
Fix enable highlight element (#3778)
* fix the check if highlighting is enabled * default for highlightElement option set to false * add docs and fix commas * fix enable/disable highlightElement for webdriver
1 parent 05942c9 commit a8443e6

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

docs/helpers/Playwright.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Type: [object][5]
7474
- `ignoreLog` **[Array][22]<[string][8]>?** An array with console message types that are not logged to debug log. Default value is `['warning', 'log']`. E.g. you can set `[]` to log all messages. See all possible [values][44].
7575
- `ignoreHTTPSErrors` **[boolean][32]?** Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
7676
- `bypassCSP` **[boolean][32]?** bypass Content Security Policy or CSP
77-
- `highlightElement` **[boolean][32]?** highlight the interacting elements
77+
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false
7878

7979

8080

docs/helpers/Puppeteer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Type: [object][4]
5656
- `manualStart` **[boolean][20]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
5757
- `browser` **[string][6]?** can be changed to `firefox` when using [puppeteer-firefox][2].
5858
- `chrome` **[object][4]?** pass additional [Puppeteer run options][25].
59-
- `highlightElement` **[boolean][20]?** highlight the interacting elements
59+
- `highlightElement` **[boolean][20]?** highlight the interacting elements. Default: false
6060

6161

6262

docs/helpers/WebDriver.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Type: [object][16]
4545
- `desiredCapabilities` **[object][16]?** Selenium's [desired capabilities][6].
4646
- `manualStart` **[boolean][32]?** do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriver"]._startBrowser()`.
4747
- `timeouts` **[object][16]?** [WebDriver timeouts][37] defined as hash.
48-
- `highlightElement` **[boolean][32]?** highlight the interacting elements
48+
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false
4949

5050

5151

lib/helper/Playwright.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const pathSeparator = path.sep;
9393
* @prop {string[]} [ignoreLog] - An array with console message types that are not logged to debug log. Default value is `['warning', 'log']`. E.g. you can set `[]` to log all messages. See all possible [values](https://playwright.dev/docs/api/class-consolemessage#console-message-type).
9494
* @prop {boolean} [ignoreHTTPSErrors] - Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
9595
* @prop {boolean} [bypassCSP] - bypass Content Security Policy or CSP
96-
* @prop {boolean} [highlightElement] - highlight the interacting elements
96+
* @prop {boolean} [highlightElement] - highlight the interacting elements. Default: false
9797
*/
9898
const config = {};
9999

@@ -343,7 +343,8 @@ class Playwright extends Helper {
343343
show: false,
344344
defaultPopupAction: 'accept',
345345
use: { actionTimeout: 0 },
346-
ignoreHTTPSErrors: false, // Adding it here o that context can be set up to ignore the SSL errors
346+
ignoreHTTPSErrors: false, // Adding it here o that context can be set up to ignore the SSL errors,
347+
highlightElement: false,
347348
};
348349

349350
config = Object.assign(defaults, config);
@@ -3478,7 +3479,7 @@ async function saveTraceForContext(context, name) {
34783479
}
34793480

34803481
function highlightActiveElement(element, context) {
3481-
if (!this.options.enableHighlight && !store.debugMode) return;
3482+
if (!this.options.highlightElement && !store.debugMode) return;
34823483

34833484
highlightElement(element, context);
34843485
}

lib/helper/Puppeteer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const consoleLogStore = new Console();
6969
* @prop {boolean} [manualStart=false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
7070
* @prop {string} [browser=chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
7171
* @prop {object} [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
72-
* @prop {boolean} [highlightElement] - highlight the interacting elements
72+
* @prop {boolean} [highlightElement] - highlight the interacting elements. Default: false
7373
*/
7474
const config = {};
7575

@@ -231,6 +231,7 @@ class Puppeteer extends Helper {
231231
keepBrowserState: false,
232232
show: false,
233233
defaultPopupAction: 'accept',
234+
highlightElement: false,
234235
};
235236

236237
return Object.assign(defaults, config);
@@ -2714,7 +2715,7 @@ function getNormalizedKey(key) {
27142715
}
27152716

27162717
function highlightActiveElement(element, context) {
2717-
if (!this.options.enableHighlight && !store.debugMode) return;
2718+
if (!this.options.highlightElement && !store.debugMode) return;
27182719

27192720
highlightElement(element, context);
27202721
}

lib/helper/WebDriver.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const webRoot = 'body';
6262
* @prop {object} [desiredCapabilities] Selenium's [desired capabilities](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities).
6363
* @prop {boolean} [manualStart=false] - do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriver"]._startBrowser()`.
6464
* @prop {object} [timeouts] [WebDriver timeouts](http://webdriver.io/docs/timeouts.html) defined as hash.
65-
* @prop {boolean} [highlightElement] - highlight the interacting elements
65+
* @prop {boolean} [highlightElement] - highlight the interacting elements. Default: false
6666
*/
6767
const config = {};
6868

@@ -429,6 +429,7 @@ class WebDriver extends Helper {
429429
keepCookies: false,
430430
keepBrowserState: false,
431431
deprecationWarnings: false,
432+
highlightElement: false,
432433
};
433434

434435
// override defaults with config
@@ -2914,7 +2915,7 @@ function isModifierKey(key) {
29142915
}
29152916

29162917
function highlightActiveElement(element) {
2917-
if (!this.options.enableHighlight && !store.debugMode) return;
2918+
if (!this.options.highlightElement && !store.debugMode) return;
29182919

29192920
highlightElement(element, this.browser);
29202921
}

0 commit comments

Comments
 (0)