debug broken on 0.19.0 but works on 0.18.1
I'm unable to debug on protractor 0.19.0
Failed to open socket on port 5858, waiting 1000 ms before retrying
Downgraded to protractor 0.18.1 and worked fine! Then re-installed 0.19.0 to test again, and the same socket error.
Tested on chrome33 & firefox27, chromedriver 2.9. node 0.10.25
Using webdriver-manager start in another console.
$ protractor debug config/local/firefox.js
< debugger listening on port 5858
connecting... ok
break in /usr/local/lib/node_modules/protractor/lib/cli.js:7
5 * Values from command line options override values from the config.
6 */
7 'use strict';
8
9 // Coffee is required here to enable config files written in coffee-script.
debug> c
< ------------------------------------
< PID: 15196 (capability: firefoxANY #1)
< ------------------------------------
< debugger listening on port 5858
< Failed to open socket on port 5858, waiting 1000 ms before retrying
< Failed to open socket on port 5858, waiting 1000 ms before retrying
< Failed to open socket on port 5858, waiting 1000 ms before retrying
< Failed to open socket on port 5858, waiting 1000 ms before retrying
< Failed to open socket on port 5858, waiting 1000 ms before retrying
< Failed to open socket on port 5858, waiting 1000 ms before retrying
Then port 5858 seems to be left open:
$ sudo lsof -i tcp:5858
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 15185 user 11u IPv4 1397240 0t0 TCP localhost:58131->localhost:5858 (ESTABLISHED)
node 15187 user 9u IPv4 1397907 0t0 TCP localhost:5858 (LISTEN)
node 15187 user 10u IPv4 1395469 0t0 TCP localhost:5858->localhost:58131 (ESTABLISHED)
node 15196 user 9u IPv4 1397907 0t0 TCP localhost:5858 (LISTEN)
node 15196 user 10u IPv4 1395469 0t0 TCP localhost:5858->localhost:58131 (ESTABLISHED)
Please note debug works well when i re-install 0.18.1
Tried with a remote selenium grid, same issue so webdriver-manager is not related.
https://github.com/angular/protractor/issues/549 looks like a question but might be related.
yup, same here- doesn't work on 0.19 (although i don't see those socket errors), seems to be working with 0.18.1
I get the above error using both 0.19.0 and 0.18.1.
@mcalthrop ensure you kill all node processes before trying again on 0.18.1
Thanks Leo, good call – correction: debugging works on 0.18.1, but on 0.19.0 I get the error described above.
i'm glad to help narrowing this issue :)
Yep, definitely don't want any red herrings!
I hope this bug gets picked up soon. Making it hard to debug.
On the radar! Thanks for pointing this out!
That's right! debugger is working on 0.18.1, however i had to change chromeDriver within protractor config file, because I was getting an error about path.
chromeDriver: '../node_modules/protractor/selenium/chromedriver'
Fix is in - should be out next release. Thanks for your patience, everyone.
The issue still seems to be present in version 0.20.1. I am running protractor with the debug param, but the test completes successfully and competently ignores the line which says browser.debugger();
@dineshdh can you post your exact command line and the OS you are using?
Works for me on 0.20.1, Linux.
I am using Windows 8, and running the below command from within the root of my project
"C:\Program Files\nodejs\node.exe" node_modules\protractor\lib\cli.js debug protractor_conf.js
output
------------------------------------
PID: 13372 (capability: chrome #1)
------------------------------------
Starting debugger agent.
debugger listening on port 5858
Using the selenium server at http://localhost:4444/wd/hub
debug> connecting....
Finished in 3.076 seconds
1 test, 1 assertion, 0 failures
Process finished with exit code 0
protractor_conf.js
exports.config = {
/**
* Use `seleniumAddress` for faster startup; run `./node_modules/.bin/webdriver-manager start` to launch the Selenium server.
* Use `seleniumPort` to let Protractor manage its own Selenium server instance (using the server JAR in its default location).
*/
seleniumAddress: 'http://localhost:4444/wd/hub',
// seleniumPort: 4444,
/**
* Path to your E2E test files, relative to the location of this configuration file.
* We're pointing to the directory where our CoffeeScript output goes.
*/
specs: [
'./test/app_spec.js'
],
/**
* Properties passed to Selenium -- see https://code.google.com/p/selenium/wiki/DesiredCapabilities for more info.
*/
capabilities: {
'browserName': 'chrome'
},
/**
* This should point to your running app instance, for relative path resolution in tests.
*/
baseUrl: 'http://localhost:9001'
};
app_spec.js
describe('homepage', function() {
it('should load the page', function() {
browser.get('#/login');
var url = browser.getCurrentUrl();
browser.debugger();
var version = element(by.binding('version'));
expect(version.getText()).toEqual('1.0.0');
},10000);
});
@dineshdh can you try running with protractor instead of node.exe lib/cli.js?
That works fine for me on mac/linux but maybe there's something weird on windows?
@juliemr, I ran using protractor (protractor debug protractor_conf.js) instead of the cli.js, but it still ignored browser.debugger();
browser.debugger() is being ignored by protractor 0.20.1 on Windows 7 (node-debug 0.1.0)
My test:
describe('angularjs homepage', function() { it('should greet the named user', function() { console.log("about to break..."); browser.debugger(); console.log("after the break..."); expect(1).toEqual(1); }); });
Console:
c:\TFS\A\DEV>"C:\Program Files\nodejs\node" c:\tfs\a\DEV\node_modules\protractor\lib\cli.js debug C:\TFS\A\DEV\protractor.config.js
PID: 6136 (capability: chrome #1)
Starting debugger agent. debugger listening on port 5858 Using the selenium server at http://127.0.0.1:4444/wd/hub connecting... ok break in timers.js:77 75 } 76 77 function listOnTimeout() { 78 var msecs = this.msecs; 79 var list = this; debug> c debug> about to break... after the break... break in c:\tfs\a\DEV\node_modules\protractor\lib\protractor.js:932 930 var flow = webdriver.promise.controlFlow(); 931 flow.execute(function() { 932 debugger; 933 }, 'add breakpoint to control flow'); 934 }; debug> c debug> .
Finished in 4.111 seconds 1 test, 1 assertion, 0 failures
I also find that browser.debugger() is not pausing the tests on a Mac.
It wasn't working in 0.18 so installed 0.20.1 and no change. Here's the the command line argument:
protractor debug config/protractor/localhost.conf.js --seleniumServerJar node_modules/protractor/selenium/selenium-server-standalone-2.40.0.jar
The test:
describe('Links to the page', function () { beforeEach(function () { TEST_UTILS.openNavMenu(); });
it('should show the link on the navigation menu', function () {
browser.debugger();
...
});
});
After some more investigation, I found that browser.debugger() DOES work when there are no syntax errors in that particular test (e.g. element(...).text() vs element(...).getText() )
So this works for me:
it('should show the link on the navigation menu', function () { browser.debugger(); // empty test });
Still appears to be broken in WebStorm with Protractor 0.20.1. I tried many variations and watch The video, but nothing resolved the problem within WebStorm of hanging during debug start - until I rolled back to Protractor v 0.18.1. I made no other changes to my environment (same as video), except rolling back Protractor, and now it works as expected, with the ability to use the IDE to set breakpoints inline. I've rolled back and forth between versions twice just to confirm that is indeed the only variable changed.
By the way, I'm using WebStorm 7.0.3 on Mac. Here's how WebStorm starts the debugger:
/usr/local/bin/node --debug-brk=53819 node_modules/protractor/lib/cli.js config/pro_conf.js
Typing this exact same command in the terminal manually WILL HANG. In order for this to work in the terminal, the "--debug..." part must appear after the cli path. That's true for both version 18 and 20. However, version 18 seems to properly account for this different set of launch args inside of WebStorm.
Unfortunately, I must confirm that debugging is still broken in WebStorm(7/8) with Protractor 0.20.1. ;-(