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

Commit 8920028

Browse files
committed
feat(pause): allow the user to specify a port to be used for debugging
Using browser.pause(portNumber) will now start the debugger on the specified port number. Closes #956
1 parent 6641c81 commit 8920028

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/protractor.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -1120,8 +1120,10 @@ Protractor.prototype.debugger = function() {
11201120
* browser.pause() in your test to enter the protractor debugger from that
11211121
* point in the control flow.
11221122
* Does not require changes to the command line (no need to add 'debug').
1123+
*
1124+
* @param {=number} opt_debugPort Optional port to use for the debugging process
11231125
*/
1124-
Protractor.prototype.pause = function() {
1126+
Protractor.prototype.pause = function(opt_debugPort) {
11251127
// Patch in a function to help us visualize what's going on in the control
11261128
// flow.
11271129
webdriver.promise.ControlFlow.prototype.getControlFlowText = function() {
@@ -1171,6 +1173,10 @@ Protractor.prototype.pause = function() {
11711173
return asString;
11721174
};
11731175

1176+
if (opt_debugPort) {
1177+
process.debugPort = opt_debugPort;
1178+
}
1179+
11741180
// Call this private function instead of sending SIGUSR1 because Windows.
11751181
process._debugProcess(process.pid);
11761182
var flow = webdriver.promise.controlFlow();
@@ -1179,7 +1185,7 @@ Protractor.prototype.pause = function() {
11791185
console.log('Starting WebDriver debugger in a child process. Pause is ' +
11801186
'still beta, please report issues at github.com/angular/protractor');
11811187
var nodedebug = require('child_process').
1182-
fork(__dirname + '/wddebugger.js', ['localhost:5858']);
1188+
fork(__dirname + '/wddebugger.js', [process.debugPort]);
11831189
process.on('exit', function() {
11841190
nodedebug.kill('SIGTERM');
11851191
});

lib/wddebugger.js

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ var client = new baseDebugger.Client();
1717
var host = 'localhost';
1818
var port = 5858;
1919

20+
if (process.argv[2]) {
21+
port = process.argv[2];
22+
}
2023
var debuggerRepl;
2124

2225
var resumeReplCallback = null;

0 commit comments

Comments
 (0)