Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 0cd156d

Browse files
authored
feat(debugging): Add webdriver logging and highlight delay. (#4039)
This adds two options, both of which are implemented with Blocking Proxy. --webDriverLogDir will create a readable log with timing information of webdriver commands in the specified directory. --highlightDelay will pause before clicking on elements or sending keys. While paused, the element that's about to be affected will be highlighted.
1 parent 9c2274d commit 0cd156d

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

lib/bpRunner.ts

+6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ export class BlockingProxyRunner {
2323
'--seleniumAddress',
2424
this.config.seleniumAddress,
2525
];
26+
if (this.config.webDriverLogDir) {
27+
args.push('--logDir', this.config.webDriverLogDir);
28+
}
29+
if (this.config.highlightDelay) {
30+
args.push('--highlightDelay', this.config.highlightDelay.toString());
31+
}
2632
this.bpProcess = fork(BP_PATH, args, {silent: true});
2733
logger.info('Starting BlockingProxy with args: ' + args.toString());
2834
this.bpProcess

lib/config.ts

+19
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,25 @@ export interface Config {
498498
*/
499499
ignoreUncaughtExceptions?: boolean;
500500

501+
/**
502+
* If set, will create a log file in the given directory with a readable log of
503+
* the webdriver commands it executes.
504+
*
505+
* This is an experimental feature. Enabling this will also turn on Blocking Proxy
506+
* synchronization, which is also experimental.
507+
*/
508+
webDriverLogDir?: string;
509+
510+
/**
511+
* If set, Protractor will pause the specified amount of time (in milliseconds)
512+
* before interactions with browser elements (ie, sending keys, clicking). It will
513+
* also highlight the element it's about to interact with.
514+
*
515+
* This is an experimental feature. Enabling this will also turn on Blocking Proxy
516+
* synchronization, which is also experimental.
517+
*/
518+
highlightDelay?: number;
519+
501520
// ---------------------------------------------------------------------------
502521
// ----- The test framework
503522
// --------------------------------------------------

lib/runner.ts

+4
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@ export class Runner extends EventEmitter {
372372
(wdpromise as any).USE_PROMISE_MANAGER = this.config_.SELENIUM_PROMISE_MANAGER;
373373
}
374374

375+
if (this.config_.webDriverLogDir || this.config_.highlightDelay) {
376+
this.config_.useBlockingProxy = true;
377+
}
378+
375379
// 0) Wait for debugger
376380
return q(this.ready_)
377381
.then(() => {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@types/node": "^6.0.46",
1616
"@types/q": "^0.0.32",
1717
"@types/selenium-webdriver": "~2.53.39",
18-
"blocking-proxy": "0.0.3",
18+
"blocking-proxy": "0.0.4",
1919
"chalk": "^1.1.3",
2020
"glob": "^7.0.3",
2121
"jasmine": "^2.5.3",

0 commit comments

Comments
 (0)